Reputation: 14366
Is there a way to programmatically disable the right click of the mouse on a particular element inside the editor?
I need this to use this functionality to disable the resizing of one particular table element inside the editor, which is managed by the tabletools plug-in.
Upvotes: 3
Views: 1747
Reputation: 22013
The most correct solution would be to disable proper command when such table is selected, but I see that unfortunately it doesn't disable menu item for that command, but only prevents executing that command. So less cool solution has to be used:
editor.on( 'contentDom', function() {
editor.editable().attachListener( editor.editable(), 'contextmenu', function( evt ) {
console.log( evt.data.getTarget() );
evt.stop();
evt.data.preventDefault();
}, null, null, 0 );
} );
This will disable context menu completely. You can add proper condition based on evt.data.getTarget()
.
Upvotes: 7
Reputation: 15636
You can disable right-click on particular elements using jQuery as:
$('img').bind('contextmenu', function(e) {
return false;
});
Refer this question for more details.
Upvotes: -1