Skip to content

Commit 4f213b5

Browse files
committed
Merge branch 't/9689'
2 parents 8cc6dab + cdd0a0a commit 4f213b5

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

plugins/div/dialogs/div.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
// Read the dialog fields values from the specified
7474
// element attributes.
7575
field.setup = function( element ) {
76-
field.setValue( element.getAttribute( field.id ) || '' );
76+
field.setValue( element.getAttribute( field.id ) || '', 1 );
7777
};
7878
}
7979
if ( !field.commit ) {
@@ -256,21 +256,20 @@
256256
[ editor.lang.common.notSet, '' ]
257257
],
258258
onChange: function() {
259-
commitInternally.call( this, [ 'info:class', 'advanced:dir', 'advanced:style' ] );
259+
commitInternally.call( this, [ 'info:elementStyle', 'info:class', 'advanced:dir', 'advanced:style' ] );
260260
},
261261
setup: function( element ) {
262262
for ( var name in styles )
263-
styles[ name ].checkElementRemovable( element, true ) && this.setValue( name );
263+
styles[ name ].checkElementRemovable( element, true ) && this.setValue( name, 1 );
264264
},
265265
commit: function( element ) {
266266
var styleName;
267267
if ( ( styleName = this.getValue() ) ) {
268268
var style = styles[ styleName ];
269-
var customData = element.getCustomData( 'elementStyle' ) || '';
270-
271269
style.applyToObject( element );
272-
element.setCustomData( 'elementStyle', customData + style._.definition.attributes.style );
273270
}
271+
else
272+
element.removeAttribute( 'style' );
274273
}
275274
},
276275
{
@@ -320,9 +319,7 @@
320319
label: editor.lang.common.cssStyle,
321320
'default': '',
322321
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() );
326323
}
327324
}
328325
]
@@ -392,9 +389,9 @@
392389
// it if no options are available at all.
393390
stylesField[ stylesField.items.length > 1 ? 'enable' : 'disable' ]();
394391

395-
// Now setup the field value manually.
392+
// Now setup the field value manually if dialog was opened on element. (#9689)
396393
setTimeout( function() {
397-
stylesField.setup( dialog._element );
394+
dialog._element && stylesField.setup( dialog._element );
398395
}, 0 );
399396
});
400397
},

0 commit comments

Comments
 (0)