JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.3
[ckeditor.git] / _source / plugins / menubutton / plugin.js
index 4797a4e..1bb6599 100644 (file)
@@ -1,11 +1,11 @@
 /*\r
-Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
 CKEDITOR.plugins.add( 'menubutton',\r
 {\r
-       requires : [ 'button', 'contextmenu' ],\r
+       requires : [ 'button', 'menu' ],\r
        beforeInit : function( editor )\r
        {\r
                editor.ui.addHandler( CKEDITOR.UI_MENUBUTTON, CKEDITOR.ui.menuButton.handler );\r
@@ -17,7 +17,7 @@ CKEDITOR.plugins.add( 'menubutton',
  * @constant\r
  * @example\r
  */\r
-CKEDITOR.UI_MENUBUTTON = 5;\r
+CKEDITOR.UI_MENUBUTTON = 'menubutton';\r
 \r
 (function()\r
 {\r
@@ -35,19 +35,24 @@ CKEDITOR.UI_MENUBUTTON = 5;
                var menu = _.menu;\r
                if ( !menu )\r
                {\r
-                       menu = _.menu = new CKEDITOR.plugins.contextMenu( editor );\r
+                       menu = _.menu = new CKEDITOR.menu( editor,\r
+                       {\r
+                               panel:\r
+                               {\r
+                                       className : editor.skinClass + ' cke_contextmenu',\r
+                                       attributes : { 'aria-label' : editor.lang.common.options }\r
+                               }\r
+                       });\r
 \r
                        menu.onHide = CKEDITOR.tools.bind( function()\r
                                {\r
-                                       this.setState( _.previousState );\r
+                                       this.setState( this.modes && this.modes[ editor.mode ] ? _.previousState : CKEDITOR.TRISTATE_DISABLED );\r
                                },\r
                                this );\r
 \r
                        // Initialize the menu items at this point.\r
                        if ( this.onMenu )\r
-                       {\r
                                menu.addListener( this.onMenu );\r
-                       }\r
                }\r
 \r
                if ( _.on )\r