X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Fui.js;h=0a66c2ed7a31afe5fbedda3d99373548afdb499f;hb=941b0a9ba4e673e292510d80a5a86806994b8ea6;hp=1d152e24d38f7be5341207690a05e84a054b3dc7;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91;p=ckeditor.git diff --git a/_source/core/ui.js b/_source/core/ui.js index 1d152e2..0a66c2e 100644 --- a/_source/core/ui.js +++ b/_source/core/ui.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -21,7 +21,8 @@ CKEDITOR.ui = function( editor ) this._ = { handlers : {}, - items : {} + items : {}, + editor : editor }; return this; @@ -51,6 +52,8 @@ CKEDITOR.ui.prototype = this._.items[ name ] = { type : type, + // The name of {@link CKEDITOR.command} which associate with this UI. + command : definition.command || null, args : Array.prototype.slice.call( arguments, 2 ) }; }, @@ -63,9 +66,16 @@ CKEDITOR.ui.prototype = create : function( name ) { var item = this._.items[ name ], - handler = item && this._.handlers[ item.type ]; + handler = item && this._.handlers[ item.type ], + command = item && item.command && this._.editor.getCommand( item.command ); - return handler && handler.create.apply( this, item.args ); + var result = handler && handler.create.apply( this, item.args ); + + // Add reference inside command object. + if ( command ) + command.uiItems.push( result ); + + return result; }, /**