Skip to content

Commit

Permalink
Merge branch 't/9689'
Browse files Browse the repository at this point in the history
  • Loading branch information
Reinmar committed Nov 21, 2012
2 parents 8cc6dab + cdd0a0a commit 4f213b5
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions plugins/div/dialogs/div.js
Expand Up @@ -73,7 +73,7 @@
// Read the dialog fields values from the specified
// element attributes.
field.setup = function( element ) {
field.setValue( element.getAttribute( field.id ) || '' );
field.setValue( element.getAttribute( field.id ) || '', 1 );
};
}
if ( !field.commit ) {
Expand Down Expand Up @@ -256,21 +256,20 @@
[ editor.lang.common.notSet, '' ]
],
onChange: function() {
commitInternally.call( this, [ 'info:class', 'advanced:dir', 'advanced:style' ] );
commitInternally.call( this, [ 'info:elementStyle', 'info:class', 'advanced:dir', 'advanced:style' ] );
},
setup: function( element ) {
for ( var name in styles )
styles[ name ].checkElementRemovable( element, true ) && this.setValue( name );
styles[ name ].checkElementRemovable( element, true ) && this.setValue( name, 1 );
},
commit: function( element ) {
var styleName;
if ( ( styleName = this.getValue() ) ) {
var style = styles[ styleName ];
var customData = element.getCustomData( 'elementStyle' ) || '';

style.applyToObject( element );
element.setCustomData( 'elementStyle', customData + style._.definition.attributes.style );
}
else
element.removeAttribute( 'style' );
}
},
{
Expand Down Expand Up @@ -320,9 +319,7 @@
label: editor.lang.common.cssStyle,
'default': '',
commit: function( element ) {
// Merge with 'elementStyle', which is of higher priority.
var merged = this.getValue() + ( element.getCustomData( 'elementStyle' ) || '' );
element.setAttribute( 'style', merged );
element.setAttribute( 'style', this.getValue() );
}
}
]
Expand Down Expand Up @@ -392,9 +389,9 @@
// it if no options are available at all.
stylesField[ stylesField.items.length > 1 ? 'enable' : 'disable' ]();

// Now setup the field value manually.
// Now setup the field value manually if dialog was opened on element. (#9689)
setTimeout( function() {
stylesField.setup( dialog._element );
dialog._element && stylesField.setup( dialog._element );
}, 0 );
});
},
Expand Down

0 comments on commit 4f213b5

Please sign in to comment.