如何设置添加按钮的位置?



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

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

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

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

最新更新