X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fcore%2Fui.js;h=d0ec6d7d7f5d2fc8f716af7821b7ea3e68c5cd4d;hp=1d152e24d38f7be5341207690a05e84a054b3dc7;hb=8761695d9b70afe75905deaac88f78c1f8aeb32d;hpb=ea7e3453c7b0f023b050aca6d9f83ab372860d91 diff --git a/_source/core/ui.js b/_source/core/ui.js index 1d152e2..d0ec6d7 100644 --- a/_source/core/ui.js +++ b/_source/core/ui.js @@ -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; }, /**