X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fdialogui%2Fplugin.js;h=963c80c45d6030d1cd7345da7867c864edc2889b;hb=2f22c0c38f17e75be5541089076885442aaa2377;hp=6fa23608d099639b6c91e0d0d35c6037629ab123;hpb=8761695d9b70afe75905deaac88f78c1f8aeb32d;p=ckeditor.git diff --git a/_source/plugins/dialogui/plugin.js b/_source/plugins/dialogui/plugin.js index 6fa2360..963c80c 100644 --- a/_source/plugins/dialogui/plugin.js +++ b/_source/plugins/dialogui/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -13,6 +13,7 @@ CKEDITOR.plugins.add( 'dialogui' ); { this._ || ( this._ = {} ); this._['default'] = this._.initValue = elementDefinition['default'] || ''; + this._.required = elementDefinition[ 'required' ] || false; var args = [ this._ ]; for ( var i = 1 ; i < arguments.length ; i++ ) args.push( arguments[i] ); @@ -34,6 +35,23 @@ CKEDITOR.plugins.add( 'dialogui' ); return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, elementDefinition, output ); } }, + containerBuilder = + { + build : function( dialog, elementDefinition, output ) + { + var children = elementDefinition.children, + child, + childHtmlList = [], + childObjList = []; + for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ ) + { + var childHtml = []; + childHtmlList.push( childHtml ); + childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) ); + } + return new CKEDITOR.ui.dialog[ elementDefinition.type ]( dialog, childObjList, childHtmlList, output, elementDefinition ); + } + }, commonPrototype = { isChanged : function() @@ -41,9 +59,9 @@ CKEDITOR.plugins.add( 'dialogui' ); return this.getValue() != this.getInitValue(); }, - reset : function() + reset : function( noChangeEvent ) { - this.setValue( this.getInitValue() ); + this.setValue( this.getInitValue(), noChangeEvent ); }, setInitValue : function() @@ -69,7 +87,14 @@ CKEDITOR.plugins.add( 'dialogui' ); { dialog.on( 'load', function() { - this.getInputElement().on( 'change', function(){ this.fire( 'change', { value : this.getValue() } ); }, this ); + this.getInputElement().on( 'change', function() + { + // Make sure 'onchange' doesn't get fired after dialog closed. (#5719) + if ( !dialog.parts.dialog.isVisible() ) + return; + + this.fire( 'change', { value : this.getValue() } ); + }, this ); }, this ); this._.domOnChangeRegistered = true; } @@ -99,7 +124,7 @@ CKEDITOR.plugins.add( 'dialogui' ); * @extends CKEDITOR.ui.dialog.uiElement * @param {CKEDITOR.dialog} dialog * Parent dialog object. - * @param {CKEDITOR.dialog.uiElementDefinition} elementDefinition + * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition * The element definition. Accepted fields: *