Reputation: 3757
Does anybody know how to disable CKEditor's context (right click) menu? I would expect a configuration option, but I can't find one. I am using v3.1. Thanks.
Upvotes: 21
Views: 25519
Reputation: 386
Hold down the ctrl button while right clicking to by-pass the context menu and access spell checker etc.
Upvotes: 2
Reputation: 5856
Ckeditor 4.7.1
CKEDITOR.editorConfig = function (config) {
config.language = 'en';
config.toolbar = "mini";
config.removePlugins = 'elementspath,contextmenu,liststyle,tabletools,tableselection';
config.disableNativeSpellChecker = false;
}
Ckeditor 4.8.0
('elementspath' plugin no longer need to remove)
CKEDITOR.editorConfig = function (config) {
config.language = 'en';
config.toolbar = "mini";
config.removePlugins = 'contextmenu,liststyle,tabletools,tableselection';
config.disableNativeSpellChecker = false;
}
Upvotes: 9
Reputation: 32058
You can find out which plugins require contextmenu
in your particular build of CKEditor using the following snippet in an F12 console window in your site (assumes you have jQuery also for $.each
):
$.each(CKEDITOR.plugins, function(k, v){
v.requires && console.log("Plugin '" + k + "' requires: " + v.requires)
})
For example:
Plugin 'tabletools' requires table,dialog,contextmenu
Which you can then use to help you with your config.removePlugins
- in my case:
config.removePlugins = 'tabletools,contextmenu'
Upvotes: 3
Reputation: 5965
There is still a practical solution, by overriding the prototype function that initializes contextmenu
behavior:
CKEDITOR.dom.element.prototype.disableContextMenu = function () {
this.on( 'contextmenu', function( event ) {
// your contextmenu behavior
});
};
NOTE: when CKEDITOR loads its JS resources dynamically you need to place it right before the replace
call.
Upvotes: 3
Reputation: 20360
I needed to disable all of the following to get this to work.
config.removePlugins = 'language,tableresize,liststyle,tabletools,scayt,menubutton,contextmenu';
Previously we did not need language or tableresize - but a newer version of ckeditor seems to require that.
I discovered this in looking at the output in F12 dev tools on chrome.
Upvotes: 2
Reputation: 430
It's possible to completely disable the context menu adding this line to your config file (tipically fckconfig.js):
FCKConfig.ContextMenu = [];
Upvotes: 0
Reputation: 938
In CKEditor 4.x, (I tested 4.2.2) you must do both:
CKEDITOR.replace('my_editor', {
removePlugins : 'contextmenu'
});
And
CKEDITOR.editorConfig = function(config) {
/* Your config options */
...
config.removePlugins = ''liststyle,tabletools,contextmenu'';
};
All three of those will automatically require contextmenu if you don't disable them.
Upvotes: 0
Reputation: 189
For version 4.2, I put the following at the end of my config.js file
CKEDITOR.on('instanceReady', function(ev) {
ev.editor.editable().addClass('cke_enable_context_menu')
});
Upvotes: 1
Reputation: 15186
Unfortunately since CKEditor 3.6/4.0 this does not work anymore.
See bug report: http://dev.ckeditor.com/ticket/9284
Upvotes: 0
Reputation: 47776
As of version 3.6.4, the other answers in this question don't work anymore. See bug #9284
The three plugins that need to be disabled (using the means discussed in this question), are contextmenu
, liststyle
and tabletools
. So for example, using config files:
CKEDITOR.editorConfig = function(config) {
/* Your config options */
...
config.removePlugins = 'contextmenu,liststyle,tabletools';
};
Upvotes: 37
Reputation: 2591
With CKEditor 3.6 I was able to disable context menu by removing the contextmenu plugin as suggested above. To do this, you have to configure the editor with the removePlugins option. For instance:
CKEDITOR.replace('my_editor', {
removePlugins : 'contextmenu'
});
It can also be disabled globally from the config.js file:
CKEDITOR.editorConfig = function(config) {
/* Your config options */
...
config.removePlugins = 'contextmenu';
};
Upvotes: 0