Ticket #8087: 8087_2.patch

File 8087_2.patch, 2.9 KB (added by Garry Yao, 13 years ago)
  • _source/core/dom/element.js

     
    15951595                 */
    15961596                getDirection : function( useComputed )
    15971597                {
    1598                         return useComputed ?
    1599                                 this.getComputedStyle( 'direction' )
    1600                                         // Webkit: offline element returns empty direction (#8053).
    1601                                         || this.getDirection()
    1602                                         || this.getDocument().$.dir
    1603                                         || this.getDocument().getBody().getDirection( 1 )
    1604                                 : this.getStyle( 'direction' ) || this.getAttribute( 'dir' );
     1598                        if ( useComputed )
     1599                        {
     1600                                var dir = this.getComputedStyle( 'direction' ) || this.getDirection();
     1601
     1602                                // Webkit: offline element won't inherit direction from parents (#8053).
     1603                                if ( !dir )
     1604                                {
     1605                                        var parents = this.getParents( 1 );
     1606                                        for ( var i = 0, count = parents.length; i < count; i++ )
     1607                                        {
     1608                                                if ( dir = parents[ i ].getDirection() )
     1609                                                        return dir;
     1610                                        }
     1611                                }
     1612
     1613                                return dir;
     1614                        }
     1615                        else
     1616                                return this.getStyle( 'direction' ) || this.getAttribute( 'dir' );
    16051617                },
    16061618
    16071619                /**
  • _source/plugins/list/plugin.js

     
    107107
    108108                                        if ( orgDir != rootNode.getDirection( 1 ) )
    109109                                                currentListItem.setAttribute( 'dir', orgDir );
    110                                         else
    111                                                 currentListItem.removeAttribute( 'dir' );
    112110
    113111                                        for ( var i = 0 ; i < item.contents.length ; i++ )
    114112                                                currentListItem.append( item.contents[i].clone( 1, 1 ) );
     
    155153                                        {
    156154                                                if ( item.grandparent.getDirection( 1 ) != orgDir )
    157155                                                        currentListItem.setAttribute( 'dir', orgDir );
    158                                                 else
    159                                                         currentListItem.removeAttribute( 'dir' );
    160156                                        }
    161157
    162158                                        for ( i = 0 ; i < item.contents.length ; i++ )
     
    208204                                        break;
    209205                        }
    210206
    211                         // Clear marker attributes for the new list tree made of cloned nodes, if any.
    212207                        if ( database )
    213208                        {
    214                                 var currentNode = retval.getFirst();
     209                                var currentNode = retval.getFirst(),
     210                                        itemDir,
     211                                        listRoot = listArray[ 0 ].parent;
     212
    215213                                while ( currentNode )
    216214                                {
    217215                                        if ( currentNode.type == CKEDITOR.NODE_ELEMENT )
     216                                        {
     217                                                // Clear marker attributes for the new list tree made of cloned nodes, if any.
    218218                                                CKEDITOR.dom.element.clearMarkers( database, currentNode );
     219
     220                                                // Clear redundant direction attribute.
     221                                                if ( currentNode.is( 'li' ) && ( itemDir = currentNode.getDirection() ) )
     222                                                {
     223                                                        var listNode = currentNode.getParent();
     224                                                        if ( itemDir == ( listNode && listNode.getDirection( 1 ) || listRoot.getDirection( 1 ) ) )
     225                                                                currentNode.removeAttribute( 'dir' );
     226                                                }
     227                                        }
     228
    219229                                        currentNode = currentNode.getNextSourceNode();
    220230                                }
    221231                        }
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy