Ticket #6217: 6217_2.patch
File 6217_2.patch, 5.6 KB (added by , 12 years ago) |
---|
-
_source/plugins/wysiwygarea/plugin.js
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
760 760 { 761 761 var sel = editor.getSelection(), 762 762 selected = sel.getSelectedElement(), 763 range = sel.getRanges()[ 0 ]; 763 range = sel.getRanges()[ 0 ], 764 path = new CKEDITOR.dom.elementPath( range.startContainer ), 765 block, 766 parent, 767 next, 768 rtl = keyCode == 8; 764 769 765 770 // Override keystrokes which should have deletion behavior 766 771 // on fully selected element . (#4047) (#7645) … … 779 784 editor.fire( 'saveSnapshot' ); 780 785 781 786 evt.data.preventDefault(); 782 return; 787 } 788 else 789 { 790 // Handle the following special cases: (#6217) 791 // 1. Del/Backspace key before/after table; 792 // 2. key after start of table. 793 if ( ( block = path.block ) && 794 range[ rtl ? 'checkStartOfBlock' : 'checkEndOfBlock' ]() && 795 ( next = block[ rtl ? 'getPrevious' : 'getNext' ]( notWhitespaceEval ) ) && 796 next.is( 'table' ) ) 797 { 798 editor.fire( 'saveSnapshot' ); 799 800 // Remove the current empty block. 801 if ( range[ rtl ? 'checkEndOfBlock' : 'checkStartOfBlock' ]() ) 802 block.remove(); 803 804 // Move cursor to the beginning/end of table cell. 805 range[ 'moveToElementEdit' + ( rtl ? 'End' : 'Start' ) ]( next ); 806 range.select(); 807 808 editor.fire( 'saveSnapshot' ); 809 810 evt.data.preventDefault(); 811 } 812 else if ( path.blockLimit.is( 'td' ) && 813 ( parent = path.blockLimit.getAscendant( 'table' ) ) && 814 range.checkBoundaryOfElement( parent, rtl ? CKEDITOR.START : CKEDITOR.END ) && 815 ( next = parent[ rtl ? 'getPrevious' : 'getNext' ]( notWhitespaceEval ) ) ) 816 { 817 editor.fire( 'saveSnapshot' ); 818 819 // Move cursor to the end of previous block. 820 range[ 'moveToElementEdit' + ( rtl ? 'End' : 'Start' ) ]( next ); 821 822 // Remove any previous empty block. 823 if ( range.checkStartOfBlock() && range.checkEndOfBlock() ) 824 next.remove(); 825 else 826 range.select(); 827 828 editor.fire( 'saveSnapshot' ); 829 830 evt.data.preventDefault(); 831 } 832 783 833 } 784 834 } 785 835 -
_source/core/dom/range.js
IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8
349 349 // check(Start|End)OfBlock. 350 350 function getCheckStartEndBlockEvalFunction( isStart ) 351 351 { 352 var hadBr = false, bookmarkEvaluator = CKEDITOR.dom.walker.bookmark( true ); 352 var skipBogus = false, 353 bookmarkEvaluator = CKEDITOR.dom.walker.bookmark( true ), 354 nbspRegExp = /^[\t\r\n ]*(?: |\xa0)$/; 355 353 356 return function( node ) 354 357 { 355 358 // First ignore bookmark nodes. … … 358 361 359 362 if ( node.type == CKEDITOR.NODE_TEXT ) 360 363 { 364 // Skip the block filler NBSP. 365 if ( CKEDITOR.env.ie && 366 nbspRegExp.test( node.getText() ) && 367 !skipBogus && 368 !( isStart && node.getNext() ) ) 369 { 370 skipBogus = true; 371 } 361 372 // If there's any visible text, then we're not at the start. 362 if ( node.hasAscendant( 'pre' ) || CKEDITOR.tools.trim( node.getText() ).length )373 else if ( node.hasAscendant( 'pre' ) || CKEDITOR.tools.trim( node.getText() ).length ) 363 374 return false; 364 375 } 365 376 else if ( node.type == CKEDITOR.NODE_ELEMENT ) … … 368 379 // at the start. 369 380 if ( !inlineChildReqElements[ node.getName() ] ) 370 381 { 371 // If we're working at the end-of-block, forgive the first <br /> in non-IE 372 // browsers. 373 if ( !isStart && !CKEDITOR.env.ie && node.getName() == 'br' && !hadBr ) 374 hadBr = true; 382 // Skip the padding block br. 383 if ( !CKEDITOR.env.ie && 384 node.is( 'br' ) && 385 !skipBogus && 386 !( isStart && node.getNext() ) ) 387 { 388 skipBogus = true; 389 } 375 390 else 376 391 return false; 377 392 } … … 1934 1949 */ 1935 1950 moveToElementEditablePosition : function( el, isMoveToEnd ) 1936 1951 { 1952 var nbspRegExp = /^[\t\r\n ]*(?: |\xa0)$/; 1953 1937 1954 function nextDFS( node, childOnly ) 1938 1955 { 1939 1956 var next; … … 1958 1975 // Stop immediately if we've found a text node. 1959 1976 if ( el.type == CKEDITOR.NODE_TEXT ) 1960 1977 { 1961 this.moveToPosition( el, isMoveToEnd ? 1978 // Put cursor before block filler. 1979 if ( isMoveToEnd && this.checkEndOfBlock() && nbspRegExp.test( el.getText() ) ) 1980 this.moveToPosition( el, CKEDITOR.POSITION_BEFORE_START ); 1981 else 1982 this.moveToPosition( el, isMoveToEnd ? 1962 1983 CKEDITOR.POSITION_AFTER_END : 1963 1984 CKEDITOR.POSITION_BEFORE_START ); 1964 1985 found = 1; … … 1975 1996 CKEDITOR.POSITION_AFTER_START ); 1976 1997 found = 1; 1977 1998 } 1999 // Put cursor before padding block br. 2000 else if ( isMoveToEnd && el.is( 'br' ) && this.checkEndOfBlock() ) 2001 this.moveToPosition( el, CKEDITOR.POSITION_BEFORE_START ); 1978 2002 } 1979 2003 1980 2004 el = nextDFS( el, found );