JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.6.1
[ckeditor.git] / _source / plugins / menu / plugin.js
index 7921fee..0165d31 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -8,61 +8,182 @@ CKEDITOR.plugins.add( 'menu',
        beforeInit : function( editor )\r
        {\r
                var groups = editor.config.menu_groups.split( ',' ),\r
-                       groupsOrder = {};\r
+                       groupsOrder = editor._.menuGroups = {},\r
+                       menuItems = editor._.menuItems = {};\r
 \r
                for ( var i = 0 ; i < groups.length ; i++ )\r
                        groupsOrder[ groups[ i ] ] = i + 1;\r
 \r
-               editor._.menuGroups = groupsOrder;\r
-               editor._.menuItems = {};\r
+               /**\r
+                * Registers an item group to the editor context menu in order to make it\r
+                * possible to associate it with menu items later.\r
+                * @name CKEDITOR.editor.prototype.addMenuGroup\r
+                * @param {String} name Specify a group name.\r
+                * @param {Number} [order=100] Define the display sequence of this group\r
+                *      inside the menu. A smaller value gets displayed first.\r
+                */\r
+               editor.addMenuGroup = function( name, order )\r
+                       {\r
+                               groupsOrder[ name ] = order || 100;\r
+                       };\r
+\r
+               /**\r
+                * Adds an item from the specified definition to the editor context menu.\r
+                * @name CKEDITOR.editor.prototype.addMenuItem\r
+                * @param {String} name The menu item name.\r
+                * @param {CKEDITOR.menu.definition} definition The menu item definition.\r
+                */\r
+               editor.addMenuItem = function( name, definition )\r
+                       {\r
+                               if ( groupsOrder[ definition.group ] )\r
+                                       menuItems[ name ] = new CKEDITOR.menuItem( this, name, definition );\r
+                       };\r
+\r
+               /**\r
+                * Adds one or more items from the specified definition array to the editor context menu.\r
+                * @name CKEDITOR.editor.prototype.addMenuItems\r
+                * @param {Array} definitions List of definitions for each menu item as if {@link CKEDITOR.editor.addMenuItem} is called.\r
+                */\r
+               editor.addMenuItems = function( definitions )\r
+                       {\r
+                               for ( var itemName in definitions )\r
+                               {\r
+                                       this.addMenuItem( itemName, definitions[ itemName ] );\r
+                               }\r
+                       };\r
+\r
+               /**\r
+                * Retrieves a particular menu item definition from the editor context menu.\r
+                * @name CKEDITOR.editor.prototype.getMenuItem\r
+                * @param {String} name The name of the desired menu item.\r
+                * @return {CKEDITOR.menu.definition}\r
+                */\r
+               editor.getMenuItem = function( name )\r
+                       {\r
+                               return menuItems[ name ];\r
+                       };\r
+\r
+               /**\r
+                * Removes a particular menu item added before from the editor context menu.\r
+                * @name CKEDITOR.editor.prototype.removeMenuItem\r
+                * @param {String} name The name of the desired menu item.\r
+                * @since 3.6.1\r
+                */\r
+               editor.removeMenuItem = function( name )\r
+                       {\r
+                               delete menuItems[ name ];\r
+                       };\r
        },\r
 \r
        requires : [ 'floatpanel' ]\r
 });\r
 \r
