Ticket #4174: 4174.patch
File 4174.patch, 6.1 KB (added by , 14 years ago) |
---|
-
_source/core/tools.js
533 533 repeat : function( str, times ) 534 534 { 535 535 return new Array( times + 1 ).join( str ); 536 }, 537 538 capitalize: function( str ) 539 { 540 return str.charAt(0).toUpperCase() + str.substring(1).toLowerCase(); 536 541 } 542 537 543 }; 538 544 })(); 539 545 -
_source/core/dom/element.js
456 456 * alert( <b>element.getComputedStyle( 'display' )</b> ); // "inline" 457 457 */ 458 458 getComputedStyle : 459 CKEDITOR.env.ie ? 460 function( propertyName ) 461 { 462 return this.$.currentStyle[ CKEDITOR.tools.cssStyleToDomStyle( propertyName ) ]; 463 } 459 CKEDITOR.env.ie ? ( function() 460 { 461 var offsetReviseMap = 462 { 463 width: ['Left', 'Right'], 464 height: ['Top', 'Bottom'], 465 top: ['Top'], 466 bottom: ['Bottom'] 467 }; 468 469 return function( propertyName ) 470 { 471 var style = this.$.currentStyle[ CKEDITOR.tools.cssStyleToDomStyle( propertyName ) ]; 472 // IE computed width/height incorrect with auto/percentage values, 473 // compute by subtracting padding and border from offset size. 474 if( propertyName in offsetReviseMap 475 && ( style == 'auto' || style.match( '%' ) ) ) 476 { 477 var style = this.$[ 'offset' + CKEDITOR.tools.capitalize( propertyName ) ], 478 revisement = offsetReviseMap[ propertyName ]; 479 if( !CKEDITOR.env.quirks ) 480 { 481 for( var i = 0 ; i < 2 ; i++ ) 482 { 483 var side = revisement[ i ]; 484 // Justification for content-box-model. 485 if ( side ) 486 { 487 // Todo: Converting the style to pix-based unit. 488 style -= parseInt( this.getComputedStyle( 'padding' + side ) ) || 0; 489 style -= parseInt( this.getComputedStyle( 'border' + side ) ) || 0; 490 } 491 } 492 493 } 494 style += 'px'; 495 } 496 497 return style; 498 } 499 } )() 464 500 : 465 501 function( propertyName ) 466 502 { -
_source/plugins/dialog/plugin.js
489 489 { 490 490 return function( width, height ) 491 491 { 492 if ( this._.contentSize && this._.contentSize.width == width && this._.contentSize.height == height )493 return;494 492 495 493 CKEDITOR.dialog.fire( 'resize', 496 494 { … … 500 498 height : height 501 499 }, this._.editor ); 502 500 503 this._.contentSize = { width : width, height : height };504 501 this._.updateSize = true; 505 502 }; 506 503 })(), … … 516 513 if ( !this._.updateSize ) 517 514 return this._.size; 518 515 var element = this._.element.getFirst(); 519 var size = this._.size = { width : element.$.offsetWidth || 0, height : element.$.offsetHeight || 0}; 516 var size = this._.size = 517 { width : parseInt( element.getComputedStyle( 'width' ) ), 518 height : parseInt( element.getComputedStyle( 'height' ) ) }; 520 519 521 520 // If either the offsetWidth or offsetHeight is 0, the element isn't visible. 522 521 this._.updateSize = !size.width || !size.height; … … 603 602 } 604 603 605 604 606 // First, set the dialog to an appropriate size.607 this.resize( definition.minWidth, definition.minHeight );608 605 609 // Select the first tab by default.610 this.selectPage( this.definition.contents[0].id );611 612 606 // Reset all inputs back to their default value. 613 607 this.reset(); 614 608 … … 652 646 // Rearrange the dialog to the middle of the window. 653 647 CKEDITOR.tools.setTimeout( function() 654 648 { 649 // Save the initial values of the dialog. 650 this.foreach( function( contentObj ) { contentObj.setInitValue && contentObj.setInitValue(); } ); 651 652 // Select the first tab by default. 653 this.selectPage( this.definition.contents[0].id ); 654 655 655 var viewSize = CKEDITOR.document.getWindow().getViewPaneSize(); 656 656 var dialogSize = this.getSize(); 657 657 … … 664 664 // Execute onLoad for the first show. 665 665 this.fireOnce( 'load', {} ); 666 666 this.fire( 'show', {} ); 667 668 // Save the initial values of the dialog.669 this.foreach( function( contentObj ) { contentObj.setInitValue && contentObj.setInitValue(); } );670 671 667 }, 672 668 100, this ); 673 669 }, … … 876 872 selected[1].show(); 877 873 this._.currentTabId = id; 878 874 this._.currentTabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, id ); 875 876 this.resize( this.definition.minWidth, this.definition.minHeight ); 879 877 }, 880 878 881 879 /** -
_source/skins/kama/skin.js
216 216 if ( data.skin != 'kama' ) 217 217 return; 218 218 219 // Make the dialog area size fitable for contents with any size while 220 // preserve the defined minimum size.(#3878 and #4174) 219 221 contents.setStyles( 220 ( CKEDITOR.env.ie || ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 ) ) ? // IE && FF2 221 { 222 width : width + 'px', 223 height : height + 'px' 224 } 222 // Only IE6 has no support for min-width/height, but in IE7 we're inside 223 // a fixed-positioned element where this style is broken too. 224 ( CKEDITOR.env.ie6Compat || CKEDITOR.env.ie7Compat ) ? 225 ( function () 226 { 227 // Reveal the real element size. 228 contents.setStyles( { height: 'auto', width : 'auto' } ); 229 return { 230 width : width >= parseInt( contents.getComputedStyle( 'width' ) ) ? width + 'px' : 'auto', 231 height : height >= parseInt( contents.getComputedStyle( 'height' ) ) ? height + 'px' : 'auto' 232 }; 233 234 } )() 225 235 : 226 236 { 227 237 // To avoid having scrollbars in the dialogs, we're