JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
vanilla ckeditor-3.1
[ckeditor.git] / _source / plugins / menu / plugin.js
index 790f16f..93ac77f 100644 (file)
@@ -1,5 +1,5 @@
 /*\r
-Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
+Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.\r
 For licensing, see LICENSE.html or http://ckeditor.com/license\r
 */\r
 \r
@@ -67,11 +67,11 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                        {\r
                                var menu = this._.subMenu,\r
                                        item = this.items[ index ],\r
-                                       subItems = item.getItems && item.getItems();\r
+                                       subItemDefs = item.getItems && item.getItems();\r
 \r
                                // If this item has no subitems, we just hide the submenu, if\r
                                // available, and return back.\r
-                               if ( !subItems )\r
+                               if ( !subItemDefs )\r
                                {\r
                                        this._.panel.hideChild();\r
                                        return;\r
@@ -89,9 +89,14 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                                }\r
 \r
                                // Add all submenu items to the menu.\r
-                               for ( var itemName in subItems )\r
+                               for ( var subItemName in subItemDefs )\r
                                {\r
-                                       menu.add( this.editor.getMenuItem( itemName ) );\r
+                                       var subItem = this.editor.getMenuItem( subItemName );\r
+                                       if ( subItem )\r
+                                       {\r
+                                               subItem.state = subItemDefs[ subItemName ];\r
+                                               menu.add( subItem );\r
+                                       }\r
                                }\r
 \r
                                // Get the element representing the current item.\r
@@ -132,7 +137,7 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                                {\r
                                        panel = this._.panel = new CKEDITOR.ui.floatPanel( this.editor, CKEDITOR.document.getBody(),\r
                                                {\r
-                                                       css : [ CKEDITOR.getUrl( editor.skinPath + 'editor.css' ) ],\r
+                                                       css : editor.skin.editor.css,\r
                                                        level : this._.level - 1,\r
                                                        className : editor.skinClass + ' cke_contextmenu'\r
                                                },\r
@@ -232,6 +237,8 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
                                        this.parent._.panel.showAsChild( panel, this.id, offsetParent, corner, offsetX, offsetY );\r
                                else\r
                                        panel.showBlock( this.id, offsetParent, corner, offsetX, offsetY );\r
+\r
+                               editor.fire( 'menuShow', [ panel ] );\r
                        },\r
 \r
                        hide : function()\r
@@ -328,7 +335,7 @@ CKEDITOR.menuItem = CKEDITOR.tools.createClass(
                                        ' onclick="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;"></span>'\r
+                                                       ( this.icon ? ' style="background-image:url(' + CKEDITOR.getUrl( this.icon ) + ');background-position:0 ' + offset + 'px;"'\r
                                                        : '' ) +\r
                                                        '></span></span>' +\r
                                                '<span class="cke_label">' );\r
@@ -374,4 +381,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