-CKEDITOR.tools.extend( CKEDITOR.editor.prototype,\r
-{\r
-       addMenuGroup : function( name, order )\r
-       {\r
-               this._.menuGroups[ name ] = order || 100;\r
-       },\r
-\r
-       addMenuItem : function( name, definition )\r
-       {\r
-               if ( this._.menuGroups[ definition.group ] )\r
-                       this._.menuItems[ name ] = new CKEDITOR.menuItem( this, name, definition );\r
-       },\r
-\r
-       addMenuItems : function( definitions )\r
-       {\r
-               for ( var itemName in definitions )\r
-               {\r
-                       this.addMenuItem( itemName, definitions[ itemName ] );\r
-               }\r
-       },\r
-\r
-       getMenuItem : function( name )\r
-       {\r
-               return this._.menuItems[ name ];\r
-       }\r
-});\r
-\r
 (function()\r
 {\r
        CKEDITOR.menu = CKEDITOR.tools.createClass(\r
        {\r
-               $ : function( editor, level )\r
+               $ : function( editor, definition )\r
                {\r
-                       this.id = 'cke_' + CKEDITOR.tools.getNextNumber();\r
+                       definition = this._.definition = definition || {};\r
+                       this.id = CKEDITOR.tools.getNextId();\r
 \r
                        this.editor = editor;\r
                        this.items = [];\r
+                       this._.listeners = [];\r
 \r
-                       this._.level = level || 1;\r
+                       this._.level = definition.level || 1;\r
+\r
+                       var panelDefinition = CKEDITOR.tools.extend( {}, definition.panel,\r
+                       {\r
+                               css : editor.skin.editor.css,\r
+                               level : this._.level - 1,\r
+                               block : {}\r
+                       } );\r
+\r
+                       var attrs = panelDefinition.block.attributes = ( panelDefinition.attributes || {} );\r
+                       // Provide default role of 'menu'.\r
+                       !attrs.role && ( attrs.role = 'menu' );\r
+                       this._.panelDefinition = panelDefinition;\r
                },\r
 \r
                _ :\r
                {\r
+                       onShow : function()\r
+                       {\r
+                               var selection = this.editor.getSelection();\r
+\r
+                               // Selection will be unavailable after menu shows up\r
+                               // in IE, lock it now.\r
+                               if ( CKEDITOR.env.ie )\r
+                                       selection && selection.lock();\r
+\r
+                               var element = selection && selection.getStartElement(),\r
+                                       listeners = this._.listeners,\r
+                                       includedItems = [];\r
+\r
+                               this.removeAll();\r
+                               // Call all listeners, filling the list of items to be displayed.\r
+                               for ( var i = 0 ; i < listeners.length ; i++ )\r
+                               {\r
+                                       var listenerItems = listeners[ i ]( element, selection );\r
+\r
+                                       if ( listenerItems )\r
+                                       {\r
+                                               for ( var itemName in listenerItems )\r
+                                               {\r
+                                                       var item = this.editor.getMenuItem( itemName );\r
+\r
+                                                       if ( item && ( !item.command || this.editor.getCommand( item.command ).state ) )\r
+                                                       {\r
+                                                               item.state = listenerItems[ itemName ];\r
+                                                               this.add( item );\r
+                                                       }\r
+                                               }\r
+                                       }\r
+                               }\r
+                       },\r
+\r
+                       onClick : function( item )\r
+                       {\r
+                               this.hide( false );\r
+\r
+                               if ( item.onClick )\r
+                                       item.onClick();\r
+                               else if ( item.command )\r
+                                       this.editor.execCommand( item.command );\r
+                       },\r
+\r
+                       onEscape : function( keystroke )\r
+                       {\r
+                               var parent = this.parent;\r
+                               // 1. If it's sub-menu, restore the last focused item\r
+                               // of upper level menu.\r
+                               // 2. In case of a top-menu, close it.\r
+                               if ( parent )\r
+                               {\r
+                                       parent._.panel.hideChild();\r
+                                       // Restore parent block item focus.\r
+                                       var parentBlock = parent._.panel._.panel._.currentBlock,\r
+                                               parentFocusIndex =  parentBlock._.focusIndex;\r
+                                       parentBlock._.markItem( parentFocusIndex );\r
+                               }\r
+                               else if ( keystroke == 27 )\r
+                                       this.hide();\r
+\r
+                               return false;\r
+                       },\r
+\r
+                       onHide : function()\r
+                       {\r
+                               if ( CKEDITOR.env.ie )\r
+                               {\r
+                                       var selection = this.editor.getSelection();\r
+                                       selection && selection.unlock();\r
+                               }\r
+\r
+                               this.onHide && this.onHide();\r
+                       },\r
+\r
                        showSubMenu : function( index )\r
                        {\r
                                var menu = this._.subMenu,\r
@@ -77,15 +198,20 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                                        return;\r
                                }\r
 \r
+                               // Record parent menu focused item first (#3389).\r
+                               var block = this._.panel.getBlock( this.id );\r
+                               block._.focusIndex = index;\r
+\r
                                // Create the submenu, if not available, or clean the existing\r
                                // one.\r
                                if ( menu )\r
                                        menu.removeAll();\r
                                else\r
                                {\r
-                                       menu = this._.subMenu = new CKEDITOR.menu( this.editor, this._.level + 1 );\r
+                                       menu = this._.subMenu = new CKEDITOR.menu( this.editor,\r
+                                                                  CKEDITOR.tools.extend( {}, this._.definition, { level : this._.level + 1 }, true ) );\r
                                        menu.parent = this;\r
-                                       menu.onClick = CKEDITOR.tools.bind( this.onClick, this );\r
+                                       menu._.onClick = CKEDITOR.tools.bind( this._.onClick, this );\r
                                }\r
 \r
                                // Add all submenu items to the menu.\r
@@ -127,6 +253,17 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
 \r
                        show : function( offsetParent, corner, offsetX, offsetY )\r
                        {\r
+                               // Not for sub menu.\r
+                               if ( !this.parent )\r
+                               {\r
+                                       this._.onShow();\r
+                                       // Don't menu with zero items.\r
+                                       if ( ! this.items.length )\r
+                                               return;\r
+                               }\r
+\r
+                               corner = corner || ( this.editor.lang.dir == 'rtl' ? 2 : 1 );\r
+\r
                                var items = this.items,\r
                                        editor = this.editor,\r
                                        panel = this._.panel,\r
@@ -135,29 +272,26 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                                // Create the floating panel for this menu.\r
                                if ( !panel )\r
                                {\r
-                                       panel = this._.panel = new CKEDITOR.ui.floatPanel( this.editor, CKEDITOR.document.getBody(),\r
-                                               {\r
-                                                       css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ],\r
-                                                       level : this._.level - 1,\r
-                                                       className : editor.skinClass + ' cke_contextmenu'\r
-                                               },\r
-                                               this._.level);\r
+                                       panel = this._.panel = new CKEDITOR.ui.floatPanel( this.editor,\r
+                                               CKEDITOR.document.getBody(),\r
+                                               this._.panelDefinition,\r
+                                               this._.level );\r
 \r
-                                       panel.onEscape = CKEDITOR.tools.bind( function()\r
+                                       panel.onEscape = CKEDITOR.tools.bind( function( keystroke )\r
                                        {\r
-                                               this.onEscape && this.onEscape();\r
-                                               this.hide();\r
+                                               if ( this._.onEscape( keystroke ) === false )\r
+                                                       return false;\r
                                        },\r
                                        this );\r
 \r
                                        panel.onHide = CKEDITOR.tools.bind( function()\r
                                        {\r
-                                               this.onHide && this.onHide();\r
+                                               this._.onHide && this._.onHide();\r
                                        },\r
                                        this );\r
 \r
                                        // Create an autosize block inside the panel.\r
-                                       var block = panel.addBlock( this.id );\r
+                                       var block = panel.addBlock( this.id, this._.panelDefinition.block );\r
                                        block.autoSize = true;\r
 \r
                                        var keys = block.keys;\r
@@ -165,8 +299,9 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                                        keys[ 9 ]       = 'next';                                       // TAB\r
                                        keys[ 38 ]      = 'prev';                                       // ARROW-UP\r
                                        keys[ CKEDITOR.SHIFT + 9 ]      = 'prev';       // SHIFT + TAB\r
-                                       keys[ 32 ]      = 'click';                                      // SPACE\r
-                                       keys[ 39 ]      = 'click';                                      // ARROW-RIGHT\r
+                                       keys[ ( editor.lang.dir == 'rtl' ? 37 : 39 ) ]= CKEDITOR.env.ie ? 'mouseup' : 'click';  // ARROW-RIGHT/ARROW-LEFT(rtl)\r
+                                       keys[ 32 ]      = CKEDITOR.env.ie ? 'mouseup' : 'click';                                        // SPACE\r
+                                       CKEDITOR.env.ie && ( keys[ 13 ] = 'mouseup' );          // Manage ENTER, since onclick is blocked in IE (#8041).\r
 \r
                                        element = this._.element = block.element;\r
                                        element.addClass( editor.skinClass );\r
@@ -178,15 +313,15 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                                        this._.itemOverFn = CKEDITOR.tools.addFunction( function( index )\r
                                                {\r
                                                        clearTimeout( this._.showSubTimeout );\r
-                                                       this._.showSubTimeout = CKEDITOR.tools.setTimeout( this._.showSubMenu, editor.config.menu_subMenuDelay, this, [ index ] );\r
+                                                       this._.showSubTimeout = CKEDITOR.tools.setTimeout( this._.showSubMenu, editor.config.menu_subMenuDelay || 400, this, [ index ] );\r
                                                },\r
-                                               this);\r
+                                               this );\r
 \r
                                        this._.itemOutFn = CKEDITOR.tools.addFunction( function( index )\r
                                                {\r
                                                        clearTimeout( this._.showSubTimeout );\r
                                                },\r
-                                               this);\r
+                                               this );\r
 \r
                                        this._.itemClickFn = CKEDITOR.tools.addFunction( function( index )\r
                                                {\r
@@ -201,16 +336,19 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                                                        if ( item.getItems )\r
                                                                this._.showSubMenu( index );\r
                                                        else\r
-                                                               this.onClick && this.onClick( item );\r
+                                                               this._.onClick( item );\r
                                                },\r
-                                               this);\r
+                                               this );\r
                                }\r
 \r
                                // Put the items in the right order.\r
                                sortItems( items );\r
 \r
+                               var chromeRoot = editor.container.getChild( 1 ),\r
+                                       mixedContentClass = chromeRoot.hasClass( 'cke_mixed_dir_content' ) ? ' cke_mixed_dir_content' : '';\r
+\r
                                // Build the HTML that composes the menu and its items.\r
-                               var output = [ '<div class="cke_menu">' ];\r
+                               var output = [ '<div class="cke_menu' + mixedContentClass + '" role="presentation">' ];\r
 \r
                                var length = items.length,\r
                                        lastGroup = length && items[ 0 ].group;\r
@@ -220,7 +358,7 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                                        var item = items[ i ];\r
                                        if ( lastGroup != item.group )\r
                                        {\r
-                                               output.push( '<div class="cke_menuseparator"></div>' );\r
+                                               output.push( '<div class="cke_menuseparator" role="separator"></div>' );\r
                                                lastGroup = item.group;\r
                                        }\r
 \r
@@ -232,6 +370,8 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                                // Inject the HTML inside the panel.\r
                                element.setHtml( output.join( '' ) );\r
 \r
+                               CKEDITOR.ui.fire( 'ready', this );\r
+\r
                                // Show the panel.\r
                                if ( this.parent )\r
                                        this.parent._.panel.showAsChild( panel, this.id, offsetParent, corner, offsetX, offsetY );\r
@@ -241,9 +381,15 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                                editor.fire( 'menuShow', [ panel ] );\r
                        },\r
 \r
-                       hide : function()\r
+                       addListener : function( listenerFn )\r
+                       {\r
+                               this._.listeners.push( listenerFn );\r
+                       },\r
+\r
+                       hide : function( returnFocus )\r
                        {\r
-                               this._.panel && this._.panel.hide();\r
+                               this._.onHide && this._.onHide();\r
+                               this._.panel && this._.panel.hide( returnFocus );\r
                        }\r
                }\r
        });\r
