X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fdiv%2Fdialogs%2Fdiv.js;h=cf865f71d8d4465848a81c5382e561b5a581fa9f;hb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7;hp=c1bfb8ff0c932d04ef66c7115d971792505dd878;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1;p=ckeditor.git diff --git a/_source/plugins/div/dialogs/div.js b/_source/plugins/div/dialogs/div.js index c1bfb8f..cf865f7 100644 --- a/_source/plugins/div/dialogs/div.js +++ b/_source/plugins/div/dialogs/div.js @@ -330,7 +330,13 @@ { var styleName; if ( ( styleName = this.getValue() ) ) - styles[ styleName ].applyToObject( element ); + { + var style = styles[ styleName ]; + var customData = element.getCustomData( 'elementStyle' ) || ''; + + style.applyToObject( element ); + element.setCustomData( 'elementStyle', customData + style._.definition.attributes.style ); + } } }, { @@ -386,9 +392,8 @@ commit : function( element ) { // Merge with 'elementStyle', which is of higher priority. - var value = this.getValue(), - merged = [ value, element.getAttribute( 'style' ) ].join( ';' ); - value && element.setAttribute( 'style', merged ); + var merged = this.getValue() + ( element.getCustomData( 'elementStyle' ) || '' ); + element.setAttribute( 'style', merged ); } } ] @@ -484,7 +489,6 @@ }, onOk : function() { - editor.fire( 'saveSnapshot' ); if ( command == 'editdiv' ) containers = [ this._element ]; else @@ -499,12 +503,14 @@ // Remove empty 'style' attribute. !containers[ i ].getAttribute( 'style' ) && containers[ i ].removeAttribute( 'style' ); } - editor.fire( 'saveSnapshot' ); this.hide(); }, onHide : function() { + // Remove style only when editing existing DIV. (#6315) + if ( command == 'editdiv' ) + this._element.removeCustomData( 'elementStyle' ); delete this._element; } };