本文介绍了TinyMCE4 菜单栏中是否可以有自定义功能和命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
限时送ChatGPT账号..我已经学会了如何将 Tiny Toolbar 中的自定义命令与ed.addButton() 函数.
I have learned how to integrate custom commands in the Tiny Toolbar with the ed.addButton() Function.
是否有类似的方法可以为上层菜单(菜单栏)添加功能?
Is there a similar way to add functionality to the Upper menu, the menubar ?
在 Tiny Documentation 中,我刚刚找到了如何在 init 函数中使用此代码更改菜单部分的顺序:
In the Tiny Documentation I just found how to change the order of the menu secton with this code in the init function:
menubar:工具表格格式视图插入编辑",
menubar: "tools table format view insert edit",
推荐答案
示例:
// 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!!');
}
});
}
});
这篇关于TinyMCE4 菜单栏中是否可以有自定义功能和命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论