WordPress.org

Make WordPress Core

Changeset 39903


Ignore:
Timestamp:
01/15/2017 02:40:30 AM (17 months ago)
Author:
azaozz
Message:

TinyMCE: when inserting a wpview, place the caret after is so the user can continue typing without interruption.

Props iseulde.
Fixes #39337.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/mce-view.js

    r39282 r39903  
    429429        replaceMarkers: function() {
    430430            this.getMarkers( function( editor, node ) {
     431                var selected = node === editor.selection.getNode();
    431432                var $viewNode;
    432433
     
    441442
    442443                editor.$( node ).replaceWith( $viewNode );
     444
     445                if ( selected ) {
     446                    setTimeout( function() {
     447                        editor.selection.select( $viewNode[0] );
     448                        editor.selection.collapse();
     449                    } );
     450                }
    443451            } );
    444452        },
Note: See TracChangeset for help on using the changeset viewer.