TinyMCE4 菜单栏中是否可以有自定义功能和命令?

编程入门 行业动态 更新时间:2024-10-26 15:22:51
本文介绍了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:关键词]

本文发布于:2023-04-30 09:26:38,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1392019.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:自定义   栏中   菜单   命令   功能

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!