X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fcontextmenu%2Fplugin.js;h=b009dee02344480c88f80fdbbb243358aa9f716b;hb=refs%2Ftags%2Fv3.2.2;hp=60aad928cf05778addbcd3ac0ff3d8a08afef36e;hpb=059b4c2fef02528bf1af189f7996e80652faddfb;p=ckeditor.git diff --git a/_source/plugins/contextmenu/plugin.js b/_source/plugins/contextmenu/plugin.js index 60aad92..b009dee 100644 --- a/_source/plugins/contextmenu/plugin.js +++ b/_source/plugins/contextmenu/plugin.js @@ -36,14 +36,14 @@ CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( }, this); - this._.definiton = + this.definition = { panel: { className : editor.skinClass + ' cke_contextmenu', attributes : { - 'aria-label' : editor.lang.common.options + 'aria-label' : editor.lang.contextmenu.options } } }; @@ -63,7 +63,7 @@ CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( } else { - menu = this._.menu = new CKEDITOR.menu( editor, this._.definiton ); + menu = this._.menu = new CKEDITOR.menu( editor, this.definition ); menu.onClick = CKEDITOR.tools.bind( function( item ) { menu.hide(); @@ -167,7 +167,7 @@ CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( } if ( nativeContextMenuOnCtrl - && ( evt.$.ctrlKey || evt.$.metaKey ) ) + && ( CKEDITOR.env.mac ? evt.$.metaKey : evt.$.ctrlKey ) ) return; var target = evt.getTarget(); @@ -205,16 +205,9 @@ CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( if ( nativeContextMenuOnCtrl && // Safari on Windows always show 'ctrlKey' as true in 'contextmenu' event, // which make this property unreliable. (#4826) - ( CKEDITOR.env.webkit ? holdCtrlKey : domEvent.$.ctrlKey || domEvent.$.metaKey ) ) + ( CKEDITOR.env.webkit ? holdCtrlKey : ( CKEDITOR.env.mac ? domEvent.$.metaKey : domEvent.$.ctrlKey ) ) ) return; - // Selection will be unavailable after context menu shows up - // in IE, lock it now. - if ( CKEDITOR.env.ie ) - { - var selection = this.editor.getSelection(); - selection && selection.lock(); - } // Cancel the browser context menu. domEvent.preventDefault(); @@ -236,7 +229,7 @@ CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( var holdCtrlKey, onKeyDown = function( event ) { - holdCtrlKey = event.data.$.ctrlKey || event.data.$.metaKey; + holdCtrlKey = CKEDITOR.env.mac ? event.data.$.metaKey : event.data.$.ctrlKey ; }, resetOnKeyUp = function() { @@ -257,6 +250,15 @@ CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( show : function( offsetParent, corner, offsetX, offsetY ) { this.editor.focus(); + + // Selection will be unavailable after context menu shows up + // in IE, lock it now. + if ( CKEDITOR.env.ie ) + { + var selection = this.editor.getSelection(); + selection && selection.lock(); + } + this._.onMenu( offsetParent || CKEDITOR.document.getDocumentElement(), corner, offsetX || 0, offsetY || 0 ); } }