Index: _source/plugins/dialog/plugin.js =================================================================== --- _source/plugins/dialog/plugin.js (revision 3043) +++ _source/plugins/dialog/plugin.js (working copy) @@ -469,6 +469,9 @@ // Execute onLoad for the first show. this.fireOnce( 'load', {} ); this.fire( 'show', {} ); + + // Save the initial values of the dialog. + this.foreach( function( contentObj ) { contentObj.setInitValue && contentObj.setInitValue(); } ); }, /** @@ -498,30 +501,6 @@ return function(){ this.foreach( fn ); return this; }; })(), - /** - * Pushes the current values of all inputs in the dialog into the default stack. - * @example - * dialogObj.pushDefault(); - * @returns {CKEDITOR.dialog} The current dialog object. - */ - pushDefault : (function() - { - var fn = function( widget ){ if ( widget.pushDefault ) widget.pushDefault(); }; - return function(){ this.foreach( fn ); return this; }; - })(), - - /** - * Pops the current default values of all inputs in the dialog. - * @example - * dialogObj.popDefault(); - * @returns {CKEDITOR.dialog} The current dialog object. - */ - popDefault : (function() - { - var fn = function( widget ){ if ( widget.popDefault ) widget.popDefault(); }; - return function(){ this.foreach( fn ); return this; }; - })(), - setupContent : function() { var args = arguments; @@ -585,6 +564,9 @@ CKEDITOR.dialog._.currentZIndex -= 10; this.fire( 'hide', {} ); + + // Reset the initial values of the dialog. + this.foreach( function( contentObj ) { contentObj.resetInitValue && contentObj.resetInitValue(); } ); }, /** Index: _source/plugins/dialogui/plugin.js =================================================================== --- _source/plugins/dialogui/plugin.js (revision 3043) +++ _source/plugins/dialogui/plugin.js (working copy) @@ -12,7 +12,7 @@ var initPrivateObject = function( elementDefinition ) { this._ || ( this._ = {} ); - this._['default'] = [ elementDefinition['default'] || '' ]; + this._['default'] = this._.initValue = elementDefinition['default'] || ''; var args = [ this._ ]; for ( var i = 1 ; i < arguments.length ; i++ ) args.push( arguments[i] ); @@ -38,28 +38,27 @@ { isChanged : function() { - return this.getValue() != this.getDefault(); + return this.getValue() != this.getInitValue(); }, reset : function() { - this.setValue( this.getDefault() ); + this.setValue( this.getInitValue() ); }, - getDefault : function() + setInitValue : function() { - var defs = this._['default']; - return defs[ defs.length - 1 ]; + this._.initValue = this.getValue(); }, - pushDefault : function() + resetInitValue : function() { - this._['default'].push( this.getValue() ); + this._.initValue = this._['default']; }, - popDefault : function() + getInitValue : function() { - this._['default'].pop(); + return this._.initValue; } }, commonEventProcessors = CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, @@ -276,7 +275,7 @@ var html = [ '
' ); + html.push( '>', CKEDITOR.tools.htmlEncode( me._['default'] ), '' ); return html.join( '' ); }; CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML ); @@ -356,8 +355,8 @@ return; initPrivateObject.call( this, elementDefinition ); - if ( !this.getDefault() ) - this._['default'] = [ elementDefinition.items[0][1] ] ; + if ( !this._['default'] ) + this._['default'] = this._.initValue = elementDefinition.items[0][1]; if ( elementDefinition.validate ) this.validate = elementDefinition.valdiate; var children = [], me = this; @@ -392,7 +391,7 @@ name : commonName, value : value }; - if ( me.getDefault() == value ) + if ( me._['default'] == value ) inputAttributes.checked = 'checked'; cleanInnerDefinition( inputDefinition ); cleanInnerDefinition( labelDefinition );