Is it possible to have custom Functions and commands in the TinyMCE4 Menubar?

﹥>﹥吖頭↗ 提交于 2019-12-08 08:59:50

问题


I have learned how to integrate custom commands in the Tiny Toolbar with the ed.addButton() Function.

Is there a similar way to add functionality to the Upper menu, the menubar ?

In the Tiny Documentation I just found how to change the order of the menu secton with this code in the init function:

menubar: "tools table format view insert edit",


回答1:


Examples :

// Adds a custom menu item to the editor that inserts contents when clicked
// The context option allows you to add the menu item to an existing default menu
tinymce.init({
   ...

   setup: function(ed) {
      ed.addMenuItem('example', {
         title: 'My menu item',
         context: 'tools',
         onclick: function() {
            ed.insertContent('Hello world!!');
         }
      });
   }
});


来源:https://stackoverflow.com/questions/18250656/is-it-possible-to-have-custom-functions-and-commands-in-the-tinymce4-menubar

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!