I want to remove the image property option from the right click menu in tinymce. I'm using tinymce 3.x version please help me.
you could do something like:
tinyMCE.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);
}
And the function
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With