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 | | } |
| 591 | if ( ! selected ) { |
| 592 | tinymce.DOM.removeClass( editor.getContainer(), 'wpview-selected' ); |
| 593 | } |
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' ); |
| 600 | deselect(); |
| 601 | |
| 602 | tinymce.DOM.addClass( editor.getContainer(), 'wpview-selected' ); |
| 603 | |
| 604 | // Make sure the cursor arrived in the right node. |
| 605 | // This is necessary for Firefox. |
| 606 | if ( lKDN === view.previousSibling ) { |
| 607 | setViewCursor( true, view ); |
| 608 | return; |
| 609 | } else if ( lKDN === view.nextSibling ) { |
| 610 | setViewCursor( false, view ); |
| 611 | return; |
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 ); |
| 613 | |
| 614 | dom.addClass( view, className ); |
| 615 | |
| 616 | cursorInterval = setInterval( function() { |
| 617 | if ( dom.hasClass( view, 'wpview-cursor-hide' ) ) { |
| 618 | dom.removeClass( view, 'wpview-cursor-hide' ); |
| 619 | } else { |
| 620 | dom.addClass( view, 'wpview-cursor-hide' ); |
| 621 | } |
| 622 | }, 500 ); |
| 623 | // If the cursor lands anywhere else in the view, set the cursor before it. |
| 624 | // Only try this once to prevent a loop. (You never know.) |
| 625 | } else if ( className !== 'wpview-clipboard' && ! setViewCursorTries ) { |
| 626 | deselect(); |
| 627 | setViewCursorTries++; |
| 628 | setViewCursor( true, view ); |
| 629 | } |
| 630 | } else { |
| 631 | deselect(); |