X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fcontextmenu%2Fplugin.js;h=3f25a9461cb4bc2f143d1c0e7c9c96ad1bb732af;hp=6cbc3e764cabf03df978ea092bbb5df744d75ea5;hb=941b0a9ba4e673e292510d80a5a86806994b8ea6;hpb=7cd80714081a8ffdf4a1a8d2c72f120ed5ef3d6d diff --git a/_source/plugins/contextmenu/plugin.js b/_source/plugins/contextmenu/plugin.js index 6cbc3e7..3f25a94 100644 --- a/_source/plugins/contextmenu/plugin.js +++ b/_source/plugins/contextmenu/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -83,17 +83,15 @@ CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( var selection = this.editor.getSelection(), element = selection && selection.getStartElement(); - // Lock the selection in IE, so it can be restored when closing the - // menu. - if ( CKEDITOR.env.ie ) - selection.lock(); - menu.onHide = CKEDITOR.tools.bind( function() { menu.onHide = null; if ( CKEDITOR.env.ie ) - editor.getSelection().unlock(); + { + var selection = editor.getSelection(); + selection && selection.unlock(); + } this.onHide && this.onHide(); }, @@ -189,6 +187,14 @@ CKEDITOR.plugins.contextMenu = CKEDITOR.tools.createClass( ( CKEDITOR.env.webkit ? holdCtrlKey : domEvent.$.ctrlKey || domEvent.$.metaKey ) ) 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();