Ticket #6569: 6569.patch

File 6569.patch, 2.8 KB (added by Sa'ar Zac Elias, 13 years ago)
  • _source/plugins/indent/plugin.js

     
    7878        }
    7979
    8080        // Returns the CSS property to be used for identing a given element.
    81         function getIndentCssProperty( element )
     81        function getIndentCssProperty( element, dir )
    8282        {
    83                 return element.getComputedStyle( 'direction' ) == 'ltr' ? 'margin-left' : 'margin-right';
     83                return ( dir || element.getComputedStyle( 'direction' ) ) == 'ltr' ? 'margin-left' : 'margin-right';
    8484        }
    8585
    8686        function isListItem( node )
     
    157157
    158158                                // Convert the array back to a DOM forest (yes we might have a few subtrees now).
    159159                                // 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() );
    162161
    163162                                // Avoid nested <li> after outdent even they're visually same,
    164163                                // recording them for later refactoring.(#3982)
     
    220219                                        indentElement( block );
    221220                        }
    222221
    223                         function indentElement( element )
     222                        function indentElement( element, dir )
    224223                        {
    225224                                if ( element.getCustomData( 'indent_processed' ) )
    226225                                        return false;
     
    256255                                }
    257256                                else
    258257                                {
    259                                         var indentCssProperty = getIndentCssProperty( element ),
     258                                        var indentCssProperty = getIndentCssProperty( element, dir ),
    260259                                                currentOffset = parseInt( element.getStyle( indentCssProperty ), 10 );
    261260                                        if ( isNaN( currentOffset ) )
    262261                                                currentOffset = 0;
     
    328327
    329328                                if ( nearestListBlock )
    330329                                {
    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 ),
    335332                                                rangeStart = range.startContainer,
    336333                                                indentWholeList = firstListItem.equals( rangeStart ) || firstListItem.contains( rangeStart );
    337334
     
    339336                                        // Only do that for indenting or when using indent classes or when there is something to outdent. (#6141)
    340337                                        if ( !( indentWholeList &&
    341338                                                ( self.name == 'indent' || self.useIndentClasses || parseInt( nearestListBlock.getStyle( getIndentCssProperty( nearestListBlock ) ), 10 ) ) &&
    342                                                         indentElement( nearestListBlock ) ) )
     339                                                        indentElement( nearestListBlock, !hasMultipleItems && firstListItem.getDirection() ) ) )
    343340                                                                indentList( nearestListBlock );
    344341                                }
    345342                                else
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy