X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fplugins%2Fstyles%2Fplugin.js;h=1d822d1f55eaa34b81bb03f553645d260e852969;hp=0850a66bbdd111b59762200c982b5a394a1969e7;hb=e73319a12b56100b29ef456fd74114fe5519e01c;hpb=f0610347140239143439a511ee2bd48cb784f470 diff --git a/_source/plugins/styles/plugin.js b/_source/plugins/styles/plugin.js index 0850a66..1d822d1 100644 --- a/_source/plugins/styles/plugin.js +++ b/_source/plugins/styles/plugin.js @@ -222,11 +222,12 @@ CKEDITOR.STYLE_OBJECT = 3; // current style definition. checkElementRemovable : function( element, fullMatch ) { - if ( !element || element.isReadOnly() ) + var def = this._.definition; + + if ( !element || !def.ignoreReadonly && element.isReadOnly() ) return false; - var def = this._.definition, - attribs, + var attribs, name = element.getName(); // If the element name is the same as the style name. @@ -423,7 +424,8 @@ CKEDITOR.STYLE_OBJECT = 3; var isUnknownElement; // Indicates that fully selected read-only elements are to be included in the styling range. - var includeReadonly = def.includeReadonly; + var ignoreReadonly = def.ignoreReadonly, + includeReadonly = ignoreReadonly || def.includeReadonly; // If the read-only inclusion is not available in the definition, try // to get it from the document data. @@ -447,19 +449,22 @@ CKEDITOR.STYLE_OBJECT = 3; var styleRange; - // Check if the boundaries are inside non stylable elements. - var firstUnstylable = getUnstylableParent( firstNode ), - lastUnstylable = getUnstylableParent( lastNode ); - - // If the first element can't be styled, we'll start processing right - // after its unstylable root. - if ( firstUnstylable ) - currentNode = firstUnstylable.getNextSourceNode( true ); - - // If the last element can't be styled, we'll stop processing on its - // unstylable root. - if ( lastUnstylable ) - lastNode = lastUnstylable; + if ( !ignoreReadonly ) + { + // Check if the boundaries are inside non stylable elements. + var firstUnstylable = getUnstylableParent( firstNode ), + lastUnstylable = getUnstylableParent( lastNode ); + + // If the first element can't be styled, we'll start processing right + // after its unstylable root. + if ( firstUnstylable ) + currentNode = firstUnstylable.getNextSourceNode( true ); + + // If the last element can't be styled, we'll stop processing on its + // unstylable root. + if ( lastUnstylable ) + lastNode = lastUnstylable; + } // Do nothing if the current node now follows the last node to be processed. if ( currentNode.getPosition( lastNode ) == CKEDITOR.POSITION_FOLLOWING ) @@ -786,7 +791,7 @@ CKEDITOR.STYLE_OBJECT = 3; breakNodes(); // Now, do the DFS walk. - var currentNode = startNode.getNext(); + var currentNode = startNode; while ( !currentNode.equals( endNode ) ) { /* @@ -839,7 +844,6 @@ CKEDITOR.STYLE_OBJECT = 3; var style = this, def = style._.definition, attributes = def.attributes; - var styles = CKEDITOR.style.getStyleText( def ); // Remove all defined attributes. if ( attributes )