emotions.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. tinyMCEPopup.requireLangPack();
  2. var EmotionsDialog = {
  3. addKeyboardNavigation: function(){
  4. var tableElm, cells, settings;
  5. cells = tinyMCEPopup.dom.select("a.emoticon_link", "emoticon_table");
  6. settings ={
  7. root: "emoticon_table",
  8. items: cells
  9. };
  10. cells[0].tabindex=0;
  11. tinyMCEPopup.dom.addClass(cells[0], "mceFocus");
  12. if (tinymce.isGecko) {
  13. cells[0].focus();
  14. } else {
  15. setTimeout(function(){
  16. cells[0].focus();
  17. }, 100);
  18. }
  19. tinyMCEPopup.editor.windowManager.createInstance('tinymce.ui.KeyboardNavigation', settings, tinyMCEPopup.dom);
  20. },
  21. init : function(ed) {
  22. tinyMCEPopup.resizeToInnerSize();
  23. this.addKeyboardNavigation();
  24. },
  25. insert : function(file, title) {
  26. var ed = tinyMCEPopup.editor, dom = ed.dom;
  27. tinyMCEPopup.execCommand('mceInsertContent', false, dom.createHTML('img', {
  28. src : tinyMCEPopup.getWindowArg('plugin_url') + '/img/' + file,
  29. alt : ed.getLang(title),
  30. title : ed.getLang(title),
  31. border : 0
  32. }));
  33. tinyMCEPopup.close();
  34. }
  35. };
  36. tinyMCEPopup.onInit.add(EmotionsDialog.init, EmotionsDialog);