This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tinymce.PluginManager.add('mention_plugin', function(editor, url) { | |
// Mock data for recipients | |
const recipients = [ | |
{ avatar: 'https://via.placeholder.com/40', name: 'Alice Johnson', email: 'alice.johnson@example.com' }, | |
{ avatar: 'https://via.placeholder.com/40', name: 'Bob Smith', email: 'bob.smith@example.com' }, | |
{ avatar: 'https://via.placeholder.com/40', name: 'Charlie Brown', email: 'charlie.brown@example.com' } | |
]; | |
editor.on('keypress', function(event) { | |
if (event.key === '@') { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tinymce.PluginManager.add('mention_plugin', function(editor, url) { | |
// The plugin's initialization logic | |
editor.on('keypress', function(event) { | |
if (event.key === '@') { | |
showContextMenu(editor); | |
} | |
}); | |
function showContextMenu(editor) { | |
// Placeholder for showing a context menu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tinymce.PluginManager.add('mention_plugin', function(editor, url) { | |
// The plugin's initialization logic | |
editor.on('keypress', function(event) { | |
if (event.key === '@') { | |
showContextMenu(editor); | |
} | |
}); | |
function showContextMenu(editor) { | |
// Placeholder for showing a context menu |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tinymce.PluginManager.add('mentions', function(editor) { | |
let mentionList = null; | |
let currentMention = null; | |
// Configuration for the mentions feature | |
const mentionsConfig = { | |
delimiter: '@', | |
source: getSuggestions, // Function to get user suggestions | |
insertTemplate: function(mention) { | |
return `<span class="mention" data-user="${mention.id}">@${mention.name}</span>`; |