Index: /CKEditor/trunk/CHANGES.html =================================================================== --- /CKEditor/trunk/CHANGES.html (revision 6287) +++ /CKEditor/trunk/CHANGES.html (revision 6288) @@ -40,5 +40,5 @@ New features:
Index: /CKEditor/trunk/_source/plugins/removeformat/plugin.js =================================================================== --- /CKEditor/trunk/_source/plugins/removeformat/plugin.js (revision 6287) +++ /CKEditor/trunk/_source/plugins/removeformat/plugin.js (revision 6288) @@ -42,15 +42,13 @@ while ( ( range = iterator.getNextRange() ) ) { - if ( range.collapsed ) - continue; - - range.enlarge( CKEDITOR.ENLARGE_ELEMENT ); + if ( ! range.collapsed ) + range.enlarge( CKEDITOR.ENLARGE_ELEMENT ); // Bookmark the range so we can re-select it after processing. - var bookmark = range.createBookmark(); - - // The style will be applied within the bookmark boundaries. - var startNode = bookmark.startNode, - endNode = bookmark.endNode; + var bookmark = range.createBookmark(), + // The style will be applied within the bookmark boundaries. + startNode = bookmark.startNode, + endNode = bookmark.endNode, + currentNode; // We need to check the selection boundaries (bookmark spans) to break @@ -82,35 +80,38 @@ breakParent( startNode ); - breakParent( endNode ); + if ( endNode ) + { + breakParent( endNode ); - // Navigate through all nodes between the bookmarks. - var currentNode = startNode.getNextSourceNode( true, CKEDITOR.NODE_ELEMENT ); + // Navigate through all nodes between the bookmarks. + currentNode = startNode.getNextSourceNode( true, CKEDITOR.NODE_ELEMENT ); - while ( currentNode ) - { - // If we have reached the end of the selection, stop looping. - if ( currentNode.equals( endNode ) ) - break; + while ( currentNode ) + { + // If we have reached the end of the selection, stop looping. + if ( currentNode.equals( endNode ) ) + break; - // Cache the next node to be processed. Do it now, because - // currentNode may be removed. - var nextNode = currentNode.getNextSourceNode( false, CKEDITOR.NODE_ELEMENT ); + // Cache the next node to be processed. Do it now, because + // currentNode may be removed. + var nextNode = currentNode.getNextSourceNode( false, CKEDITOR.NODE_ELEMENT ); - // This node must not be a fake element. - if ( !( currentNode.getName() == 'img' - && currentNode.data( 'cke-realelement' ) ) - && filter( editor, currentNode ) ) - { - // Remove elements nodes that match with this style rules. - if ( tagsRegex.test( currentNode.getName() ) ) - currentNode.remove( 1 ); - else + // This node must not be a fake element. + if ( !( currentNode.getName() == 'img' + && currentNode.data( 'cke-realelement' ) ) + && filter( editor, currentNode ) ) { - currentNode.removeAttributes( removeAttributes ); - editor.fire( 'removeFormatCleanup', currentNode ); + // Remove elements nodes that match with this style rules. + if ( tagsRegex.test( currentNode.getName() ) ) + currentNode.remove( 1 ); + else + { + currentNode.removeAttributes( removeAttributes ); + editor.fire( 'removeFormatCleanup', currentNode ); + } } + + currentNode = nextNode; } - - currentNode = nextNode; }