IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
|
|
|
483 | 483 | this.type = type; |
484 | 484 | } |
485 | 485 | |
486 | | // Move direction attribute from root to list items. |
487 | | function dirToListItems( list ) |
| 486 | var elementType = CKEDITOR.dom.walker.nodeType( CKEDITOR.NODE_ELEMENT ); |
| 487 | // Merge list items with direction preserved. (#7448) |
| 488 | function mergeListItems( from, into, toHead ) |
488 | 489 | { |
489 | | var dir = list.getDirection(); |
490 | | if ( dir ) |
| 490 | var child, itemDir; |
| 491 | while ( child = from.getFirst( elementType ) ) |
491 | 492 | { |
492 | | for ( var i = 0, children = list.getChildren(), child; child = children.getItem( i ), i < children.count(); i++ ) |
493 | | { |
494 | | if ( child.type == CKEDITOR.NODE_ELEMENT && child.is( 'li' ) && !child.getDirection() ) |
495 | | child.setAttribute( 'dir', dir ); |
496 | | } |
497 | | |
498 | | list.removeAttribute( 'dir' ); |
499 | | } |
500 | | } |
| 493 | if ( ( itemDir = child.getDirection( 1 ) ) !== into.getDirection( 1 ) ) |
| 494 | child.setAttribute( 'dir', itemDir ); |
| 495 | into.append( child.remove(), toHead ); |
| 496 | } |
| 497 | } |
501 | 498 | |
502 | 499 | listCommand.prototype = { |
503 | 500 | exec : function( editor ) |
… |
… |
|
640 | 637 | removeList.call( this, editor, groupObj, database ); |
641 | 638 | } |
642 | 639 | |
643 | | // For all new lists created, merge adjacent, same type lists. |
| 640 | // For all new lists created, merge into adjacent, same type lists. |
644 | 641 | for ( i = 0 ; i < listsCreated.length ; i++ ) |
645 | 642 | { |
646 | 643 | listNode = listsCreated[i]; |
647 | 644 | var mergeSibling, listCommand = this; |
648 | | ( mergeSibling = function( rtl ){ |
| 645 | ( mergeSibling = function( rtl ) |
| 646 | { |
649 | 647 | |
650 | 648 | var sibling = listNode[ rtl ? |
651 | 649 | 'getPrevious' : 'getNext' ]( CKEDITOR.dom.walker.whitespaces( true ) ); |
652 | 650 | if ( sibling && sibling.getName && |
653 | 651 | sibling.getName() == listCommand.type ) |
654 | 652 | { |
655 | | |
656 | | // In case to be merged lists have difference directions. (#7448) |
657 | | if ( sibling.getDirection( 1 ) != listNode.getDirection( 1 ) ) |
658 | | dirToListItems( listNode.getDirection() ? listNode : sibling ); |
659 | | |
660 | | sibling.remove(); |
661 | 653 | // Move children order by merge direction.(#3820) |
662 | | sibling.moveChildren( listNode, rtl ); |
| 654 | mergeListItems( listNode, sibling, !rtl ); |
| 655 | |
| 656 | listNode.remove(); |
| 657 | listNode = sibling; |
663 | 658 | } |
664 | 659 | } )(); |
665 | 660 | mergeSibling( 1 ); |