I want to add a context menu item only for selected image elements. The context menu item currently works, but it appears on every item, not just image elements. Here is my code:
CKEDITOR.on('instanceReady', function(ev) { editor.addCommand('editImgCmd', { exec : function( editor ) { alert('editImgCmd'); } }); var editImgCmd = { label : editor.lang.image.menu, command : 'editImgCmd', group : 'image' }; editor.contextMenu.addListener(function(element, selection ) { return { editImgCmd : CKEDITOR.TRISTATE_ON }; }); editor.addMenuItems({ editImgCmd : { label : 'Edit Image', command : 'editImgCmd', group : 'image', order : 2 } }); });
javascript ckeditor contextmenu
Mike voorhees
source share