X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fdiv%2Fdialogs%2Fdiv.js;h=4b67ed26510aa0ac655bdecb1473f229dba71431;hb=039a051ccf3901311661022a30afd60fc38130c9;hp=2ef3900943ff301c133dbef54e8b72482f8ce3ca;hpb=055b6b0792ce7dc53d47af606b367c04b927c2ab;p=ckeditor.git diff --git a/_source/plugins/div/dialogs/div.js b/_source/plugins/div/dialogs/div.js index 2ef3900..4b67ed2 100644 --- a/_source/plugins/div/dialogs/div.js +++ b/_source/plugins/div/dialogs/div.js @@ -140,8 +140,8 @@ var containedBlocks = [], block; // Get all ranges from the selection. - var selection = editor.document.getSelection(); - var ranges = selection.getRanges(); + var selection = editor.document.getSelection(), + ranges = selection.getRanges(); var bookmarks = selection.createBookmarks(); var i, iterator; @@ -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 ); } } ] @@ -432,7 +437,7 @@ ], onLoad : function() { - setupFields.call(this); + setupFields.call( this ); // Preparing for the 'elementStyle' field. var dialog = this, @@ -503,6 +508,9 @@ }, onHide : function() { + // Remove style only when editing existing DIV. (#6315) + if ( command == 'editdiv' ) + this._element.removeCustomData( 'elementStyle' ); delete this._element; } };