I'm working with CKEDITOR 4.5.1 and would like to disable the image properties dialog from appearing when an image is double-clicked within the editor.
After searching I came across what looked to be the solution, which is the following:
CKEDITOR.instances.pageContent.on( 'doubleclick', function( evt ) {
var element = evt.data.element;
if ( element.is( 'img' ) && !element.data( 'cke-realelement' ) && !element.isReadOnly() ){
evt.data.dialog = null;
}
}, null, null, 10000) ;//priority has to be higher than image priority.
The code does trigger and does set dialog to null, however, the default image properties dialog still appears. My assumption is the listener within CKEDITOR is running after the above code executes and sets the dialog. I've tried different values in place of 10000 with no success.
this config worked for me
CKEDITOR.config.removePlugins = 'image,forms';
I have version 4.5.4
If you want to programmatically disable the image popup on some condition you must set the event priority to 998 (and e.data.dialog = null
).
The dialog plugin runs with priority 999 (https://github.com/ckeditor/ckeditor-dev/blob/major/plugins/dialog/plugin.js#L3355) so anything after that will have no effect and anything below 998 might run before e.data.dialog
being set.
editor.on(
'doubleclick',
function(e) {
var element = e && e.data && e.data.element;
if (element && element.is('img') && element.getAttribute('class').indexOf('something') >= 0) {
e.data.dialog = null;
}
},
null,
null,
998 // Needs to be below 999 because thats when the dialog plugin will run (https://github.com/ckeditor/ckeditor-dev/blob/major/plugins/dialog/plugin.js#L3355)
);
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