X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fplugins%2Fdiv%2Fdialogs%2Fdiv.js;h=e63bd4b880e2563fb147d1b900c0eb911c267a1c;hb=a272c66d841421f8bf933c16535bdcde1c4649fc;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..e63bd4b 100644 --- a/_source/plugins/div/dialogs/div.js +++ b/_source/plugins/div/dialogs/div.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. + * Copyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -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; } };