X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fstyles%2Fplugin.js;h=2c16b7e6716096104d81c4658df10dcda2969eda;hp=1d822d1f55eaa34b81bb03f553645d260e852969;hb=2f22c0c38f17e75be5541089076885442aaa2377;hpb=e73319a12b56100b29ef456fd74114fe5519e01c diff --git a/_source/plugins/styles/plugin.js b/_source/plugins/styles/plugin.js index 1d822d1..2c16b7e 100644 --- a/_source/plugins/styles/plugin.js +++ b/_source/plugins/styles/plugin.js @@ -1,5 +1,5 @@ /* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ @@ -1132,8 +1132,9 @@ CKEDITOR.STYLE_OBJECT = 3; function removeFromElement( style, element ) { var def = style._.definition, - attributes = CKEDITOR.tools.extend( {}, def.attributes, getOverrides( style )[ element.getName() ] ), + attributes = def.attributes, styles = def.styles, + overrides = getOverrides( style )[ element.getName() ], // If the style is only about the element itself, we have to remove the element. removeEmpty = CKEDITOR.tools.isEmpty( attributes ) && CKEDITOR.tools.isEmpty( styles ); @@ -1159,6 +1160,9 @@ CKEDITOR.STYLE_OBJECT = 3; element.removeStyle( styleName ); } + // Remove overrides, but don't remove the element if it's a block element + removeOverrides( element, overrides, blockElements[ element.getName() ] ) ; + if ( removeEmpty ) { !CKEDITOR.dtd.$block[ element.getName() ] || style._.enterMode == CKEDITOR.ENTER_BR && !element.hasAttributes() ? @@ -1200,8 +1204,9 @@ CKEDITOR.STYLE_OBJECT = 3; * Note: Remove the element if no attributes remain. * @param {Object} element * @param {Object} overrides + * @param {Boolean} Don't remove the element */ - function removeOverrides( element, overrides ) + function removeOverrides( element, overrides, dontRemove ) { var attributes = overrides && overrides.attributes ; @@ -1229,7 +1234,8 @@ CKEDITOR.STYLE_OBJECT = 3; } } - removeNoAttribsElement( element ); + if ( !dontRemove ) + removeNoAttribsElement( element ); } // If the element has no more attributes, remove it.