132 | | var fakeImageWidth = parseInt( fakeImage.$.style.width, 10 ); |
133 | | if ( !isNaN( fakeImageWidth ) ) |
134 | | this.setValue( fakeImageWidth ); |
135 | | } |
136 | | }, |
137 | | commit : function( iframeNode, extraStyles ) |
138 | | { |
139 | | commitValue.apply( this, arguments ); |
140 | | if ( this.getValue() ) |
141 | | extraStyles.width = this.getValue() + 'px'; |
142 | | } |
143 | | }, |
144 | | { |
145 | | id : 'height', |
146 | | type : 'text', |
147 | | style : 'width:100%', |
148 | | labelLayout : 'vertical', |
149 | | label : commonLang.height, |
150 | | validate : CKEDITOR.dialog.validate.integer( commonLang.invalidHeight ), |
151 | | setup : function( iframeNode, fakeImage ) |
152 | | { |
153 | | loadValue.apply( this, arguments ); |
154 | | if ( fakeImage ) |
| 128 | type : 'hbox', |
| 129 | padding : 1, |
| 130 | children : |
| 131 | [ |
| 132 | { |
| 133 | id : 'width', |
| 134 | type : 'text', |
| 135 | labelLayout : 'vertical', |
| 136 | label : commonLang.width, |
| 137 | validate : CKEDITOR.dialog.validate.integer( commonLang.invalidWidth ), |
| 138 | |
| 139 | // Extra labelling of width unit type. |
| 140 | onLoad : function() |
| 141 | { |
| 142 | var labelElement = this.getDialog().getContentElement( 'info', 'widthType' ).getElement(), |
| 143 | inputElement = this.getInputElement(), |
| 144 | ariaLabelledByAttr = inputElement.getAttribute( 'aria-labelledby' ); |
| 145 | |
| 146 | inputElement.setAttribute( 'aria-labelledby', [ ariaLabelledByAttr, labelElement.$.id ].join( ' ' ) ); |
| 147 | }, |
| 148 | setup : function( iframeNode, fakeImage ) |
| 149 | { |
| 150 | loadValue.apply( this, arguments ); |
| 151 | if ( fakeImage ) |
| 152 | { |
| 153 | var widthMatch = widthPattern.exec( fakeImage.$.style.width ); |
| 154 | if ( widthMatch ) |
| 155 | { |
| 156 | this.setValue( widthMatch[ 1 ] ); |
| 157 | var type = this.getDialog().getContentElement( 'info', 'widthType' ); |
| 158 | type && type.setValue( widthMatch[ 2 ] == '%' ? 'percents' : 'pixels' ); |
| 159 | } |
| 160 | } |
| 161 | }, |
| 162 | commit : function( iframeNode, extraStyles ) |
| 163 | { |
| 164 | var type = this.getDialog().getContentElement( 'info', 'widthType' ), |
| 165 | value = this.getValue(); |
| 166 | if ( value ) |
| 167 | { |
| 168 | var suffix = !type || type.getValue() == 'pixels' ? 'px' : '%'; |
| 169 | extraStyles.width = this.getValue() + suffix; |
| 170 | value += ( suffix == 'px' ? '' : '%' ); |
| 171 | } |
| 172 | commitValue.call( this, iframeNode, value ); |
| 173 | } |
| 174 | }, |
| 175 | { |
| 176 | id : 'widthType', |
| 177 | type : 'select', |
| 178 | label : iframeLang.widthUnit, |
| 179 | labelStyle: 'visibility:hidden', |
| 180 | 'default' : 'pixels', |
| 181 | items : |
| 182 | [ |
| 183 | [ iframeLang.widthPx , 'pixels' ], |
| 184 | [ iframeLang.widthPc , 'percents' ] |
| 185 | ] |
| 186 | } |
| 187 | ] |
| 188 | }, |
156 | | var fakeImageHeight = parseInt( fakeImage.$.style.height, 10 ); |
157 | | if ( !isNaN( fakeImageHeight ) ) |
158 | | this.setValue( fakeImageHeight ); |
| 190 | type : 'hbox', |
| 191 | padding : 1, |
| 192 | children : |
| 193 | [ |
| 194 | { |
| 195 | id : 'height', |
| 196 | type : 'text', |
| 197 | labelLayout : 'vertical', |
| 198 | label : commonLang.height, |
| 199 | validate : CKEDITOR.dialog.validate.integer( commonLang.invalidHeight ), |
| 200 | |
| 201 | // Extra labelling of height unit type. |
| 202 | onLoad : function() |
| 203 | { |
| 204 | var labelElement = this.getDialog().getContentElement( 'info', 'heightType' ).getElement(), |
| 205 | inputElement = this.getInputElement(), |
| 206 | ariaLabelledByAttr = inputElement.getAttribute( 'aria-labelledby' ); |
| 207 | |
| 208 | inputElement.setAttribute( 'aria-labelledby', [ ariaLabelledByAttr, labelElement.$.id ].join( ' ' ) ); |
| 209 | }, |
| 210 | setup : function( iframeNode, fakeImage ) |
| 211 | { |
| 212 | loadValue.apply( this, arguments ); |
| 213 | if ( fakeImage ) |
| 214 | { |
| 215 | var fakeImageHeight = parseInt( fakeImage.$.style.height, 10 ); |
| 216 | if ( !isNaN( fakeImageHeight ) ) |
| 217 | this.setValue( fakeImageHeight ); |
| 218 | } |
| 219 | }, |
| 220 | commit : function( iframeNode, extraStyles ) |
| 221 | { |
| 222 | commitValue.apply( this, arguments ); |
| 223 | if ( this.getValue() ) |
| 224 | extraStyles.height = this.getValue() + 'px'; |
| 225 | } |
| 226 | }, |
| 227 | { |
| 228 | id : 'heightType', |
| 229 | type : 'html', |
| 230 | html : '<div><br />' + iframeLang.widthPx + '</div>' |
| 231 | } |
| 232 | ] |