JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.6
[ckeditor.git] / _source / plugins / menu / plugin.js
index 265604c..6e6b98e 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -175,14 +175,17 @@ CKEDITOR.plugins.add( 'menu',
 \r
                        onHide : function()\r
                        {\r
+                               this._.unlockSelection();\r
+                               this.onHide && this.onHide();\r
+                       },\r
+\r
+                       unlockSelection : function() {\r
                                // Unlock the selection upon first panel closing.\r
                                if ( CKEDITOR.env.ie && !this.parent )\r
                                {\r
                                        var selection = this.editor.getSelection();\r
                                        selection && selection.unlock( true );\r
                                }\r
-\r
-                               this.onHide && this.onHide();\r
                        },\r
 \r
                        showSubMenu : function( index )\r
@@ -259,8 +262,10 @@ CKEDITOR.plugins.add( 'menu',
                                {\r
                                        this._.onShow();\r
                                        // Don't menu with zero items.\r
-                                       if ( ! this.items.length )\r
+                                       if ( ! this.items.length ) {\r
+                                               this._.unlockSelection();\r
                                                return;\r
+                                       }\r
                                }\r
 \r
                                corner = corner || ( this.editor.lang.dir == 'rtl' ? 2 : 1 );\r