如何设置 addButton 的位置?
How do I set the position of the addButton?
默认添加的按钮始终位于工具栏的末尾。
如何设置 addButton 的位置?
而不是在工具栏的末尾。
您可以在 TinyMCE 中使用 toolbar
配置选项指定按钮顺序。
例如,以下配置将在粗体按钮之前添加自定义按钮:
tinymce.init({
selector: '#editor',
toolbar: 'myCustomToolbarButton bold',
setup: (editor) => {
editor.ui.registry.addButton('myCustomToolbarButton', {
text: 'My Custom Button',
onAction: () => alert('Button clicked!')
});
}
});
默认添加的按钮始终位于工具栏的末尾。 如何设置 addButton 的位置? 而不是在工具栏的末尾。
您可以在 TinyMCE 中使用 toolbar
配置选项指定按钮顺序。
例如,以下配置将在粗体按钮之前添加自定义按钮:
tinymce.init({
selector: '#editor',
toolbar: 'myCustomToolbarButton bold',
setup: (editor) => {
editor.ui.registry.addButton('myCustomToolbarButton', {
text: 'My Custom Button',
onAction: () => alert('Button clicked!')
});
}
});