Ticket #6548: 6548.patch
File 6548.patch, 2.5 KB (added by , 13 years ago) |
---|
-
_source/plugins/indent/plugin.js
282 282 ranges = selection && selection.getRanges( 1 ), 283 283 range; 284 284 285 var skipBookmarks = CKEDITOR.dom.walker.bookmark( 0, 1 );286 285 287 286 var iterator = ranges.createIterator(); 288 287 while ( ( range = iterator.getNextRange() ) ) 289 288 { 290 // Do not indent body. (#6138) 291 range.shrink( CKEDITOR.SHRINK_ELEMENT ); 292 if ( range.endContainer.getName() == 'body' ) 293 range.setEndAt( range.endContainer.getLast( skipBookmarks ), CKEDITOR.POSITION_BEFORE_END ); 294 295 var startContainer = range.startContainer, 296 endContainer = range.endContainer, 297 rangeRoot = range.getCommonAncestor(), 289 var rangeRoot = range.getCommonAncestor(), 298 290 nearestListBlock = rangeRoot; 299 291 300 292 while ( nearestListBlock && !( nearestListBlock.type == CKEDITOR.NODE_ELEMENT && 301 293 listNodeNames[ nearestListBlock.getName() ] ) ) 302 294 nearestListBlock = nearestListBlock.getParent(); 303 295 296 // Avoid having selection enclose the entire list. (#6138) 297 // [<ul><li>...</li></ul>] =><ul><li>[...]</li></ul> 298 if ( !nearestListBlock ) 299 { 300 var selectedNode = range.getEnclosedNode(); 301 if ( selectedNode 302 && selectedNode.type == CKEDITOR.NODE_ELEMENT 303 && selectedNode.getName() in listNodeNames) 304 { 305 range.setStartAt( selectedNode, CKEDITOR.POSITION_AFTER_START ); 306 range.setEndAt( selectedNode, CKEDITOR.POSITION_BEFORE_END ); 307 nearestListBlock = selectedNode; 308 } 309 } 310 304 311 // Avoid selection anchors under list root. 305 312 // <ul>[<li>...</li>]</ul> => <ul><li>[...]</li></ul> 306 if ( nearestListBlock && startContainer.type == CKEDITOR.NODE_ELEMENT307 && startContainer.getName() in listNodeNames )313 if ( nearestListBlock && range.startContainer.type == CKEDITOR.NODE_ELEMENT 314 && range.startContainer.getName() in listNodeNames ) 308 315 { 309 316 var walker = new CKEDITOR.dom.walker( range ); 310 317 walker.evaluator = isListItem; 311 318 range.startContainer = walker.next(); 312 319 } 313 320 314 if ( nearestListBlock && endContainer.type == CKEDITOR.NODE_ELEMENT315 && endContainer.getName() in listNodeNames )321 if ( nearestListBlock && range.endContainer.type == CKEDITOR.NODE_ELEMENT 322 && range.endContainer.getName() in listNodeNames ) 316 323 { 317 324 walker = new CKEDITOR.dom.walker( range ); 318 325 walker.evaluator = isListItem;