Ticket #28567: 28567.4.patch
File 28567.4.patch, 5.5 KB (added by , 10 years ago) |
---|
-
src/wp-includes/css/editor.css
169 169 margin: 0; 170 170 } 171 171 172 .wpview-selected .mce-statusbar .mce-divider, 173 .wpview-selected .mce-statusbar .mce-path-item { 174 display: none; 175 } 176 177 .wpview-selected .mce-statusbar .mce-path-item.mce-last { 178 display: inline-block; 179 pointer-events: none; 180 } 181 172 182 .mce-toolbar .mce-btn, 173 183 .qt-fullscreen { 174 184 border-color: transparent; -
src/wp-includes/js/tinymce/plugins/wpview/plugin.js
55 55 function setViewCursor( before, view ) { 56 56 var location = before ? 'before' : 'after', 57 57 offset = before ? 0 : 1; 58 deselect(); 58 59 editor.selection.setCursorLocation( editor.dom.select( '.wpview-selection-' + location, view )[0], offset ); 59 60 editor.nodeChanged(); 60 61 } … … 111 112 dom.bind( clipboard, 'beforedeactivate focusin focusout', _stop ); 112 113 dom.bind( selected, 'beforedeactivate focusin focusout', _stop ); 113 114 115 tinymce.DOM.addClass( editor.getContainer(), 'wpview-selected' ); 116 114 117 // Make sure that the editor is focused. 115 118 // It is possible that the editor is not focused when the mouse event fires 116 119 // without focus, the selection will not work properly. … … 274 277 var view = getView( event.target ), 275 278 deselectEventType; 276 279 280 firstFocus = false; 281 277 282 // Contain clicks inside the view wrapper 278 283 if ( view ) { 279 284 event.stopPropagation(); … … 484 489 485 490 if ( keyCode === VK.LEFT ) { 486 491 setViewCursor( true, view ); 487 deselect();488 492 } else if ( keyCode === VK.UP ) { 489 493 if ( view.previousSibling ) { 490 494 if ( getView( view.previousSibling ) ) { 491 495 setViewCursor( true, view.previousSibling ); 492 496 } else { 497 deselect(); 493 498 selection.select( view.previousSibling, true ); 494 499 selection.collapse(); 495 500 } 496 501 } else { 497 502 setViewCursor( true, view ); 498 503 } 499 deselect();504 500 505 } else if ( keyCode === VK.RIGHT ) { 501 506 setViewCursor( false, view ); 502 deselect();503 507 } else if ( keyCode === VK.DOWN ) { 504 508 if ( view.nextSibling ) { 505 509 if ( getView( view.nextSibling ) ) { 506 510 setViewCursor( false, view.nextSibling ); 507 511 } else { 512 deselect(); 508 513 selection.setCursorLocation( view.nextSibling, 0 ); 509 514 } 510 515 } else { 511 516 setViewCursor( false, view ); 512 517 } 513 deselect();514 518 } else if ( keyCode === VK.ENTER ) { 515 519 handleEnter( view ); 516 520 } else if ( keyCode === VK.DELETE || keyCode === VK.BACKSPACE ) { … … 586 590 dom.removeClass( views, 'wpview-selection-after' ); 587 591 dom.removeClass( views, 'wpview-cursor-hide' ); 588 592 589 if ( view && editor.selection.isCollapsed() && focus ) { 590 if ( className === 'wpview-selection-before' || className === 'wpview-selection-after' ) { 591 setViewCursorTries = 0; 592 593 // Make sure the cursor arrived in the right node. 594 // This is necessary for Firefox. 595 if ( lKDN === view.previousSibling ) { 596 setViewCursor( true, view ); 597 return; 598 } else if ( lKDN === view.nextSibling ) { 599 setViewCursor( false, view ); 600 return; 601 } 593 if ( ! selected ) { 594 tinymce.DOM.removeClass( editor.getContainer(), 'wpview-selected' ); 595 } 596 597 if ( focus ) { 598 if ( view ) { 599 if ( className === 'wpview-selection-before' || className === 'wpview-selection-after' && editor.selection.isCollapsed() ) { 600 setViewCursorTries = 0; 602 601 603 dom.addClass( view, className);602 deselect(); 604 603 605 cursorInterval = setInterval( function() { 606 if ( dom.hasClass( view, 'wpview-cursor-hide' ) ) { 607 dom.removeClass( view, 'wpview-cursor-hide' ); 608 } else { 609 dom.addClass( view, 'wpview-cursor-hide' ); 604 tinymce.DOM.addClass( editor.getContainer(), 'wpview-selected' ); 605 606 // Make sure the cursor arrived in the right node. 607 // This is necessary for Firefox. 608 if ( lKDN === view.previousSibling ) { 609 setViewCursor( true, view ); 610 return; 611 } else if ( lKDN === view.nextSibling ) { 612 setViewCursor( false, view ); 613 return; 610 614 } 611 }, 500 ); 612 // If the cursor happens to be anywhere around the view, then set the cursor properly. 613 // Only try this once to prevent a loop. (You never know.) 614 } else if ( ! selected && ! setViewCursorTries ) { 615 setViewCursorTries++; 616 setViewCursor( true, view ); 615 616 dom.addClass( view, className ); 617 618 cursorInterval = setInterval( function() { 619 if ( dom.hasClass( view, 'wpview-cursor-hide' ) ) { 620 dom.removeClass( view, 'wpview-cursor-hide' ); 621 } else { 622 dom.addClass( view, 'wpview-cursor-hide' ); 623 } 624 }, 500 ); 625 // If the cursor lands anywhere else in the view, set the cursor before it. 626 // Only try this once to prevent a loop. (You never know.) 627 } else if ( className !== 'wpview-clipboard' && ! setViewCursorTries ) { 628 deselect(); 629 setViewCursorTries++; 630 setViewCursor( true, view ); 631 } 632 } else { 633 deselect(); 617 634 } 618 635 } 619 636 }); 620 637 638 editor.on( 'resolvename', function( event ) { 639 var className = event.target.className; 640 641 if ( className === 'wpview-clipboard' || className === 'wpview-selection-before' || className === 'wpview-selection-after' ) { 642 event.name = editor.dom.getAttrib( getView( event.target ), 'data-wpview-type' ); 643 } 644 }); 645 621 646 return { 622 647 getViewText: getViewText, 623 648 setViewText: setViewText