【问题标题】:Is it possible to have custom Functions and commands in the TinyMCE4 Menubar?TinyMCE 菜单栏中是否可以有自定义功能和命令?
【发布时间】:2013-08-15 10:18:00
【问题描述】:

我已经学会了如何将 Tiny Toolbar 中的自定义命令与 ed.addButton() 函数。

是否有类似的方法可以将功能添加到上层菜单,即菜单栏?

在 Tiny Documentation 中,我刚刚找到了如何在 init 函数中使用以下代码更改菜单部分的顺序:

menubar: "tools table format view insert edit",

【问题讨论】:

标签: tinymce-4


【解决方案1】:

例子:

// 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!!');
         }
      });
   }
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-26
    • 2018-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多