Ticket #6569: 6569.patch
File 6569.patch, 2.8 KB (added by , 13 years ago) |
---|
-
_source/plugins/indent/plugin.js
78 78 } 79 79 80 80 // Returns the CSS property to be used for identing a given element. 81 function getIndentCssProperty( element )81 function getIndentCssProperty( element, dir ) 82 82 { 83 return element.getComputedStyle( 'direction') == 'ltr' ? 'margin-left' : 'margin-right';83 return ( dir || element.getComputedStyle( 'direction' ) ) == 'ltr' ? 'margin-left' : 'margin-right'; 84 84 } 85 85 86 86 function isListItem( node ) … … 157 157 158 158 // Convert the array back to a DOM forest (yes we might have a few subtrees now). 159 159 // And replace the old list with the new forest. 160 var newListDir = listNode.getAttribute( 'dir' ) || listNode.getStyle( 'direction' ); 161 var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode, newListDir ); 160 var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode, listNode.getDirection() ); 162 161 163 162 // Avoid nested <li> after outdent even they're visually same, 164 163 // recording them for later refactoring.(#3982) … … 220 219 indentElement( block ); 221 220 } 222 221 223 function indentElement( element )222 function indentElement( element, dir ) 224 223 { 225 224 if ( element.getCustomData( 'indent_processed' ) ) 226 225 return false; … … 256 255 } 257 256 else 258 257 { 259 var indentCssProperty = getIndentCssProperty( element ),258 var indentCssProperty = getIndentCssProperty( element, dir ), 260 259 currentOffset = parseInt( element.getStyle( indentCssProperty ), 10 ); 261 260 if ( isNaN( currentOffset ) ) 262 261 currentOffset = 0; … … 328 327 329 328 if ( nearestListBlock ) 330 329 { 331 var firstListItem = nearestListBlock.getFirst( function( node ) 332 { 333 return node.type == CKEDITOR.NODE_ELEMENT && node.is( 'li' ); 334 }), 330 var firstListItem = nearestListBlock.getFirst( isListItem ), 331 hasMultipleItems = !!firstListItem.getNext( isListItem ), 335 332 rangeStart = range.startContainer, 336 333 indentWholeList = firstListItem.equals( rangeStart ) || firstListItem.contains( rangeStart ); 337 334 … … 339 336 // Only do that for indenting or when using indent classes or when there is something to outdent. (#6141) 340 337 if ( !( indentWholeList && 341 338 ( self.name == 'indent' || self.useIndentClasses || parseInt( nearestListBlock.getStyle( getIndentCssProperty( nearestListBlock ) ), 10 ) ) && 342 indentElement( nearestListBlock ) ) )339 indentElement( nearestListBlock, !hasMultipleItems && firstListItem.getDirection() ) ) ) 343 340 indentList( nearestListBlock ); 344 341 } 345 342 else