Ticket #28595: 28595.15.patch
File 28595.15.patch, 2.2 KB (added by , 10 years ago) |
---|
-
src/wp-includes/js/tinymce/plugins/wpview/plugin.js
74 74 editor.nodeChanged(); 75 75 } 76 76 77 function handleEnter( view, before ) {77 function handleEnter( view, before, keyCode ) { 78 78 var dom = editor.dom, 79 padNode;80 81 if ( ! before && view.nextSibling && dom.isEmpty( view.nextSibling ) && view.nextSibling.nodeName === 'P' ) {82 padNode = view.nextSibling;83 } else if ( before && view.previousSibling && dom.isEmpty( view.previousSibling ) && view.previousSibling.nodeName === 'P' ) {84 padNode = view.previousSibling;85 } else {86 79 padNode = dom.create( 'p' ); 87 80 88 89 90 81 if ( ! ( Env.ie && Env.ie < 11 ) ) { 82 padNode.innerHTML = '<br data-mce-bogus="1">'; 83 } 91 84 92 if ( before ) { 93 view.parentNode.insertBefore( padNode, view ); 94 } else { 95 dom.insertAfter( padNode, view ); 96 } 85 if ( before ) { 86 view.parentNode.insertBefore( padNode, view ); 87 } else { 88 dom.insertAfter( padNode, view ); 97 89 } 98 90 99 91 deselect(); 100 editor.getBody().focus(); 101 editor.selection.setCursorLocation( padNode, 0 ); 92 93 if ( before && keyCode === VK.ENTER ) { 94 setViewCursor( before, view ); 95 } else { 96 editor.selection.setCursorLocation( padNode, 0 ); 97 } 98 102 99 editor.nodeChanged(); 103 100 } 104 101 … … 456 453 } else if ( cursorAfter ) { 457 454 handleEnter( view ); 458 455 } else if ( cursorBefore ) { 459 handleEnter( view , true );456 handleEnter( view , true, keyCode ); 460 457 } 461 458 462 459 if ( keyCode === VK.ENTER ) { … … 630 627 }, 500 ); 631 628 // If the cursor lands anywhere else in the view, set the cursor before it. 632 629 // Only try this once to prevent a loop. (You never know.) 633 } else if ( ! getParent( event.element, 'wpview- body' ) && ! setViewCursorTries ) {630 } else if ( ! getParent( event.element, 'wpview-clipboard' ) && ! setViewCursorTries ) { 634 631 deselect(); 635 632 setViewCursorTries++; 636 633 setViewCursor( true, view );