Remove the Context Menu in TinyMCE

2020-02-13 08:18发布

TinyMCE has a built-in contextmenu which activates when you right-click in the content editor area. I need to remove this menu due to the copy/cut/paste in the menu. It for an application specific reason and less of a technical reason.

enter image description here

I have attempted to remove the contextmenu plugin as well as attempt to catch the contextmenu event and trap it without luck.

4条回答
Luminary・发光体
2楼-- · 2020-02-13 08:41

The easy solution is to remove the contextmenu plugin in your tinymce init:

 plugins : "inlinepopups,insertdatetime,fullscreen,contextmenu",

becomes

 plugins : "inlinepopups,insertdatetime,fullscreen",
查看更多
Summer. ? 凉城
3楼-- · 2020-02-13 08:46

Commenting this line in /plugins/contextmenu/editor_plugin.js worked for me:

f.addSeparator();f.add({title:"advanced.image_desc",icon:"image",cmd:h.plugins.advimage?"mceAdvImage":"mceImage",ui:true});

If for any reason you use the non-minified js, comment this:

m.addSeparator();
m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
查看更多
▲ chillily
4楼-- · 2020-02-13 08:47

In version 5, context menu is built in the core. This has helped me:

tinymce.init({
    ...
    contextmenu: false,
    ...
});
查看更多
够拽才男人
5楼-- · 2020-02-13 08:54

Try to remove the complete script in plugins/contextmenu/editor.plugin.js (It's only 1 line so it's sufficient to put 2 slashes at the start).

It works for me, the contextmenu no longer appears.

查看更多
登录 后发表回答