// emoji-plugin.js tinymce.PluginManager.add('cpEmoji', function(editor, url) { // Add a button that opens a window editor.addButton('cpEmoji', { text: 'Emoji', icon: false, onclick: function() { // Open window editor.windowManager.open({ title: 'Select Emoji', width: 400, height: 300, body: [ { type: 'container', html: '
', }, ], onsubmit: function(e) { // Insert selected emoji into the editor editor.insertContent(e.data.emoji); }, onOpen: function() { // Create emoji table var emojis = [ '😀', '😃', '😄', '😁', '😆', '😅', '😂', 'ðŸĪĢ', '😊', '😇', '😍', 'ðŸĨ°', '😘', '😗', '😙', '😚', '😋', '😛', '😜', 'ðŸĪŠ', '😎', 'ðŸĨģ', '😏', '😒', // Add more emojis as needed ]; var table = document.getElementById('emojiTable'); let btn = ''; for (var i = 0; i < emojis.length; i++) { btn += ''; } table.innerHTML = btn; // Add click event to emoji buttons var buttons = document.getElementsByClassName('emoji-btn'); for (var j = 0; j < buttons.length; j++) { buttons[j].addEventListener('click', function(event) { editor.windowManager.close(); editor.insertContent(event.target.getAttribute('data-emoji')); }); } } }); } }); });