Ticket #5911: 5911_3.patch

File 5911_3.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;
     
    109109                                        else
    110110                                        {
    111111                                                // Create completely new blocks here, attributes are dropped.
    112                                                 if ( paragraphMode != CKEDITOR.ENTER_BR && item.grandparent.getName() != 'td' )
     112                                                if ( dir || ( 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
    115119                                                        currentListItem = new CKEDITOR.dom.documentFragment( doc );
    116120                                        }
     
    280284
    281285                // Insert the list to the DOM tree.
    282286                var insertAnchor = listContents[ listContents.length - 1 ].getNext(),
    283                         listNode = doc.createElement( this.type );
     287                        listNode = doc.createElement( this.type ),
     288                        dir;
    284289
    285290                listsCreated.push( listNode );
    286291                while ( listContents.length )
     
    293298                                contentBlock.appendTo( listItem );
    294299                        else
    295300                        {
     301                                if ( contentBlock.hasAttribute( 'dir' ) )
     302                                {
     303                                        dir = dir || contentBlock.getAttribute( 'dir' );
     304                                        contentBlock.removeAttribute( 'dir' );
     305                                }
    296306                                contentBlock.copyAttributes( listItem );
    297307                                contentBlock.moveChildren( listItem );
    298308                                contentBlock.remove();
     
    304314                        if ( !CKEDITOR.env.ie )
    305315                                listItem.appendBogus();
    306316                }
     317
     318                if ( dir )
     319                        listNode.setAttribute( 'dir', dir );
     320
    307321                if ( insertAnchor )
    308322                        listNode.insertBefore( insertAnchor );
    309323                else
     
    353367                        }
    354368                }
    355369
    356                 var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode );
     370                var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode,
     371                        groupObj.root.getAttribute( 'dir' ) );
    357372
    358373                // Compensate <br> before/after the list node if the surrounds are non-blocks.(#3836)
    359374                var docFragment = newList.listNode, boundaryNode, siblingNode;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy