aboutsummaryrefslogtreecommitdiff
path: root/sources/plugins/contextmenu/plugin.js
diff options
context:
space:
mode:
Diffstat (limited to 'sources/plugins/contextmenu/plugin.js')
-rw-r--r--sources/plugins/contextmenu/plugin.js27
1 files changed, 21 insertions, 6 deletions
diff --git a/sources/plugins/contextmenu/plugin.js b/sources/plugins/contextmenu/plugin.js
index 6cd3935..4a3bd5f 100644
--- a/sources/plugins/contextmenu/plugin.js
+++ b/sources/plugins/contextmenu/plugin.js
@@ -7,10 +7,10 @@ CKEDITOR.plugins.add( 'contextmenu', {
7 requires: 'menu', 7 requires: 'menu',
8 8
9 // jscs:disable maximumLineLength 9 // jscs:disable maximumLineLength
10 lang: 'af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE% 10 lang: 'af,ar,az,bg,bn,bs,ca,cs,cy,da,de,de-ch,el,en,en-au,en-ca,en-gb,eo,es,es-mx,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,oc,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE%
11 // jscs:enable maximumLineLength 11 // jscs:enable maximumLineLength
12 12
13 // Make sure the base class (CKEDITOR.menu) is loaded before it (#3318). 13 // Make sure the base class (CKEDITOR.menu) is loaded before it (http://dev.ckeditor.com/ticket/3318).
14 onLoad: function() { 14 onLoad: function() {
15 /** 15 /**
16 * Class replacing the non-configurable native context menu with a configurable CKEditor's equivalent. 16 * Class replacing the non-configurable native context menu with a configurable CKEditor's equivalent.
@@ -51,7 +51,7 @@ CKEDITOR.plugins.add( 'contextmenu', {
51 var domEvent = event.data, 51 var domEvent = event.data,
52 isCtrlKeyDown = 52 isCtrlKeyDown =
53 // Safari on Windows always show 'ctrlKey' as true in 'contextmenu' event, 53 // Safari on Windows always show 'ctrlKey' as true in 'contextmenu' event,
54 // which make this property unreliable. (#4826) 54 // which make this property unreliable. (http://dev.ckeditor.com/ticket/4826)
55 ( CKEDITOR.env.webkit ? holdCtrlKey : ( CKEDITOR.env.mac ? domEvent.$.metaKey : domEvent.$.ctrlKey ) ); 55 ( CKEDITOR.env.webkit ? holdCtrlKey : ( CKEDITOR.env.mac ? domEvent.$.metaKey : domEvent.$.ctrlKey ) );
56 56
57 if ( nativeContextMenuOnCtrl && isCtrlKeyDown ) 57 if ( nativeContextMenuOnCtrl && isCtrlKeyDown )
@@ -60,7 +60,7 @@ CKEDITOR.plugins.add( 'contextmenu', {
60 // Cancel the browser context menu. 60 // Cancel the browser context menu.
61 domEvent.preventDefault(); 61 domEvent.preventDefault();
62 62
63 // Fix selection when non-editable element in Webkit/Blink (Mac) (#11306). 63 // Fix selection when non-editable element in Webkit/Blink (Mac) (http://dev.ckeditor.com/ticket/11306).
64 if ( CKEDITOR.env.mac && CKEDITOR.env.webkit ) { 64 if ( CKEDITOR.env.mac && CKEDITOR.env.webkit ) {
65 var editor = this.editor, 65 var editor = this.editor,
66 contentEditableParent = new CKEDITOR.dom.elementPath( domEvent.getTarget(), editor.editable() ).contains( function( el ) { 66 contentEditableParent = new CKEDITOR.dom.elementPath( domEvent.getTarget(), editor.editable() ).contains( function( el ) {
@@ -83,7 +83,7 @@ CKEDITOR.plugins.add( 'contextmenu', {
83 CKEDITOR.tools.setTimeout( function() { 83 CKEDITOR.tools.setTimeout( function() {
84 this.open( offsetParent, null, offsetX, offsetY ); 84 this.open( offsetParent, null, offsetX, offsetY );
85 85
86 // IE needs a short while to allow selection change before opening menu. (#7908) 86 // IE needs a short while to allow selection change before opening menu. (http://dev.ckeditor.com/ticket/7908)
87 }, CKEDITOR.env.ie ? 200 : 0, this ); 87 }, CKEDITOR.env.ie ? 200 : 0, this );
88 }, this ); 88 }, this );
89 89
@@ -111,10 +111,14 @@ CKEDITOR.plugins.add( 'contextmenu', {
111 * @param {Number} [offsetY] 111 * @param {Number} [offsetY]
112 */ 112 */
113 open: function( offsetParent, corner, offsetX, offsetY ) { 113 open: function( offsetParent, corner, offsetX, offsetY ) {
114 if ( this.editor.config.enableContextMenu === false ) {
115 return;
116 }
117
114 this.editor.focus(); 118 this.editor.focus();
115 offsetParent = offsetParent || CKEDITOR.document.getDocumentElement(); 119 offsetParent = offsetParent || CKEDITOR.document.getDocumentElement();
116 120
117 // #9362: Force selection check to update commands' states in the new context. 121 // http://dev.ckeditor.com/ticket/9362: Force selection check to update commands' states in the new context.
118 this.editor.selectionChange( 1 ); 122 this.editor.selectionChange( 1 );
119 123
120 this.show( offsetParent, corner, offsetX, offsetY ); 124 this.show( offsetParent, corner, offsetX, offsetY );
@@ -157,3 +161,14 @@ CKEDITOR.plugins.add( 'contextmenu', {
157 * @cfg {Boolean} [browserContextMenuOnCtrl=true] 161 * @cfg {Boolean} [browserContextMenuOnCtrl=true]
158 * @member CKEDITOR.config 162 * @member CKEDITOR.config
159 */ 163 */
164
165/**
166 * Whether to enable the context menu. Regardless of the setting the [Context Menu](http://ckeditor.com/addon/contextmenu)
167 * plugin is still loaded.
168 *
169 * config.enableContextMenu = false;
170 *
171 * @since 4.7.0
172 * @cfg {Boolean} [enableContextMenu=true]
173 * @member CKEDITOR.config
174 */