Ticket #9080: 9080_2.patch
File 9080_2.patch, 8.0 KB (added by , 11 years ago) |
---|
-
_source/plugins/selection/plugin.js
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
589 589 command : 'selectAll' 590 590 }); 591 591 592 editor.selectionChange = checkSelectionChangeTimeout; 592 /** 593 * Check if to fire the {@link CKEDITOR.editor#selectionChange} event 594 * for the current editor instance. 595 * 596 * @param {Boolean} checkNow Check immediately without any delay. 597 */ 598 editor.selectionChange = function( checkNow ) 599 { 600 ( checkNow ? checkSelectionChange : checkSelectionChangeTimeout ).call( this ); 601 }; 593 602 594 603 // IE9 might cease to work if there's an object selection inside the iframe (#7639). 595 604 CKEDITOR.env.ie9Compat && editor.on( 'destroy', function() -
_source/plugins/indent/plugin.js
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
428 428 } 429 429 } 430 430 }); 431 432 editor.on( 'key', function( evt )433 {434 // Backspace at the beginning of list item should outdent it.435 if ( editor.mode == 'wysiwyg' && evt.data.keyCode == 8 )436 {437 var sel = editor.getSelection(),438 range = sel.getRanges()[ 0 ],439 li;440 441 if ( range.collapsed &&442 ( li = range.startContainer.getAscendant( 'li', 1 ) ) &&443 range.checkBoundaryOfElement( li, CKEDITOR.START ) )444 {445 editor.execCommand( 'outdent' );446 evt.cancel();447 }448 }449 });450 431 }, 451 432 452 433 requires : [ 'domiterator', 'list' ] -
_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 … … 788 790 var frag = nextCursor.extractContents(); 789 791 790 792 cursor.trim( false, true ); 793 var bm = cursor.createBookmark(); 791 794 792 795 // Kill original bogus; 793 796 var currentPath = new CKEDITOR.dom.elementPath( cursor.startContainer ); … … 836 839 var nextBlock = nextPath.block, 837 840 parentBlock = nextBlock.getParent(); 838 841 842 nextCursor.moveToPosition( nextBlock, CKEDITOR.POSITION_BEFORE_START ); 839 843 nextBlock.remove(); 840 844 841 845 // Remove if the path block container is now empty, e.g. li. … … 843 847 !parentBlock.getFirst( nonEmpty ) && 844 848 !parentBlock.equals( nextPath.blockLimit ) ) 845 849 { 850 nextCursor.moveToPosition( parentBlock, CKEDITOR.POSITION_BEFORE_START ); 846 851 parentBlock.remove(); 847 852 } 848 853 } 849 854 855 // Check if need to further merge with the list resides after the merged block. (#9080) 856 var walkerRng = nextCursor.clone(), body = editor.document.getBody(); 857 walkerRng.setEndAt( body, CKEDITOR.POSITION_BEFORE_END ); 858 var walker = new CKEDITOR.dom.walker( walkerRng ); 859 walker.evaluator = function( node ) { return nonEmpty( node ) && !blockBogus( node ); }; 860 var next = walker.next(); 861 if ( next && next.type == CKEDITOR.NODE_ELEMENT && next.getName() in CKEDITOR.dtd.$list ) 862 mergeListSiblings( next ); 863 864 cursor.moveToBookmark( bm ); 865 850 866 // Make fresh selection. 851 867 cursor.select(); 852 868 869 editor.selectionChange( 1 ); 853 870 editor.fire( 'saveSnapshot' ); 854 871 } 855 872 … … 883 900 editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, numberedListCommand ) ); 884 901 editor.on( 'selectionChange', CKEDITOR.tools.bind( onSelectionChange, bulletedListCommand ) ); 885 902 886 // [IE8] Fix "backspace" after list and "del" at the end of list item. (#8248) 887 if ( CKEDITOR.env.ie8Compat ) 888 { 903 // [IE8] Fix "backspace" after list and "del" at the end of list item. (#8248) 889 904 editor.on( 'key', function( evt ) 890 905 { 891 906 var key = evt.data.keyCode; … … 911 926 walker.range.setStartAt( body, CKEDITOR.POSITION_AFTER_START ); 912 927 walker.range.setEnd( range.startContainer, range.startOffset ); 913 928 914 var previous = walker.previous();929 var previous, joinWith; 915 930 916 // Check if cursor collapsed right behind of a list. 917 if ( previous && 918 previous.type == CKEDITOR.NODE_ELEMENT && 919 previous.getName() in listNodeNames ) 931 var path = new CKEDITOR.dom.elementPath( range.startContainer ); 932 933 // Join a sub list's first line, with the previous visual line in parent. 934 if ( ( previous = path.contains( listNodeNames ) ) && 935 range.checkBoundaryOfElement( previous, CKEDITOR.START ) && 936 ( previous = previous.getParent() ) && previous.is( 'li' ) && 937 ( previous = getSubList( previous ) ) ) 920 938 { 921 walker.range.selectNodeContents( previous ); 922 walker.reset(); 923 walker.evaluator = isTextBlock; 939 joinWith = previous; 940 // Place cursor before the nested list. 941 cursor.moveToPosition( joinWith, CKEDITOR.POSITION_BEFORE_START ); 942 } 943 // Join any line following a list, with the last visual line of the list. 944 else 945 { 946 previous = walker.previous(); 947 948 if ( previous && previous.type == CKEDITOR.NODE_ELEMENT && 949 ( previous.getName() in listNodeNames || previous.is( 'li' ) ) ) 950 { 951 if ( !previous.is( 'li' ) ) 952 { 953 walker.range.selectNodeContents( previous ); 954 walker.reset(); 955 walker.evaluator = isTextBlock; 956 previous = walker.previous(); 957 } 924 958 925 // Place cursor at the end of previous block. 926 cursor.moveToElementEditEnd( walker.lastForward() ); 959 joinWith = previous; 960 // Place cursor at the end of previous block. 961 cursor.moveToElementEditEnd( joinWith ); 962 } 963 } 964 965 if ( joinWith ) 966 { 927 967 joinNextLineToCursor( editor, cursor, range ); 928 968 evt.cancel(); 929 969 } … … 971 1011 } 972 1012 } 973 1013 } ); 974 }975 1014 }, 976 1015 977 1016 afterInit : function ( editor )