this._ =\r
{\r
handlers : {},\r
- items : {}\r
+ items : {},\r
+ editor : editor\r
};\r
\r
return this;\r
this._.items[ name ] =\r
{\r
type : type,\r
+ // The name of {@link CKEDITOR.command} which associate with this UI.\r
+ command : definition.command || null,\r
args : Array.prototype.slice.call( arguments, 2 )\r
};\r
},\r
create : function( name )\r
{\r
var item = this._.items[ name ],\r
- handler = item && this._.handlers[ item.type ];\r
+ handler = item && this._.handlers[ item.type ],\r
+ command = item && item.command && this._.editor.getCommand( item.command );\r
\r
- return handler && handler.create.apply( this, item.args );\r
+ var result = handler && handler.create.apply( this, item.args );\r
+\r
+ // Add reference inside command object.\r
+ if ( command )\r
+ command.uiItems.push( result );\r
+\r
+ return result;\r
},\r
\r
/**\r