Ticket #7114: 7114.patch
File 7114.patch, 6.3 KB (added by , 12 years ago) |
---|
-
_source/lang/en.js
606 606 toolbar : 'IFrame', 607 607 noUrl : 'Please type the iframe URL', 608 608 scrolling : 'Enable scrollbars', 609 border : 'Show frame border' 609 border : 'Show frame border', 610 widthPx : 'pixels', 611 widthPc : 'percent', 612 widthUnit : 'width unit' 610 613 }, 611 614 612 615 font : -
_source/plugins/fakeobjects/plugin.js
25 25 if ( style ) 26 26 { 27 27 // Get the width from the style. 28 var match = /(?:^|\s)width\s*:\s*(\d+)/i.exec( style ),29 width = match && match[1];28 var matchWidth = /(?:^|\s)width\s*:\s*(\d+)(%)?/i.exec( style ), 29 width = matchWidth && matchWidth[1]; 30 30 31 31 // Get the height from the style. 32 match = /(?:^|\s)height\s*:\s*(\d+)/i.exec( style );33 var height = match && match[1];32 var matchHeight = /(?:^|\s)height\s*:\s*(\d+)(%)?/i.exec( style ), 33 height = matchHeight && matchHeight[1]; 34 34 35 35 if ( width ) 36 realElement.attributes.width = width ;36 realElement.attributes.width = width + ( matchWidth[ 2 ] || '' ); 37 37 38 38 if ( height ) 39 realElement.attributes.height = height ;39 realElement.attributes.height = height + ( matchHeight[ 2 ] || '' ); 40 40 } 41 41 } 42 42 -
_source/plugins/iframe/dialogs/iframe.js
11 11 { 12 12 scrolling : { 'true' : 'yes', 'false' : 'no' }, 13 13 frameborder : { 'true' : '1', 'false' : '0' } 14 }; 14 }, 15 widthPattern = /^(\d+(?:\.\d+)?)(px|%)$/; 15 16 16 17 function loadValue( iframeNode ) 17 18 { … … 26 27 } 27 28 } 28 29 29 function commitValue( iframeNode )30 function commitValue( iframeNode, value ) 30 31 { 31 32 var isRemove = this.getValue() === '', 32 isCheckbox = this instanceof CKEDITOR.ui.dialog.checkbox, 33 value = this.getValue(); 33 isCheckbox = this instanceof CKEDITOR.ui.dialog.checkbox; 34 value = typeof value == 'string' ? value : this.getValue(); 35 34 36 if ( isRemove ) 35 37 iframeNode.removeAttribute( this.att || this.id ); 36 38 else if ( isCheckbox ) … … 46 48 dialogadvtab = editor.plugins.dialogadvtab; 47 49 return { 48 50 title : iframeLang.title, 49 minWidth : 350,51 minWidth : 400, 50 52 minHeight : 260, 51 53 onShow : function() 52 54 { … … 115 117 }, 116 118 { 117 119 type : 'hbox', 120 padding : 1, 118 121 children : 119 122 [ 120 123 { 121 124 id : 'width', 122 125 type : 'text', 123 style : 'width:100%',124 126 labelLayout : 'vertical', 125 127 label : commonLang.width, 126 128 validate : CKEDITOR.dialog.validate.integer( commonLang.invalidWidth ), 129 130 // Extra labelling of width unit type. 131 onLoad : function() 132 { 133 var labelElement = this.getDialog().getContentElement( 'info', 'widthType' ).getElement(), 134 inputElement = this.getInputElement(), 135 ariaLabelledByAttr = inputElement.getAttribute( 'aria-labelledby' ); 136 137 inputElement.setAttribute( 'aria-labelledby', [ ariaLabelledByAttr, labelElement.$.id ].join( ' ' ) ); 138 }, 127 139 setup : function( iframeNode, fakeImage ) 128 140 { 129 141 loadValue.apply( this, arguments ); 130 142 if ( fakeImage ) 131 143 { 132 var fakeImageWidth = parseInt( fakeImage.$.style.width, 10 ); 133 if ( !isNaN( fakeImageWidth ) ) 134 this.setValue( fakeImageWidth ); 144 var widthMatch = widthPattern.exec( fakeImage.$.style.width ); 145 if ( widthMatch ) 146 { 147 this.setValue( widthMatch[ 1 ] ); 148 var type = this.getDialog().getContentElement( 'info', 'widthType' ); 149 type && type.setValue( widthMatch[ 2 ] == '%' ? 'percents' : 'pixels' ); 150 } 135 151 } 136 152 }, 137 153 commit : function( iframeNode, extraStyles ) 138 154 { 139 commitValue.apply( this, arguments ); 140 if ( this.getValue() ) 141 extraStyles.width = this.getValue() + 'px'; 155 var type = this.getDialog().getContentElement( 'info', 'widthType' ), 156 value = this.getValue(); 157 if ( value ) 158 { 159 var suffix = !type || type.getValue() == 'pixels' ? 'px' : '%'; 160 extraStyles.width = this.getValue() + suffix; 161 value += ( suffix == 'px' ? '' : '%' ); 162 } 163 commitValue.call( this, iframeNode, value ); 142 164 } 143 165 }, 144 166 { 167 id : 'widthType', 168 type : 'select', 169 label : iframeLang.widthUnit, 170 labelStyle: 'visibility:hidden', 171 'default' : 'pixels', 172 items : 173 [ 174 [ iframeLang.widthPx , 'pixels' ], 175 [ iframeLang.widthPc , 'percents' ] 176 ] 177 }, 178 { 145 179 id : 'height', 146 180 type : 'text', 147 style : 'width:100%',148 181 labelLayout : 'vertical', 149 182 label : commonLang.height, 150 183 validate : CKEDITOR.dialog.validate.integer( commonLang.invalidHeight ), 184 185 // Extra labelling of height unit type. 186 onLoad : function() 187 { 188 var labelElement = this.getDialog().getContentElement( 'info', 'heightType' ).getElement(), 189 inputElement = this.getInputElement(), 190 ariaLabelledByAttr = inputElement.getAttribute( 'aria-labelledby' ); 191 192 inputElement.setAttribute( 'aria-labelledby', [ ariaLabelledByAttr, labelElement.$.id ].join( ' ' ) ); 193 }, 151 194 setup : function( iframeNode, fakeImage ) 152 195 { 153 196 loadValue.apply( this, arguments ); … … 166 209 } 167 210 }, 168 211 { 212 id : 'heightType', 213 type : 'html', 214 html : '<div><br />' + iframeLang.widthPx + '</div>' 215 }, 216 { 169 217 id : 'align', 170 218 type : 'select', 171 219 'default' : '',