最佳答案
你可以这样做:
原文链接:https://www.f2er.com/jquery/428208.htmltinyMCE.init({
setup: function (ed) {
ed.onInit.add(editor_oninit);
}
...
});
function editor_oninit(ed) {
// Add hook for onContextMenu so that Insert Image can be removed
ed.plugins.contextmenu.onContextMenu.add(editor_remove_image);
}
而且功能
function editor_remove_image(sender,menu) {
// create a new object
var otherItems = {};
for (var itemName in menu.items) {
var item = menu.items[itemName];
if (/^mce_/.test(itemName)) {
if (item.settings) {
if (item.settings.cmd == "mceImage" || item.settings.cmd == "mceAdvImage") {
// skip these items
continue;
}
}
}
// add all other items to this new object,so it is effectively a clone
// of menu.items but without the offending entries
otherItems[itemName] = item;
}
// replace menu.items with our new object
menu.items = otherItems;
}