/** * plugin.js * * Released under LGPL License. * Copyright (c) 1999-2015 Ephox Corp. All rights reserved * * License: http://www.tinymce.com/license * Contributing: http://www.tinymce.com/contributing */ /*global tinymce:true */ tinymce.PluginManager.add('emoticons', function(editor, url) { var emoticons = [ ["cool", "cry", "embarassed", "foot-in-mouth"], ["frown", "innocent", "kiss", "laughing"], ["money-mouth", "sealed", "smile", "surprised"], ["tongue-out", "undecided", "wink", "yell"] ]; function getHtml() { var emoticonsHtml; emoticonsHtml = ''; tinymce.each(emoticons, function(row) { emoticonsHtml += ''; tinymce.each(row, function(icon) { var emoticonUrl = url + '/img/smiley-' + icon + '.gif'; emoticonsHtml += ''; }); emoticonsHtml += ''; }); emoticonsHtml += '
'; return emoticonsHtml; } editor.addButton('emoticons', { type: 'panelbutton', panel: { role: 'application', autohide: true, html: getHtml, onclick: function(e) { var linkElm = editor.dom.getParent(e.target, 'a'); if (linkElm) { editor.insertContent( '' + linkElm.getAttribute('data-mce-alt') + '' ); this.hide(); } } }, tooltip: 'Emoticons' }); });