Ticket #2803: 2803.patch
File 2803.patch, 7.9 KB (added by , 14 years ago) |
---|
-
_source/plugins/dialog/plugin.js
441 441 // Execute onLoad for the first show. 442 442 this.fireOnce( 'load', {} ); 443 443 this.fire( 'show', {} ); 444 445 // Save the initial values of the dialog. 446 this.foreach( function( contentObj ) { contentObj.setInitValue && contentObj.setInitValue(); } ); 444 447 }, 445 448 446 449 /** … … 469 472 })(), 470 473 471 474 /** 472 * Pushes the current values of all inputs in the dialog into the default stack.473 * @example474 * dialogObj.pushDefault();475 * @returns {CKEDITOR.dialog} The current dialog object.476 */477 pushDefault : (function()478 {479 var fn = function( widget ){ if ( widget.pushDefault ) widget.pushDefault(); };480 return function(){ this.foreach( fn ); return this; };481 })(),482 483 /**484 * Pops the current default values of all inputs in the dialog.485 * @example486 * dialogObj.popDefault();487 * @returns {CKEDITOR.dialog} The current dialog object.488 */489 popDefault : (function()490 {491 var fn = function( widget ){ if ( widget.popDefault ) widget.popDefault(); };492 return function(){ this.foreach( fn ); return this; };493 })(),494 495 /**496 475 * Hides the dialog box. 497 476 * @example 498 477 * dialogObj.hide(); … … 535 514 CKEDITOR.dialog._.currentZIndex -= 10; 536 515 537 516 this.fire( 'hide', {} ); 517 518 // Reset the initial values of the dialog. 519 this.foreach( function( contentObj ) { contentObj.resetInitValue && contentObj.resetInitValue(); } ); 538 520 }, 539 521 540 522 /** -
_source/plugins/dialogui/plugin.js
12 12 var initPrivateObject = function( elementDefinition ) 13 13 { 14 14 this._ || ( this._ = {} ); 15 this._['default'] = [ elementDefinition['default'] || '' ];15 this._['default'] = this._.initValue = elementDefinition['default'] || '' ; 16 16 var args = [ this._ ]; 17 17 for ( var i = 1 ; i < arguments.length ; i++ ) 18 18 args.push( arguments[i] ); … … 38 38 { 39 39 isChanged : function() 40 40 { 41 return this.getValue() != this.get Default();41 return this.getValue() != this.getInitValue(); 42 42 }, 43 43 44 44 reset : function() 45 45 { 46 this.setValue( this.get Default() );46 this.setValue( this.getInitValue() ); 47 47 }, 48 48 49 getDefault: function()49 setInitValue : function() 50 50 { 51 var defs = this._['default']; 52 return defs[ defs.length - 1 ]; 51 this._.initValue = this.getValue(); 53 52 }, 54 53 55 pushDefault: function()54 resetInitValue : function() 56 55 { 57 this._ ['default'].push( this.getValue() );56 this._.initValue = this._['default']; 58 57 }, 59 58 60 popDefault: function()59 getInitValue : function() 61 60 { 62 this._['default'].pop();61 return this._.initValue; 63 62 } 64 63 }, 65 64 commonEventProcessors = CKEDITOR.tools.extend( {}, CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors, … … 276 275 var html = [ '<div class="cke_dialog_ui_input_textarea"><textarea class="cke_dialog_ui_input_textarea" id="', domId, '" ' ]; 277 276 for ( var i in attributes ) 278 277 html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '" ' ); 279 html.push( '>', CKEDITOR.tools.htmlEncode( me. getDefault()), '</textarea></div>' );278 html.push( '>', CKEDITOR.tools.htmlEncode( me._['default'] ), '</textarea></div>' ); 280 279 return html.join( '' ); 281 280 } 282 281 CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML ); … … 356 355 return; 357 356 358 357 initPrivateObject.call( this, elementDefinition ); 359 if ( this. getDefault()== '' )360 this._['default'] = [ elementDefinition.items[0][1]] ;358 if ( this._['default'] == '' ) 359 this._['default'] = this._.initValue = elementDefinition.items[0][1] ; 361 360 if ( elementDefinition.validate ) 362 361 this.validate = elementDefinition.valdiate; 363 362 var children = [], me = this; … … 392 391 name : commonName, 393 392 value : value 394 393 }; 395 if ( me. getDefault()== value )394 if ( me._['default'] == value ) 396 395 inputAttributes.checked = 'checked'; 397 396 cleanInnerDefinition( inputDefinition ); 398 397 cleanInnerDefinition( labelDefinition ); -
_source/plugins/flash/dialogs/flash.js
298 298 299 299 // Don't call onChange before onShow. 300 300 this.allowOnChange = false; 301 302 // Pop the default values from default value set that are pushed in onShow().303 this.popDefault();304 301 }, 305 302 onShow : function() 306 303 { … … 358 355 updatePreview( this ); 359 356 360 357 this.allowOnChange = true; 361 this.pushDefault();362 358 this.getContentElement( 'info', 'txtUrl' ).focus(); 363 359 }, 364 360 onOk : function() -
_source/plugins/forms/dialogs/select.js
101 101 this.editObj = this.getParentEditor().document.createElement( 'select' ); 102 102 } 103 103 104 this.pushDefault();105 104 this.getContentElement( 'info', 'txtName' ).focus(); 106 105 }, 107 106 onOk : function() -
_source/plugins/image/dialogs/image.js
618 618 } 619 619 620 620 this.allowOnChange = true; 621 this.pushDefault();622 621 this.getContentElement( 'info', 'txtUrl' ).focus(); 623 622 }, 624 623 onLoad : function() … … 688 687 689 688 // Don't call onChange before onShow. 690 689 this.allowOnChange = false; 691 692 // Pop the default values from default value set that are pushed in onShow().693 this.popDefault();694 690 }, 695 691 contents : [ 696 692 { -
_source/plugins/link/dialogs/anchor.js
74 74 this.saveSelection(); 75 75 } 76 76 } 77 this.pushDefault();78 77 this.getContentElement( 'info', 'txtName' ).focus(); 79 78 }, 80 79 onHide : function() 81 80 { 82 // Pop the default values from default value set that are pushed in onShow().83 this.popDefault();84 81 }, 85 82 contents : [ 86 83 { -
_source/plugins/link/dialogs/link.js
710 710 } 711 711 } 712 712 713 // Push the current values into the dialog default value stack.714 this.pushDefault();715 716 713 // Put focus into the first most likely used input. 717 714 var linkType = this.getValueOf( 'info', 'linkType' ); 718 715 if ( linkType == 'url' ) … … 862 859 }, 863 860 onHide : function() 864 861 { 865 // Pop the default values from default value set that are pushed in onShow().866 this.popDefault();867 862 } 868 863 }; 869 864 } ); -
_source/plugins/table/dialogs/table.js
69 69 70 70 // Save a reference to the selected table, and push a new set of default values. 71 71 this._.selectedElement = selectedTable; 72 this.pushDefault();73 72 } 74 73 else 75 74 { … … 83 82 }, 84 83 onHide : function() 85 84 { 86 if ( this._.selectedElement )87 this.popDefault();88 85 }, 89 86 onOk : function() 90 87 {