for ( var i = 0 ; i < groups.length ; i++ )\r
groupsOrder[ groups[ i ] ] = i + 1;\r
\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
};\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
var item = this.editor.getMenuItem( itemName );\r
\r
- if ( item )\r
+ if ( item && ( !item.command || this.editor.getCommand( item.command ).state ) )\r
{\r
item.state = listenerItems[ itemName ];\r
this.add( item );\r
\r
onClick : function( item )\r
{\r
- this.hide();\r
+ this.hide( false );\r
\r
if ( item.onClick )\r
item.onClick();\r
parentBlock._.markItem( parentFocusIndex );\r
}\r
else if ( keystroke == 27 )\r
- {\r
this.hide();\r
- this.editor.focus();\r
- }\r
+\r
return false;\r
},\r
\r
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[ ( editor.lang.dir == 'rtl' ? 37 : 39 ) ] = 'click'; // ARROW-RIGHT/ARROW-LEFT(rtl)\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
this._.listeners.push( listenerFn );\r
},\r
\r
- hide : function()\r
+ hide : function( returnFocus )\r
{\r
this._.onHide && this._.onHide();\r
- this._.panel && this._.panel.hide();\r
+ this._.panel && this._.panel.hide( returnFocus );\r
}\r
}\r
});\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
\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
\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