X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fcontextmenu%2Fplugin.js;h=8d7cb8d59e3b69136a029253d28865736dadf84f;hp=b009dee02344480c88f80fdbbb243358aa9f716b;hb=039a051ccf3901311661022a30afd60fc38130c9;hpb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7 diff --git a/_source/plugins/contextmenu/plugin.js b/_source/plugins/contextmenu/plugin.js index b009dee..8d7cb8d 100644 --- a/_source/plugins/contextmenu/plugin.js +++ b/_source/plugins/contextmenu/plugin.js @@ -25,7 +25,7 @@ CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( { $ : function( editor ) { - this.id = 'cke_' + CKEDITOR.tools.getNextNumber(); + this.id = CKEDITOR.tools.getNextId(); this.editor = editor; this._.listeners = []; this._.functionId = CKEDITOR.tools.addFunction( function( commandName ) @@ -147,13 +147,14 @@ CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( { addTarget : function( element, nativeContextMenuOnCtrl ) { - // Opera doesn't support 'contextmenu' event, we have duo approaches employed here: - // 1. Inherit the 'button override' hack we introduced in v2 (#4530), while this require the Opera browser - // option 'Allow script to detect context menu/right click events' to be always turned on. + + // For browsers (Opera <=10a) that doesn't support 'contextmenu' event, we have duo approaches employed here: + // 1. Inherit the 'button override' hack we introduced in v2 (#4530) (In Opera browser, this require the + // option 'Allow script to detect context menu/right click events' to be always turned on). // 2. Considering the fact that ctrl/meta key is not been occupied // for multiple range selecting (like Gecko), we use this key // combination as a fallback for triggering context-menu. (#4530) - if ( CKEDITOR.env.opera ) + if ( CKEDITOR.env.opera && !( 'oncontextmenu' in document.body ) ) { var contextMenuOverrideButton; element.on( 'mousedown', function( evt ) @@ -224,6 +225,19 @@ CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( }, this ); + if ( CKEDITOR.env.opera ) + { + // 'contextmenu' event triggered by Windows menu key is unpreventable, + // cancel the key event itself. (#6534) + element.on( 'keypress' , function ( evt ) + { + var domEvent = evt.data; + + if ( domEvent.$.keyCode === 0 ) + domEvent.preventDefault(); + }); + } + if ( CKEDITOR.env.webkit ) { var holdCtrlKey,