@@ -262,77 +408,80 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                                        0;\r
                        });\r
        }\r
-})();\r
-\r
-CKEDITOR.menuItem = CKEDITOR.tools.createClass(\r
-{\r
-       $ : function( editor, name, definition )\r
+       CKEDITOR.menuItem = CKEDITOR.tools.createClass(\r
        {\r
-               CKEDITOR.tools.extend( this, definition,\r
-                       // Defaults\r
-                       {\r
-                               order : 0,\r
-                               className : 'cke_button_' + name\r
-                       });\r
+               $ : function( editor, name, definition )\r
+               {\r
+                       CKEDITOR.tools.extend( this, definition,\r
+                               // Defaults\r
+                               {\r
+                                       order : 0,\r
+                                       className : 'cke_button_' + name\r
+                               });\r
 \r
-               // Transform the group name into its order number.\r
-               this.group = editor._.menuGroups[ this.group ];\r
+                       // Transform the group name into its order number.\r
+                       this.group = editor._.menuGroups[ this.group ];\r
 \r
-               this.editor = editor;\r
-               this.name = name;\r
-       },\r
+                       this.editor = editor;\r
+                       this.name = name;\r
+               },\r
 \r
-       proto :\r
-       {\r
-               render : function( menu, index, output )\r
+               proto :\r
                {\r
-                       var id = menu.id + String( index ),\r
-                               state = ( typeof this.state == 'undefined' ) ? CKEDITOR.TRISTATE_OFF : this.state;\r
+                       render : function( menu, index, output )\r
+                       {\r
+                               var id = menu.id + String( index ),\r
+                                       state = ( typeof this.state == 'undefined' ) ? CKEDITOR.TRISTATE_OFF : this.state;\r
 \r
-                       var classes = ' cke_' + (\r
-                               state == CKEDITOR.TRISTATE_ON ? 'on' :\r
-                               state == CKEDITOR.TRISTATE_DISABLED ? 'disabled' :\r
-                               'off' );\r
+                               var classes = ' cke_' + (\r
+                                       state == CKEDITOR.TRISTATE_ON ? 'on' :\r
+                                       state == CKEDITOR.TRISTATE_DISABLED ? 'disabled' :\r
+                                       'off' );\r
 \r
-                       var htmlLabel = this.label;\r
-                       if ( state == CKEDITOR.TRISTATE_DISABLED )\r
-                               htmlLabel = this.editor.lang.common.unavailable.replace( '%1', htmlLabel );\r
+                               var htmlLabel = this.label;\r
 \r
-                       if ( this.className )\r
-                               classes += ' ' + this.className;\r
+                               if ( this.className )\r
+                                       classes += ' ' + this.className;\r
+\r
+                       var hasSubMenu = this.getItems;\r
 \r
                        output.push(\r
-                               '<span class="cke_menuitem">' +\r
+                               '<span class="cke_menuitem' + ( this.icon && this.icon.indexOf( '.png' ) == -1 ? ' cke_noalphafix' : '' ) + '">' +\r
                                '<a id="', id, '"' +\r
                                        ' class="', classes, '" href="javascript:void(\'', ( this.label || '' ).replace( "'", '' ), '\')"' +\r
                                        ' title="', this.label, '"' +\r
                                        ' tabindex="-1"' +\r
                                        '_cke_focus=1' +\r
-                                       ' hidefocus="true"' );\r
+                                       ' hidefocus="true"' +\r
+                                       ' role="menuitem"' +\r
+                                       ( hasSubMenu ? 'aria-haspopup="true"' : '' ) +\r
+                                       ( state == CKEDITOR.TRISTATE_DISABLED ? 'aria-disabled="true"' : '' ) +\r
+                                       ( state == CKEDITOR.TRISTATE_ON ? 'aria-pressed="true"' : '' ) );\r
+\r
+                               // Some browsers don't cancel key events in the keydown but in the\r
+                               // keypress.\r
+                               // TODO: Check if really needed for Gecko+Mac.\r
+                               if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )\r
+                               {\r
+                                       output.push(\r
+                                               ' onkeypress="return false;"' );\r
+                               }\r
 \r
-                       // Some browsers don't cancel key events in the keydown but in the\r
-                       // keypress.\r
-                       // TODO: Check if really needed for Gecko+Mac.\r
-                       if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )\r
-                       {\r
-                               output.push(\r
-                                       ' onkeypress="return false;"' );\r
-                       }\r
+                               // With Firefox, we need to force the button to redraw, otherwise it\r
+                               // will remain in the focus state.\r
+                               if ( CKEDITOR.env.gecko )\r
+                               {\r
+                                       output.push(\r
+                                               ' onblur="this.style.cssText = this.style.cssText;"' );\r
+                               }\r
 \r
-                       // With Firefox, we need to force the button to redraw, otherwise it\r
-                       // will remain in the focus state.\r
-                       if ( CKEDITOR.env.gecko )\r
-                       {\r
+                               var offset = ( this.iconOffset || 0 ) * -16;\r
                                output.push(\r
-                                       ' onblur="this.style.cssText = this.style.cssText;"' );\r
-                       }\r
-\r
-                       var offset = ( this.iconOffset || 0 ) * -16;\r
-                       output.push(\r
 //                                     ' onkeydown="return CKEDITOR.ui.button._.keydown(', index, ', event);"' +\r
                                        ' onmouseover="CKEDITOR.tools.callFunction(', menu._.itemOverFn, ',', index, ');"' +\r
-                                       ' onmouseout="CKEDITOR.tools.callFunction(', menu._.itemOutFn, ',', index, ');"' +\r
-                                       ' onclick="CKEDITOR.tools.callFunction(', menu._.itemClickFn, ',', index, '); return false;"' +\r
+                                       ' onmouseout="CKEDITOR.tools.callFunction(', menu._.itemOutFn, ',', index, ');" ' +\r
+                                       ( CKEDITOR.env.ie ? 'onclick="return false;" onmouseup' : 'onclick' ) +         // #188\r
+                                               '="CKEDITOR.tools.callFunction(', menu._.itemClickFn, ',', index, '); return false;"' +\r
                                        '>' +\r
                                                '<span class="cke_icon_wrapper"><span class="cke_icon"' +\r
                                                        ( this.icon ? ' style="background-image:url(' + CKEDITOR.getUrl( this.icon ) + ');background-position:0 ' + offset + 'px;"'\r
@@ -340,24 +489,33 @@ CKEDITOR.menuItem = CKEDITOR.tools.createClass(
                                                        '></span></span>' +\r
                                                '<span class="cke_label">' );\r
 \r
-                       if ( this.getItems )\r
+                       if ( hasSubMenu )\r
                        {\r
                                output.push(\r
-                                                       '<span class="cke_menuarrow"></span>' );\r
+                                                       '<span class="cke_menuarrow">',\r
+                                                               '<span>&#',\r
+                                                                       ( this.editor.lang.dir == 'rtl' ?\r
+                                                                               '9668' :        // BLACK LEFT-POINTING POINTER\r
+                                                                               '9658' ),       // BLACK RIGHT-POINTING POINTER\r
+                                                               ';</span>',\r
+                                                       '</span>' );\r
                        }\r
 \r
-                       output.push(\r
-                                                       htmlLabel,\r
-                                               '</span>' +\r
-                               '</a>' +\r
-                               '</span>' );\r
+                               output.push(\r
+                                                               htmlLabel,\r
+                                                       '</span>' +\r
+                                       '</a>' +\r
+                                       '</span>' );\r
                }\r
-       }\r
-});\r
+               }\r
+       });\r
+\r
+})();\r
+\r
 \r
 /**\r
- * The amount of time, in milliseconds, the editor waits before showing submenu\r
- * options when moving the mouse over options that contains submenus, like the\r
+ * The amount of time, in milliseconds, the editor waits before displaying submenu\r
+ * options when moving the mouse over options that contain submenus, like the\r
  * "Cell Properties" entry for tables.\r
  * @type Number\r
  * @default 400\r
@@ -365,12 +523,11 @@ CKEDITOR.menuItem = CKEDITOR.tools.createClass(
  * // Remove the submenu delay.\r
  * config.menu_subMenuDelay = 0;\r
  */\r
-CKEDITOR.config.menu_subMenuDelay = 400;\r
 \r
 /**\r
  * A comma separated list of items group names to be displayed in the context\r
- * menu. The items order will reflect the order in this list if no priority\r
- * has been definted in the groups.\r
+ * menu. The order of items will reflect the order specified in this list if\r
+ * no priority was defined in the groups.\r
  * @type String\r
  * @default 'clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea'\r
  * @example\r
@@ -381,4 +538,4 @@ CKEDITOR.config.menu_groups =
        'form,' +\r
        'tablecell,tablecellproperties,tablerow,tablecolumn,table,'+\r
        'anchor,link,image,flash,' +\r
-       'checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea';\r
+       'checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea,div';\r