Ticket #6107: 6107_5.patch
File 6107_5.patch, 5.6 KB (added by , 14 years ago) |
---|
-
_source/plugins/stylescombo/plugin.js
106 106 107 107 var elementPath = new CKEDITOR.dom.elementPath( selection.getStartElement() ); 108 108 109 if ( style.type == CKEDITOR.STYLE_INLINE && style.checkActive( elementPath ) ) 110 style.remove( editor.document ); 111 else if ( style.type == CKEDITOR.STYLE_OBJECT && style.checkActive( elementPath ) ) 112 style.remove( editor.document ); 113 else 114 style.apply( editor.document ); 109 style[ style.checkActive( elementPath ) ? 'remove' : 'apply' ]( editor.document ); 115 110 116 111 editor.fire( 'saveSnapshot' ); 117 112 }, -
_source/plugins/format/plugin.js
54 54 editor.focus(); 55 55 editor.fire( 'saveSnapshot' ); 56 56 57 styles[ value ].apply( editor.document ); 57 var style = styles[ value ], 58 elementPath = new CKEDITOR.dom.elementPath( editor.getSelection().getStartElement() ); 58 59 60 style[ style.checkActive( elementPath ) ? 'remove' : 'apply' ]( editor.document ); 61 59 62 // Save the undo snapshot after all changes are affected. (#4899) 60 63 setTimeout( function() 61 64 { -
_source/core/dom/walker.js
345 345 || nodeNameMatches[ this.getName() ]; 346 346 }; 347 347 348 CKEDITOR.dom.walker.blockBoundary = function( customNodeNames )348 CKEDITOR.dom.walker.blockBoundary = function( customNodeNames, isReject ) 349 349 { 350 350 return function( node , type ) 351 351 { 352 return ! ( node.type == CKEDITOR.NODE_ELEMENT353 && node.isBlockBoundary( customNodeNames ) ) ;352 return !! ( isReject ^ ( node.type == CKEDITOR.NODE_ELEMENT 353 && node.isBlockBoundary( customNodeNames ) ) ); 354 354 }; 355 355 }; 356 356 357 CKEDITOR.dom.walker.listItemBoundary = function( )357 CKEDITOR.dom.walker.listItemBoundary = function( isReject ) 358 358 { 359 return this.blockBoundary( { br : 1 });359 return this.blockBoundary( { br : 1 }, isReject ); 360 360 }; 361 361 362 362 /** -
_source/plugins/styles/plugin.js
149 149 return ( this.removeFromRange = 150 150 this.type == CKEDITOR.STYLE_INLINE ? 151 151 removeInlineStyle 152 : this.type == CKEDITOR.STYLE_BLOCK ? 153 removeBlockStyle 152 154 : this.type == CKEDITOR.STYLE_OBJECT ? 153 155 removeObjectStyle 154 156 : null ).call( this, range ); … … 881 883 range.moveToBookmark( bookmark ); 882 884 } 883 885 886 function removeBlockStyle( range ) 887 { 888 // Serializible bookmarks is needed here since 889 // elements may be merged. 890 var bookmark = range.createBookmark( 1 ); 891 892 var iterator = range.createIterator(); 893 iterator.enforceRealBlocks = true; 894 iterator.enlargeBr = this._.enterMode != CKEDITOR.ENTER_BR; 895 896 var block; 897 while ( ( block = iterator.getNextParagraph() ) ) 898 this.checkElementRemovable( block ) && removeFromElement( this, block, 1 ); 899 900 range.moveToBookmark( bookmark ); 901 } 902 884 903 // Replace the original block with new one, with special treatment 885 904 // for <pre> blocks to make sure content format is well preserved, and merging/splitting adjacent 886 905 // when necessary.(#3188) … … 1090 1109 element.removeStyle( styleName ); 1091 1110 } 1092 1111 1093 removeEmpty && removeNoAttribsElement( element ); 1094 } 1112 if ( removeEmpty ) 1113 { 1114 CKEDITOR.dtd.$block[ element.getName() ] ? 1115 ( style._.enterMode == CKEDITOR.ENTER_BR ? 1116 blockToBrs( element ) : 1117 element.renameNode( style._.enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ) 1118 : removeNoAttribsElement( element ); 1119 } 1120 } 1095 1121 1096 1122 // Removes a style from inside an element. 1097 1123 function removeFromInsideElement( style, element ) … … 1186 1212 } 1187 1213 } 1188 1214 1215 var nonWhitespaces = CKEDITOR.dom.walker.whitespaces( 1 ); 1216 function blockToBrs( block ) 1217 { 1218 var previous = block.getPrevious( nonWhitespaces ), 1219 next = block.getNext( nonWhitespaces ); 1220 1221 if ( previous && ( previous.type == CKEDITOR.NODE_TEXT || !previous.isBlockBoundary( { br : 1 } ) ) ) 1222 block.append( 'br', 1 ); 1223 if ( next && ( next.type == CKEDITOR.NODE_TEXT || !next.isBlockBoundary( { br : 1 } ) ) ) 1224 block.append( 'br' ); 1225 1226 block.remove( 1 ); 1227 } 1228 1189 1229 function getElement( style, targetDocument, element ) 1190 1230 { 1191 1231 var el; … … 1436 1476 1437 1477 var iterator = ranges.createIterator(); 1438 1478 while ( ( range = iterator.getNextRange() ) ) 1439 {1440 1479 func.call( this, range ); 1441 }1442 1480 1443 1481 selection.selectRanges( ranges ); 1444 1482 -
_source/core/dom/range.js
1187 1187 blockBoundary, // The node on which the enlarging should stop. 1188 1188 tailBr, // In case BR as block boundary. 1189 1189 notBlockBoundary = CKEDITOR.dom.walker.blockBoundary( 1190 ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ? { br : 1 } : null ),1190 ( unit == CKEDITOR.ENLARGE_LIST_ITEM_CONTENTS ) ? { br : 1 } : null, 1 ), 1191 1191 // Record the encountered 'blockBoundary' for later use. 1192 1192 boundaryGuard = function( node ) 1193 1193 {