Ticket #9080: 9080.patch
File 9080.patch, 3.7 KB (added by , 12 years ago) |
---|
-
_source/plugins/list/plugin.js
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
681 681 682 682 // For all new lists created, merge into adjacent, same type lists. 683 683 for ( i = 0 ; i < listsCreated.length ; i++ ) 684 { 685 listNode = listsCreated[i]; 686 var mergeSibling, listCommand = this; 687 ( mergeSibling = function( rtl ) 688 { 689 var sibling = listNode[ rtl ? 'getPrevious' : 'getNext' ]( nonEmpty ); 690 if ( sibling && sibling.getName && 691 sibling.getName() == listCommand.type ) 692 { 693 // Move children order by merge direction.(#3820) 694 mergeChildren( listNode, sibling, null, !rtl ); 684 mergeListSiblings( listsCreated[ i ] ); 685 686 // Clean up, restore selection and update toolbar button states. 687 CKEDITOR.dom.element.clearAllMarkers( database ); 688 selection.selectBookmarks( bookmarks ); 689 editor.focus(); 690 } 691 }; 692 693 // Merge list adjacent, of same type lists. 694 function mergeListSiblings( listNode ) 695 { 696 var mergeSibling; 697 ( mergeSibling = function( rtl ) 698 { 699 var sibling = listNode[ rtl ? 'getPrevious' : 'getNext' ]( nonEmpty ); 700 if ( sibling && sibling.is( listNode.getName() ) ) 701 { 702 // Move children order by merge direction.(#3820) 703 mergeChildren( listNode, sibling, null, !rtl ); 695 704 696 697 698 699 700 701 705 listNode.remove(); 706 listNode = sibling; 707 } 708 } )(); 709 mergeSibling( 1 ); 710 } 702 711 703 // Clean up, restore selection and update toolbar button states.704 CKEDITOR.dom.element.clearAllMarkers( database );705 selection.selectBookmarks( bookmarks );706 editor.focus();707 }708 };709 710 712 var dtd = CKEDITOR.dtd; 711 713 var tailNbspRegex = /[\t\r\n ]*(?: |\xa0)$/; 712 714 … … 836 838 var nextBlock = nextPath.block, 837 839 parentBlock = nextBlock.getParent(); 838 840 841 nextCursor.moveToPosition( nextBlock, CKEDITOR.POSITION_BEFORE_START ); 839 842 nextBlock.remove(); 840 843 841 844 // Remove if the path block container is now empty, e.g. li. … … 843 846 !parentBlock.getFirst( nonEmpty ) && 844 847 !parentBlock.equals( nextPath.blockLimit ) ) 845 848 { 849 nextCursor.moveToPosition( parentBlock, CKEDITOR.POSITION_BEFORE_START ); 846 850 parentBlock.remove(); 847 851 } 848 852 } 849 853 854 // Check if need to further merge with the list resides after the merged block. (#9080) 855 var walkerRng = nextCursor.clone(), body = editor.document.getBody(); 856 walkerRng.setEndAt( body, CKEDITOR.POSITION_BEFORE_END ); 857 var walker = new CKEDITOR.dom.walker( walkerRng ); 858 walker.evaluator = function( node ) { return nonEmpty( node ) && !blockBogus( node ); }; 859 var next = walker.next(); 860 if ( next && next.type == CKEDITOR.NODE_ELEMENT && next.getName() in CKEDITOR.dtd.$list ) 861 mergeListSiblings( next ); 862 850 863 // Make fresh selection. 851 864 cursor.select(); 852 865 … … 883 896 editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, numberedListCommand ) ); 884 897 editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, bulletedListCommand ) ); 885 898 886 // [IE8] Fix "backspace" after list and "del" at the end of list item. (#8248) 887 if ( CKEDITOR.env.ie8Compat ) 888 { 899 // [IE8] Fix "backspace" after list and "del" at the end of list item. (#8248) 889 900 editor.on( 'key', function( evt ) 890 901 { 891 902 var key = evt.data.keyCode; … … 971 982 } 972 983 } 973 984 } ); 974 }975 985 }, 976 986 977 987 afterInit : function ( editor )