我想从自定义工具栏按钮手动显示模板插件弹出窗口,但如果我执行命令“mceInsertTemplate”,它似乎不起作用。
它在执行一些默认命令(如“Bold”或类似命令时)有效。
tinymce.init({
selector: '.tinymce',
language: 'de',
statusbar: false,
plugins: "table lists autoresize template",
menubar: "",
toolbar: "bold italic underline | alignleft aligncenter alignright alignjustify | bullist numlist | table | removeformat undo redo | template | myCustomToolbarButton | ",
templates: [
{title: 'Some title 1', description: 'Some desc 1', content: 'My content'},
{title: 'Some title 2', description: 'Some desc 2', url: 'development.html'}
],
setup: (editor) => {
editor.ui.registry.addButton('myCustomToolbarButton', {
text: 'My Custom Button',
onAction: function (_) {
editor.execCommand('mceInsertTemplate');
}
})
}
});
也许有人可以指出我正确的方向。
在此先感谢,丹尼尔