Ticket #7588: 7588_2.patch
File 7588_2.patch, 5.6 KB (added by , 13 years ago) |
---|
-
_source/core/ui.js
3 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 4 */ 5 5 6 /** 7 * Contains UI features related to an editor instance. 8 * @constructor 9 * @param {CKEDITOR.editor} editor The editor instance. 10 * @example 11 */ 12 CKEDITOR.ui = function( editor ) 13 { 14 if ( editor.ui ) 15 return editor.ui; 6 (function() { 7 // Don't initialize twice #7588 8 if ( CKEDITOR.ui ) 9 return; 16 10 17 11 /** 18 * Object used to hold private stuff. 19 * @private 12 * Contains UI features related to an editor instance. 13 * @constructor 14 * @param {CKEDITOR.editor} editor The editor instance. 15 * @example 20 16 */ 21 this._ =17 CKEDITOR.ui = function( editor ) 22 18 { 23 handlers : {}, 24 items : {}, 25 editor : editor 19 if ( editor.ui ) 20 return editor.ui; 21 22 /** 23 * Object used to hold private stuff. 24 * @private 25 */ 26 this._ = 27 { 28 handlers : {}, 29 items : {}, 30 editor : editor 31 }; 32 33 return this; 26 34 }; 27 35 28 return this; 29 }; 36 // PACKAGER_RENAME( CKEDITOR.ui ) 30 37 31 // PACKAGER_RENAME( CKEDITOR.ui ) 32 33 CKEDITOR.ui.prototype = 34 { 35 /** 36 * Adds a UI item to the items collection. These items can be later used in 37 * the interface. 38 * @param {String} name The UI item name. 39 * @param {Object} type The item type. 40 * @param {Object} definition The item definition. The properties of this 41 * object depend on the item type. 42 * @example 43 * // Add a new button named "MyBold". 44 * editorInstance.ui.add( 'MyBold', CKEDITOR.UI_BUTTON, 45 * { 46 * label : 'My Bold', 47 * command : 'bold' 48 * }); 49 */ 50 add : function( name, type, definition ) 38 CKEDITOR.ui.prototype = 51 39 { 52 this._.items[ name ] = 40 /** 41 * Adds a UI item to the items collection. These items can be later used in 42 * the interface. 43 * @param {String} name The UI item name. 44 * @param {Object} type The item type. 45 * @param {Object} definition The item definition. The properties of this 46 * object depend on the item type. 47 * @example 48 * // Add a new button named "MyBold". 49 * editorInstance.ui.add( 'MyBold', CKEDITOR.UI_BUTTON, 50 * { 51 * label : 'My Bold', 52 * command : 'bold' 53 * }); 54 */ 55 add : function( name, type, definition ) 53 56 { 54 type : type, 55 // The name of {@link CKEDITOR.command} which associate with this UI. 56 command : definition.command || null, 57 args : Array.prototype.slice.call( arguments, 2 ) 58 }; 59 }, 57 this._.items[ name ] = 58 { 59 type : type, 60 // The name of {@link CKEDITOR.command} which associate with this UI. 61 command : definition.command || null, 62 args : Array.prototype.slice.call( arguments, 2 ) 63 }; 64 }, 60 65 61 /**62 * Gets a UI object.63 * @param {String} name The UI item hame.64 * @example65 */66 create : function( name )67 {68 var item = this._.items[ name ],69 handler = item && this._.handlers[ item.type ],70 command = item && item.command && this._.editor.getCommand( item.command );66 /** 67 * Gets a UI object. 68 * @param {String} name The UI item hame. 69 * @example 70 */ 71 create : function( name ) 72 { 73 var item = this._.items[ name ], 74 handler = item && this._.handlers[ item.type ], 75 command = item && item.command && this._.editor.getCommand( item.command ); 71 76 72 var result = handler && handler.create.apply( this, item.args );77 var result = handler && handler.create.apply( this, item.args ); 73 78 74 // Add reference inside command object.75 if ( command )76 command.uiItems.push( result );79 // Add reference inside command object. 80 if ( command ) 81 command.uiItems.push( result ); 77 82 78 return result;79 },83 return result; 84 }, 80 85 81 /**82 * Adds a handler for a UI item type. The handler is responsible for83 * transforming UI item definitions in UI objects.84 * @param {Object} type The item type.85 * @param {Object} handler The handler definition.86 * @example87 */88 addHandler : function( type, handler )89 {90 this._.handlers[ type ] = handler;91 }92 };86 /** 87 * Adds a handler for a UI item type. The handler is responsible for 88 * transforming UI item definitions in UI objects. 89 * @param {Object} type The item type. 90 * @param {Object} handler The handler definition. 91 * @example 92 */ 93 addHandler : function( type, handler ) 94 { 95 this._.handlers[ type ] = handler; 96 } 97 }; 93 98 94 CKEDITOR.event.implementOn( CKEDITOR.ui ); 99 CKEDITOR.event.implementOn( CKEDITOR.ui ); 100 })(); 95 101 96 102 /** 97 103 * (Virtual Class) Do not call this constructor. This class is not really part -
_source/plugins/dialog/plugin.js
33 33 34 34 (function() 35 35 { 36 // Don't initialize twice #7588 37 if ( CKEDITOR.dialog ) 38 return; 39 36 40 var cssLength = CKEDITOR.tools.cssLength; 37 41 function isTabVisible( tabId ) 38 42 { -
_source/plugins/dialogui/plugin.js
9 9 10 10 (function() 11 11 { 12 // Don't initialize twice #7588 13 if ( CKEDITOR.ui.dialog && CKEDITOR.ui.dialog.labeledElement ) 14 return; 15 12 16 var initPrivateObject = function( elementDefinition ) 13 17 { 14 18 this._ || ( this._ = {} );