function ilTinyMceInitCallback(ed) { // Add hook for onContextMenu so that Insert Image can be removed if (ed.plugins.contextmenu) ed.plugins.contextmenu.onContextMenu.add(function(sender, menu) { // create a new object var otherItems = {}; var lastItem = null; 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 var lastItem = item; continue; } else if (lastItem && item.settings.separator && (lastItem.settings.cmd == "mceImage" || lastItem.settings.cmd == "mceAdvImage")) { lastItem = null; 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; }); } tinyMCE.init({ mode : "textareas", editor_selector : "{SELECTOR}", theme : "advanced", language : "{LANG}", plugins : "safari,save", fix_list_elements : true, theme_advanced_blockformats : "{BLOCKFORMATS}", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_path_location : "bottom", theme_advanced_buttons1 : "save,{BUTTONS}", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", valid_elements : "{VALID_ELEMENTS}", entities : "60,lt,62,gt,38,amp", content_css : "{STYLESHEET_LOCATION}", plugin_insertdate_dateFormat : "%d.%m.%Y", plugin_insertdate_timeFormat : "%H:%M:%S", save_onsavecallback : "saveTextarea", handle_event_callback : "charCounter", theme_advanced_resize_horizontal : true, theme_advanced_resizing : true, theme_advanced_fonts : "Arial=sans-serif;Courier=monospace;Times Roman=serif", font_size_style_values : "8pt,10pt,12pt,14pt,18pt,24pt,36pt", setup: function (ed) { ed.onInit.add(ilTinyMceInitCallback); } });