|
73 | 73 | // Read the dialog fields values from the specified
|
74 | 74 | // element attributes.
|
75 | 75 | field.setup = function( element ) {
|
76 |
| - field.setValue( element.getAttribute( field.id ) || '' ); |
| 76 | + field.setValue( element.getAttribute( field.id ) || '', 1 ); |
77 | 77 | };
|
78 | 78 | }
|
79 | 79 | if ( !field.commit ) {
|
|
256 | 256 | [ editor.lang.common.notSet, '' ]
|
257 | 257 | ],
|
258 | 258 | onChange: function() {
|
259 |
| - commitInternally.call( this, [ 'info:class', 'advanced:dir', 'advanced:style' ] ); |
| 259 | + commitInternally.call( this, [ 'info:elementStyle', 'info:class', 'advanced:dir', 'advanced:style' ] ); |
260 | 260 | },
|
261 | 261 | setup: function( element ) {
|
262 | 262 | for ( var name in styles )
|
263 |
| - styles[ name ].checkElementRemovable( element, true ) && this.setValue( name ); |
| 263 | + styles[ name ].checkElementRemovable( element, true ) && this.setValue( name, 1 ); |
264 | 264 | },
|
265 | 265 | commit: function( element ) {
|
266 | 266 | var styleName;
|
267 | 267 | if ( ( styleName = this.getValue() ) ) {
|
268 | 268 | var style = styles[ styleName ];
|
269 |
| - var customData = element.getCustomData( 'elementStyle' ) || ''; |
270 |
| - |
271 | 269 | style.applyToObject( element );
|
272 |
| - element.setCustomData( 'elementStyle', customData + style._.definition.attributes.style ); |
273 | 270 | }
|
| 271 | + else |
| 272 | + element.removeAttribute( 'style' ); |
274 | 273 | }
|
275 | 274 | },
|
276 | 275 | {
|
|
320 | 319 | label: editor.lang.common.cssStyle,
|
321 | 320 | 'default': '',
|
322 | 321 | commit: function( element ) {
|
323 |
| - // Merge with 'elementStyle', which is of higher priority. |
324 |
| - var merged = this.getValue() + ( element.getCustomData( 'elementStyle' ) || '' ); |
325 |
| - element.setAttribute( 'style', merged ); |
| 322 | + element.setAttribute( 'style', this.getValue() ); |
326 | 323 | }
|
327 | 324 | }
|
328 | 325 | ]
|
|
392 | 389 | // it if no options are available at all.
|
393 | 390 | stylesField[ stylesField.items.length > 1 ? 'enable' : 'disable' ]();
|
394 | 391 |
|
395 |
| - // Now setup the field value manually. |
| 392 | + // Now setup the field value manually if dialog was opened on element. (#9689) |
396 | 393 | setTimeout( function() {
|
397 |
| - stylesField.setup( dialog._element ); |
| 394 | + dialog._element && stylesField.setup( dialog._element ); |
398 | 395 | }, 0 );
|
399 | 396 | });
|
400 | 397 | },
|
|
0 commit comments