Ticket #5911: 5911_2.patch

File 5911_2.patch, 2.3 KB (added by Tobiasz Cudnik, 14 years ago)
  • _source/plugins/list/plugin.js

     
    6767                },
    6868
    6969                // Convert our internal representation of a list back to a DOM forest.
    70                 arrayToList : function( listArray, database, baseIndex, paragraphMode )
     70                arrayToList : function( listArray, database, baseIndex, paragraphMode, dir )
    7171                {
    7272                        if ( !baseIndex )
    7373                                baseIndex = 0;
     
    110110                                        {
    111111                                                // Create completely new blocks here, attributes are dropped.
    112112                                                if ( paragraphMode != CKEDITOR.ENTER_BR && item.grandparent.getName() != 'td' )
     113                                                {
    113114                                                        currentListItem = doc.createElement( paragraphName );
     115                                                        if ( dir )
     116                                                                currentListItem.setAttribute( 'dir', dir );
     117                                                }
    114118                                                else
     119                                                        // Should we set DIR attribute on this one ?
    115120                                                        currentListItem = new CKEDITOR.dom.documentFragment( doc );
    116121                                        }
    117122
     
    280285
    281286                // Insert the list to the DOM tree.
    282287                var insertAnchor = listContents[ listContents.length - 1 ].getNext(),
    283                         listNode = doc.createElement( this.type );
     288                        listNode = doc.createElement( this.type ),
     289                        dir;
    284290
    285291                listsCreated.push( listNode );
    286292                while ( listContents.length )
     
    293299                                contentBlock.appendTo( listItem );
    294300                        else
    295301                        {
     302                                if ( contentBlock.hasAttribute( 'dir' ) )
     303                                {
     304                                        dir = dir || contentBlock.getAttribute( 'dir' );
     305                                        contentBlock.removeAttribute( 'dir' );
     306                                }
    296307                                contentBlock.copyAttributes( listItem );
    297308                                contentBlock.moveChildren( listItem );
    298309                                contentBlock.remove();
     
    304315                        if ( !CKEDITOR.env.ie )
    305316                                listItem.appendBogus();
    306317                }
     318
     319                if ( dir )
     320                        listNode.setAttribute( 'dir', dir );
     321
    307322                if ( insertAnchor )
    308323                        listNode.insertBefore( insertAnchor );
    309324                else
     
    353368                        }
    354369                }
    355370
    356                 var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode );
     371                var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode,
     372                        groupObj.root.getAttribute( 'dir' ) );
    357373
    358374                // Compensate <br> before/after the list node if the surrounds are non-blocks.(#3836)
    359375                var docFragment = newList.listNode, boundaryNode, siblingNode;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy