【问题标题】:How do I set the position of the addButton?如何设置 addButton 的位置?
【发布时间】:2020-05-26 05:32:08
【问题描述】:

默认添加的按钮始终位于工具栏的末尾。 如何设置 addButton 的位置? 而不是在工具栏的末尾。

【问题讨论】:

    标签: tinymce tinymce-5


    【解决方案1】:

    您可以使用 toolbar 配置选项在 TinyMCE 中指定按钮排序。

    例如,以下配置将在粗体按钮之前添加自定义按钮:

    tinymce.init({
      selector: '#editor',
      toolbar: 'myCustomToolbarButton bold',
      setup: (editor) => {
        editor.ui.registry.addButton('myCustomToolbarButton', {
          text: 'My Custom Button',
          onAction: () => alert('Button clicked!')
        });
      }
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-18
      • 2016-01-01
      • 2015-04-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多