Ticket #9129: 9129_3.patch
File 9129_3.patch, 8.1 KB (added by , 11 years ago) |
---|
-
_source/plugins/selection/plugin.js
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
81 81 function singletonBlock( node ) 82 82 { 83 83 var body = range.document.getBody(); 84 return !node.is( 'body' ) && body.getChildCount() == 1; 84 85 if ( node.isBlockBoundary() && 86 range.checkBoundaryOfElement( body, CKEDITOR.START ) && 87 range.checkBoundaryOfElement( body, CKEDITOR.END ) ) 88 { 89 return true; 90 } 85 91 } 86 92 87 93 var start = range.startContainer, -
_source/plugins/wysiwygarea/plugin.js
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
767 767 768 768 domDocument.getDocumentElement().addClass( domDocument.$.compatMode ); 769 769 // Override keystroke behaviors. 770 edit able && domDocument.on( 'keydown', function( evt )770 editor.on( 'key', function( evt ) 771 771 { 772 var keyCode = evt.data. getKeystroke();772 var keyCode = evt.data.keyCode; 773 773 774 774 // Backspace OR Delete. 775 775 if ( keyCode in { 8 : 1, 46 : 1 } ) … … 799 799 800 800 editor.fire( 'saveSnapshot' ); 801 801 802 evt. data.preventDefault();802 evt.cancel(); 803 803 } 804 else 804 else if ( range.collapsed ) 805 805 { 806 806 // Handle the following special cases: (#6217) 807 807 // 1. Del/Backspace key before/after table; … … 823 823 824 824 editor.fire( 'saveSnapshot' ); 825 825 826 evt. data.preventDefault();826 evt.cancel(); 827 827 } 828 828 else if ( path.blockLimit.is( 'td' ) && 829 829 ( parent = path.blockLimit.getAscendant( 'table' ) ) && … … 843 843 844 844 editor.fire( 'saveSnapshot' ); 845 845 846 evt. data.preventDefault();846 evt.cancel(); 847 847 } 848 848 849 849 } … … 865 865 range = new CKEDITOR.dom.range( domDocument ); 866 866 range[ keyCode == 33 ? 'moveToElementEditStart' : 'moveToElementEditEnd']( body ); 867 867 range.select(); 868 evt. data.preventDefault();868 evt.cancel(); 869 869 } 870 870 } 871 871 -
_source/plugins/list/plugin.js
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
784 784 CKEDITOR.dtd[ node.getName() ][ '#' ]; 785 785 } 786 786 787 // Merge the visual line content at the cursor range into the block.787 // Join visually two block lines. 788 788 function joinNextLineToCursor( editor, cursor, nextCursor ) 789 789 { 790 790 editor.fire( 'saveSnapshot' ); … … 798 798 799 799 // Kill original bogus; 800 800 var currentPath = new CKEDITOR.dom.elementPath( cursor.startContainer ); 801 var current Li = currentPath.lastElement.getAscendant( 'li', 1 );801 var currentBlock = currentPath.lastElement.getAscendant( 'li', 1 ) || currentPath.block; 802 802 803 803 var bogus = currentPath.block.getBogus(); 804 804 bogus && bogus.remove(); … … 815 815 else 816 816 cursor.startContainer.append( frag ); 817 817 818 var nextPath = new CKEDITOR.dom.elementPath( nextCursor.startContainer ) ;819 varnextLi = nextCursor.startContainer.getAscendant( 'li', 1 );818 var nextPath = new CKEDITOR.dom.elementPath( nextCursor.startContainer ), 819 nextLi = nextCursor.startContainer.getAscendant( 'li', 1 ); 820 820 821 821 // Move the sub list nested in the next list item. 822 822 if ( nextLi ) … … 825 825 if ( sublist ) 826 826 { 827 827 // If next line is in the sub list of the current list item. 828 if ( current Li.contains( nextLi ) )828 if ( currentBlock.contains( nextLi ) ) 829 829 { 830 830 mergeChildren( sublist, nextLi.getParent(), nextLi ); 831 831 sublist.remove(); 832 832 } 833 833 // Migrate the sub list to current list item. 834 834 else 835 current Li.append( sublist );835 currentBlock.append( sublist ); 836 836 } 837 837 } 838 838 … … 918 918 if ( !range.collapsed ) 919 919 return; 920 920 921 var path = new CKEDITOR.dom.elementPath( range.startContainer ); 921 922 var isBackspace = key == 8; 922 923 var body = editor.document.getBody(); 923 924 var walker = new CKEDITOR.dom.walker( range.clone() ); 924 925 walker.evaluator = function( node ) { return nonEmpty( node ) && !blockBogus( node ); }; 926 walker.guard = function( node, isOut ) { return !( isOut && node.type == CKEDITOR.NODE_ELEMENT && node.is( 'table' ) ) }; 925 927 926 928 var cursor = range.clone(); 927 929 … … 929 931 { 930 932 var previous, joinWith; 931 933 932 var path = new CKEDITOR.dom.elementPath( range.startContainer );933 934 934 // Join a sub list's first line, with the previous visual line in parent. 935 935 if ( ( previous = path.contains( listNodeNames ) ) && 936 936 range.checkBoundaryOfElement( previous, CKEDITOR.START ) && … … 973 973 joinNextLineToCursor( editor, cursor, range ); 974 974 evt.cancel(); 975 975 } 976 } 976 else 977 { 978 var list = path.contains( listNodeNames ), li; 979 // Backspace pressed at the start of list, in first list item. (#9129) 980 if ( list && range.checkBoundaryOfElement( list, CKEDITOR.START ) ) 981 { 982 li = list.getFirst( nonEmpty ); 983 984 // Outdent the list item if: 985 // 1. Inside of empty list item. 986 // 2. No content to merge before. 987 if ( range.checkBoundaryOfElement( li, CKEDITOR.START ) ) 988 { 989 previous = list.getPrevious( nonEmpty ); 990 991 // Simply move backward one character when: 992 // 1. The list item contains a sub list; 993 // 2. The previous one is a table; 994 if ( getSubList( li ) || 995 previous && previous.type == CKEDITOR.NODE_ELEMENT && 996 previous.is( 'table' ) ) 997 { 998 if ( previous ) { 999 range.moveToElementEditEnd( previous ); 1000 range.select(); 1001 } 1002 1003 evt.cancel(); 1004 } 1005 // Outdent the list item when: 1006 // 1. Empty list item that contains no sub list. 1007 // 2. No previous content to merge. 1008 else if ( range.checkBoundaryOfElement( li, CKEDITOR.END ) || !previous ) { 1009 editor.execCommand( 'outdent' ); 1010 evt.cancel(); 1011 } 1012 } 1013 } 1014 } 1015 } 977 1016 else 978 1017 { 979 var li = range.startContainer.getAscendant( 'li', 1 ); 1018 var next, 1019 nextLine, 1020 li = range.startContainer.getAscendant( 'li', 1 ); 1021 980 1022 if ( li ) 981 1023 { 982 1024 walker.range.setEndAt( body, CKEDITOR.POSITION_BEFORE_END ); … … 1007 1049 if ( isAtEnd && next ) 1008 1050 { 1009 1051 // Put cursor range there. 1010 varnextLine = range.clone();1052 nextLine = range.clone(); 1011 1053 nextLine.moveToElementEditStart( next ); 1012 1054 1013 1055 joinNextLineToCursor( editor, cursor, nextLine ); 1014 1056 evt.cancel(); 1057 } 1058 } 1059 else 1060 { 1061 // Handle Del key pressed before the list. 1062 walker.range.setEndAt( body, CKEDITOR.POSITION_BEFORE_END ); 1063 next = walker.next(); 1064 1065 if ( next && next.type == CKEDITOR.NODE_ELEMENT && 1066 next.getName() in listNodeNames ) 1067 { 1068 // The start <li> 1069 next = next.getFirst( nonEmpty ); 1070 1071 // Move the cursor one character forward if 1072 // the subsequent list item contains sub list. 1073 if ( getSubList( next ) ) 1074 { 1075 range.moveToElementEditStart( next ); 1076 range.select(); 1077 evt.cancel(); 1078 } 1079 // Simply remove the current empty block, move cursor to the 1080 // subsequent list. 1081 else if ( path.block && 1082 range.checkStartOfBlock() && 1083 range.checkEndOfBlock() ) 1084 { 1085 path.block.remove(); 1086 range.moveToElementEditStart( next ); 1087 range.select(); 1088 evt.cancel(); 1089 } 1015 1090 } 1016 1091 } 1017 1092 }