X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fmenu%2Fplugin.js;h=7921fee50f2834b795eccd61298f4fadbd567c50;hb=refs%2Ftags%2Fv3.0.2;hp=790f16f9be9ad4435e54e218e4e3535c4e693dad;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/plugins/menu/plugin.js b/_source/plugins/menu/plugin.js index 790f16f..7921fee 100644 --- a/_source/plugins/menu/plugin.js +++ b/_source/plugins/menu/plugin.js @@ -67,11 +67,11 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype, { var menu = this._.subMenu, item = this.items[ index ], - subItems = item.getItems && item.getItems(); + subItemDefs = item.getItems && item.getItems(); // If this item has no subitems, we just hide the submenu, if // available, and return back. - if ( !subItems ) + if ( !subItemDefs ) { this._.panel.hideChild(); return; @@ -89,9 +89,14 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype, } // Add all submenu items to the menu. - for ( var itemName in subItems ) + for ( var subItemName in subItemDefs ) { - menu.add( this.editor.getMenuItem( itemName ) ); + var subItem = this.editor.getMenuItem( subItemName ); + if ( subItem ) + { + subItem.state = subItemDefs[ subItemName ]; + menu.add( subItem ); + } } // Get the element representing the current item. @@ -232,6 +237,8 @@ CKEDITOR.tools.extend( CKEDITOR.editor.prototype, this.parent._.panel.showAsChild( panel, this.id, offsetParent, corner, offsetX, offsetY ); else panel.showBlock( this.id, offsetParent, corner, offsetX, offsetY ); + + editor.fire( 'menuShow', [ panel ] ); }, hide : function() @@ -328,7 +335,7 @@ CKEDITOR.menuItem = CKEDITOR.tools.createClass( ' onclick="CKEDITOR.tools.callFunction(', menu._.itemClickFn, ',', index, '); return false;"' + '>' + '' + ( this.icon ? ' style="background-image:url(' + CKEDITOR.getUrl( this.icon ) + ');background-position:0 ' + offset + 'px;"' : '' ) + '>' + '' );