Ticket #29380: 29380.3.patch
File 29380.3.patch, 2.1 KB (added by , 9 years ago) |
---|
-
src/wp-includes/js/tinymce/plugins/wpview/plugin.js
12 12 firstFocus = true, 13 13 _noop = function() { return false; }, 14 14 isios = /iPad|iPod|iPhone/.test( navigator.userAgent ), 15 cursorInterval, lastKeyDownNode, setViewCursorTries, focus, execCommandView ;15 cursorInterval, lastKeyDownNode, setViewCursorTries, focus, execCommandView, execCommandBefore; 16 16 17 17 function getView( node ) { 18 18 return getParent( node, 'wpview-wrap' ); … … 368 368 // Ref: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.keyCode 369 369 function isSpecialKey( key ) { 370 370 return ( ( key <= 47 && key !== VK.SPACEBAR && key !== VK.ENTER && key !== VK.DELETE && key !== VK.BACKSPACE && ( key < 37 || key > 40 ) ) || 371 key >= 224 || // OEM or non-printable 371 key >= 224 || // OEM or non-printable 372 372 ( key >= 144 && key <= 150 ) || // Num Lock, Scroll Lock, OEM 373 373 ( key >= 91 && key <= 93 ) || // Windows keys 374 374 ( key >= 112 && key <= 135 ) ); // F keys … … 649 649 var node = editor.selection.getNode(), 650 650 view; 651 651 652 if ( node && ( node.className === 'wpview-selection-before'|| node.className === 'wpview-selection-after' ) && ( view = getView( node ) ) ) {653 handleEnter( view );652 if ( node && ( ( execCommandBefore = node.className === 'wpview-selection-before' ) || node.className === 'wpview-selection-after' ) && ( view = getView( node ) ) ) { 653 handleEnter( view, execCommandBefore ); 654 654 execCommandView = view; 655 655 } 656 656 }); … … 665 665 } 666 666 667 667 if ( execCommandView ) { 668 node = execCommandView .nextSibling;668 node = execCommandView[ execCommandBefore ? 'previousSibling' : 'nextSibling' ]; 669 669 670 670 if ( node && node.nodeName === 'P' && editor.dom.isEmpty( node ) ) { 671 671 editor.dom.remove( node ); 672 setViewCursor( false, execCommandView );672 setViewCursor( execCommandBefore, execCommandView ); 673 673 } 674 674 675 675 execCommandView = false;