Index: _source/plugins/dialog/plugin.js =================================================================== --- _source/plugins/dialog/plugin.js (revision 2988) +++ _source/plugins/dialog/plugin.js (working copy) @@ -441,6 +441,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(); } ); }, /** @@ -469,30 +472,6 @@ })(), /** - * 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; }; - })(), - - /** * Hides the dialog box. * @example * dialogObj.hide(); @@ -535,6 +514,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 2988) +++ _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 ); Index: _source/plugins/flash/dialogs/flash.js =================================================================== --- _source/plugins/flash/dialogs/flash.js (revision 2988) +++ _source/plugins/flash/dialogs/flash.js (working copy) @@ -298,9 +298,6 @@ // Don't call onChange before onShow. this.allowOnChange = false; - - // Pop the default values from default value set that are pushed in onShow(). - this.popDefault(); }, onShow : function() { @@ -358,7 +355,6 @@ updatePreview( this ); this.allowOnChange = true; - this.pushDefault(); this.getContentElement( 'info', 'txtUrl' ).focus(); }, onOk : function() Index: _source/plugins/forms/dialogs/select.js =================================================================== --- _source/plugins/forms/dialogs/select.js (revision 2988) +++ _source/plugins/forms/dialogs/select.js (working copy) @@ -101,7 +101,6 @@ this.editObj = this.getParentEditor().document.createElement( 'select' ); } - this.pushDefault(); this.getContentElement( 'info', 'txtName' ).focus(); }, onOk : function() Index: _source/plugins/image/dialogs/image.js =================================================================== --- _source/plugins/image/dialogs/image.js (revision 2988) +++ _source/plugins/image/dialogs/image.js (working copy) @@ -618,7 +618,6 @@ } this.allowOnChange = true; - this.pushDefault(); this.getContentElement( 'info', 'txtUrl' ).focus(); }, onLoad : function() @@ -688,9 +687,6 @@ // Don't call onChange before onShow. this.allowOnChange = false; - - // Pop the default values from default value set that are pushed in onShow(). - this.popDefault(); }, contents : [ { Index: _source/plugins/link/dialogs/anchor.js =================================================================== --- _source/plugins/link/dialogs/anchor.js (revision 2988) +++ _source/plugins/link/dialogs/anchor.js (working copy) @@ -74,13 +74,10 @@ this.saveSelection(); } } - this.pushDefault(); this.getContentElement( 'info', 'txtName' ).focus(); }, onHide : function() { - // Pop the default values from default value set that are pushed in onShow(). - this.popDefault(); }, contents : [ { Index: _source/plugins/link/dialogs/link.js =================================================================== --- _source/plugins/link/dialogs/link.js (revision 2988) +++ _source/plugins/link/dialogs/link.js (working copy) @@ -710,9 +710,6 @@ } } - // Push the current values into the dialog default value stack. - this.pushDefault(); - // Put focus into the first most likely used input. var linkType = this.getValueOf( 'info', 'linkType' ); if ( linkType == 'url' ) @@ -862,8 +859,6 @@ }, onHide : function() { - // Pop the default values from default value set that are pushed in onShow(). - this.popDefault(); } }; } ); Index: _source/plugins/table/dialogs/table.js =================================================================== --- _source/plugins/table/dialogs/table.js (revision 2988) +++ _source/plugins/table/dialogs/table.js (working copy) @@ -69,7 +69,6 @@ // Save a reference to the selected table, and push a new set of default values. this._.selectedElement = selectedTable; - this.pushDefault(); } else { @@ -83,8 +82,6 @@ }, onHide : function() { - if ( this._.selectedElement ) - this.popDefault(); }, onOk : function() {