Ticket #9008: 9008.patch

File 9008.patch, 2.1 KB (added by Garry Yao, 12 years ago)
  • _source/plugins/list/plugin.js

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    497497        }
    498498
    499499        var elementType = CKEDITOR.dom.walker.nodeType( CKEDITOR.NODE_ELEMENT );
    500         // Merge list items with direction preserved. (#7448)
    501         function mergeListItems( from, into, refNode, toHead )
     500
     501        // Merge child nodes with direction preserved. (#7448)
     502        function mergeChildren( from, into, refNode, forward )
    502503        {
    503504                var child, itemDir;
    504                 while ( ( child = from.getFirst( elementType ) ) )
     505                while ( ( child = from[ forward ? 'getLast' : 'getFirst' ]( elementType ) ) )
    505506                {
    506507                        if ( ( itemDir = child.getDirection( 1 ) ) !== into.getDirection( 1 ) )
    507508                                child.setAttribute( 'dir', itemDir );
     
    509510                        child.remove();
    510511
    511512                        refNode ?
    512                                 child[ toHead ? 'insertBefore' : 'insertAfter' ]( refNode ) :
    513                                 into.append( child, toHead  );
     513                                child[ forward ? 'insertBefore' : 'insertAfter' ]( refNode ) :
     514                                into.append( child, forward  );
    514515                }
    515516        }
    516517
     
    662663                                var mergeSibling, listCommand = this;
    663664                                ( mergeSibling = function( rtl )
    664665                                {
    665 
    666                                         var sibling = listNode[ rtl ?
    667                                                 'getPrevious' : 'getNext' ]( CKEDITOR.dom.walker.whitespaces( true ) );
     666                                        var sibling = listNode[ rtl ? 'getPrevious' : 'getNext' ]( nonEmpty );
    668667                                        if ( sibling && sibling.getName &&
    669668                                                 sibling.getName() == listCommand.type )
    670669                                        {
    671670                                                // Move children order by merge direction.(#3820)
    672                                                 mergeListItems( listNode, sibling, null, !rtl );
     671                                                mergeChildren( listNode, sibling, null, !rtl );
    673672
    674673                                                listNode.remove();
    675674                                                listNode = sibling;
     
    798797                                // If next line is in the sub list of the current list item.
    799798                                if ( currentLi.contains( nextLi ) )
    800799                                {
    801                                         mergeListItems( sublist, nextLi.getParent(), nextLi );
     800                                        mergeChildren( sublist, nextLi.getParent(), nextLi );
    802801                                        sublist.remove();
    803802                                }
    804803                                // Migrate the sub list to current list item.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy