Reputation: 175
I want to prevent the FF default action via CKEDITOR customized shortcuts.
I've tried following code
CKEDITOR.plugins.add('pluginName', {
init: function(b) {
b.addCommand('cmdName', { /*shortcut CTRL + SHIFT + C*/
exec: function(b) {
// functionality
b.window.$.event.stopPropagation();
}
});
}
});
In chrome b.window.$.event gives "keybordEvent". In FF b.window.$.event is undefined.
How can i get the current event in FF
Upvotes: 0
Views: 100
Reputation: 15895
See this JSFiddle. Also take a look on CKEDITOR.commandDefinition#exec
and CKEDITOR.editor#setKeystroke
. Use CTRL(CMD)+SHIFT+C to test the behaviour.
CKEDITOR.replace( 'editor', {
plugins: 'toolbar,wysiwygarea,basicstyles',
on: {
pluginsLoaded: function() {
this.addCommand( 'customCommand', {
exec: function( editor ) {
console.log( 'Executing', this.name );
// Uncomment this to allow default keystroke action.
// return false;
}
} );
this.setKeystroke(
CKEDITOR.CTRL + CKEDITOR.SHIFT + 67,
'customCommand'
);
}
}
} );
I hope it explains the problem. As long as exec
returns anything but false
, a default keystroke (quite likely a devtools panel, i.e. Firebug) will not be executed.
Upvotes: 0