Ticket #7566: 7566.patch

File 7566.patch, 2.9 KB (added by Garry Yao, 13 years ago)
  • _source/plugins/list/plugin.js

     
    8787                                currentIndex = baseIndex,
    8888                                indentLevel = Math.max( listArray[ baseIndex ].indent, 0 ),
    8989                                currentListItem = null,
    90                                 itemDir,
     90                                orgDir,
    9191                                paragraphName = ( paragraphMode == CKEDITOR.ENTER_P ? 'p' : 'div' );
    9292                        while ( 1 )
    9393                        {
    9494                                var item = listArray[ currentIndex ];
     95
     96                                orgDir = item.element.getDirection( 1 );
     97
    9598                                if ( item.indent == indentLevel )
    9699                                {
    97100                                        if ( !rootNode || listArray[ currentIndex ].parent.getName() != rootNode.getName() )
     
    101104                                                retval.append( rootNode );
    102105                                        }
    103106                                        currentListItem = rootNode.append( item.element.clone( 0, 1 ) );
     107
     108                                        if ( orgDir != rootNode.getDirection( 1 ) )
     109                                                currentListItem.setAttribute( 'dir', orgDir );
     110
    104111                                        for ( var i = 0 ; i < item.contents.length ; i++ )
    105112                                                currentListItem.append( item.contents[i].clone( 1, 1 ) );
    106113                                        currentIndex++;
     
    108115                                else if ( item.indent == Math.max( indentLevel, 0 ) + 1 )
    109116                                {
    110117                                        // Maintain original direction (#6861).
    111                                         var orgDir = item.element.getDirection( 1 ),
    112                                                 currDir = listArray[ currentIndex - 1 ].element.getDirection( 1 ),
     118                                        var currDir = listArray[ currentIndex - 1 ].element.getDirection( 1 ),
    113119                                                listData = CKEDITOR.plugins.list.arrayToList( listArray, null, currentIndex, paragraphMode,
    114120                                                currDir != orgDir ? orgDir: null );
    115121
     
    124130                                else if ( item.indent == -1 && !baseIndex && item.grandparent )
    125131                                {
    126132                                        if ( listNodeNames[ item.grandparent.getName() ] )
    127                                         {
    128133                                                currentListItem = item.element.clone( false, true );
    129                                                 itemDir = item.element.getDirection( 1 );
    130                                                 item.grandparent.getDirection( 1 ) != itemDir &&
    131                                                         currentListItem.setAttribute( 'dir', itemDir );
    132                                         }
    133134                                        else
    134135                                        {
    135136                                                // Create completely new blocks here.
     
    137138                                                {
    138139                                                        currentListItem = doc.createElement( paragraphName );
    139140                                                        item.element.copyAttributes( currentListItem, { type:1, value:1 } );
    140                                                         itemDir = item.element.getDirection() || dir;
    141                                                         itemDir &&
    142                                                                 currentListItem.setAttribute( 'dir', itemDir );
    143141
    144142                                                        // There might be a case where there are no attributes in the element after all
    145143                                                        // (i.e. when "type" or "value" are the only attributes set). In this case, if enterMode = BR,
     
    151149                                                        currentListItem = new CKEDITOR.dom.documentFragment( doc );
    152150                                        }
    153151
     152                                        if ( item.grandparent.getDirection( 1 ) != orgDir && currentListItem.type == CKEDITOR.NODE_ELEMENT )
     153                                                        currentListItem.setAttribute( 'dir', orgDir );
     154
    154155                                        for ( i = 0 ; i < item.contents.length ; i++ )
    155156                                                currentListItem.append( item.contents[i].clone( 1, 1 ) );
    156157
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy