Ticket #5462: 5462_2.patch
File 5462_2.patch, 2.2 KB (added by , 13 years ago) |
---|
-
_source/plugins/styles/plugin.js
141 141 }, 142 142 143 143 // Removes any conflicting styles from within the specified range.. 144 removeConflictsFromRange : function ( range )144 removeConflictsFromRange : function ( range, nodeToPreserve ) 145 145 { 146 146 var style = this, 147 148 149 147 overrides = getOverrides( style ), 148 styleCandidates = [], 149 overrideCandidates = []; 150 150 151 151 var walker = new CKEDITOR.dom.walker( range ); 152 152 walker.evaluator = function( node ) 153 153 { 154 if ( node.type == CKEDITOR.NODE_ELEMENT )154 if ( node.type == CKEDITOR.NODE_ELEMENT && ( !nodeToPreserve || !node.equals( nodeToPreserve ) ) ) 155 155 { 156 156 if ( node.is( style.element ) ) 157 157 styleCandidates.push( node ); 158 158 159 if ( node.getName() in overrides ) 159 160 overrideCandidates.push( node ); 160 161 } … … 408 409 range.enlarge( CKEDITOR.ENLARGE_ELEMENT ); 409 410 range.trim(); 410 411 411 // Remove all style conflictions within the range,412 // e.g. style="color:red" is conflicting with style="color:blue".413 var enlargedBookmark = range.createBookmark();414 this.removeConflictsFromRange( range );415 range.moveToBookmark( enlargedBookmark );416 417 412 // Get the first node to be processed and the last, which concludes the 418 413 // processing. 419 414 var boundaryNodes = range.getBoundaryNodes(); … … 579 574 styleRange.extractContents().appendTo( styleNode ); 580 575 581 576 // Insert it into the range position (it is collapsed after 582 // extractContents .577 // extractContents). 583 578 styleRange.insertNode( styleNode ); 584 579 580 // Remove all style conflicts within the range, including 581 // parents boundaries touched by styleNode. 582 styleRange.enlarge( CKEDITOR.ENLARGE_ELEMENT ); 583 this.removeConflictsFromRange( styleRange, styleNode ); 584 585 585 // Let's merge our new style with its neighbors, if possible. 586 586 mergeSiblings( styleNode ); 587 587