Changeset 7012
- Timestamp:
- 06/06/11 10:10:00 (2 years ago)
- Location:
- CKEditor/trunk/_source
- Files:
-
- 4 edited
-
core/tools.js (modified) (1 diff)
-
plugins/fakeobjects/plugin.js (modified) (1 diff)
-
plugins/iframe/dialogs/iframe.js (modified) (4 diffs)
-
plugins/pastefromword/filter/default.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CKEditor/trunk/_source/core/tools.js
r6979 r7012 688 688 689 689 /** 690 * Convert the specified CSS length value to the calculated pixel length inside this page. 691 * <strong>Note:</strong> Percentage based value is left intact. 692 * @param {String} cssLength CSS length value. 693 */ 694 convertToPx : ( function () 695 { 696 var calculator; 697 698 return function( cssLength ) 699 { 700 if ( !calculator ) 701 { 702 calculator = CKEDITOR.dom.element.createFromHtml( 703 '<div style="position:absolute;left:-9999px;' + 704 'top:-9999px;margin:0px;padding:0px;border:0px;"' + 705 '></div>', CKEDITOR.document ); 706 CKEDITOR.document.getBody().append( calculator ); 707 } 708 709 if ( !/%$/.test( cssLength ) ) 710 { 711 calculator.setStyle( 'width', cssLength ); 712 return calculator.$.clientWidth; 713 } 714 715 return cssLength; 716 }; 717 } )(), 718 719 /** 690 720 * String specified by {@param str} repeats {@param times} times. 691 721 * @param str -
CKEditor/trunk/_source/plugins/fakeobjects/plugin.js
r6979 r7012 34 34 35 35 if ( width ) 36 realElement.attributes.width = width;36 realElement.attributes.width = CKEDITOR.tools.convertToPx( width ); 37 37 38 38 if ( height ) 39 realElement.attributes.height = height;39 realElement.attributes.height = CKEDITOR.tools.convertToPx( height ); 40 40 } 41 41 } -
CKEditor/trunk/_source/plugins/iframe/dialogs/iframe.js
r7011 r7012 51 51 minWidth : 350, 52 52 minHeight : 260, 53 onLoad : function()54 {55 var dialog = this,56 styles = dialog.getContentElement( 'advanced', 'advStyles' );57 58 styles && styles.on( 'change', function()59 {60 // Synchronize width value.61 var width = this.getStyle( 'width', '' ),62 txtWidth = dialog.getContentElement( 'info', 'width' );63 64 txtWidth && txtWidth.setValue( width, true );65 66 // Synchronize height value.67 var height = this.getStyle( 'height', '' ),68 txtHeight = dialog.getContentElement( 'info', 'height' );69 70 txtHeight && txtHeight.setValue( height, true );71 });72 },73 53 onShow : function() 74 54 { … … 84 64 this.iframeNode = iframeNode; 85 65 86 this.setupContent( iframeNode , fakeImage);66 this.setupContent( iframeNode ); 87 67 } 88 89 // Call the onChange method for the widht and height fields so90 // they get reflected into the Advanced tab.91 var widthInput = this.getContentElement( 'info', 'width' ),92 heightInput = this.getContentElement( 'info', 'height' );93 widthInput && widthInput.onChange();94 heightInput && heightInput.onChange();95 68 }, 96 69 onOk : function() … … 165 138 var val = this.getValue(); 166 139 val && ( extraStyles.width = val ); 167 },168 onChange : function()169 {170 var styles = this.getDialog().getContentElement( 'advanced', 'advStyles' ),171 value = this.getValue();172 styles && styles.updateStyle( 'width', value );173 140 } 174 141 }, … … 191 158 var val = this.getValue(); 192 159 val && ( extraStyles.height = val ); 193 },194 onChange : function()195 {196 var styles = this.getDialog().getContentElement( 'advanced', 'advStyles' ),197 value = this.getValue();198 styles && styles.updateStyle( 'height', value );199 160 } 200 161 }, -
CKEditor/trunk/_source/plugins/pastefromword/filter/default.js
r7008 r7012 262 262 // Deal with component/short-hand form. 263 263 var values = margin.split( ' ' ); 264 margin = plugin.utils.convertToPx( values[ 3 ] || values[ 1 ] || values [ 0 ] ); 265 margin = parseInt( margin, 10 ); 264 margin = CKEDITOR.tools.convertToPx( values[ 3 ] || values[ 1 ] || values [ 0 ] ); 266 265 267 266 // Figure out the indent unit by checking the first time of incrementation. … … 311 310 }, 312 311 313 // Convert various length units to 'px' in ignorance of DPI.314 convertToPx : ( function ()315 {316 var calculator = CKEDITOR.dom.element.createFromHtml(317 '<div style="position:absolute;left:-9999px;' +318 'top:-9999px;margin:0px;padding:0px;border:0px;"' +319 '></div>', CKEDITOR.document );320 CKEDITOR.document.getBody().append( calculator );321 322 return function( cssLength )323 {324 if ( cssLengthRelativeUnit.test( cssLength ) )325 {326 calculator.setStyle( 'width', cssLength );327 return calculator.$.clientWidth + 'px';328 }329 330 return cssLength;331 };332 } )(),333 334 312 // Providing a shorthand style then retrieve one or more style component values. 335 313 getStyleComponents : ( function() … … 414 392 { 415 393 var margin = val.split( ' ' )[ 1 ].match( cssLengthRelativeUnit ); 416 margin && ( previousListItemMargin = parseInt( plugin.utils.convertToPx( margin[ 0 ] ), 10) );394 margin && ( previousListItemMargin = CKEDITOR.tools.convertToPx( margin[ 0 ] ) ); 417 395 } ], 418 396 ( level == 1 ? [ 'mso-list', null, function( val ) … … 779 757 containsNothingButSpaces = this.utils.isContainingOnlySpaces, 780 758 resolveListItem = this.utils.resolveList, 781 convertToPx = this.utils.convertToPx, 759 convertToPx = function( value ) 760 { 761 value = CKEDITOR.tools.convertToPx( value ); 762 return isNaN( value ) ? value : value + 'px'; 763 }, 782 764 getStyleComponents = this.utils.getStyleComponents, 783 765 listDtdParents = this.utils.listDtdParents,
Note: See TracChangeset
for help on using the changeset viewer.
