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

Props iseulde.
Fixes #39337.
Built from https://develop.svn.wordpress.org/trunk@39903


git-svn-id: http://core.svn.wordpress.org/trunk@39840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2017-01-15 02:41:40 +00:00
parent 90f441e1b4
commit 45f3ee380c
3 changed files with 10 additions and 2 deletions

View File

@ -428,6 +428,7 @@
*/ */
replaceMarkers: function() { replaceMarkers: function() {
this.getMarkers( function( editor, node ) { this.getMarkers( function( editor, node ) {
var selected = node === editor.selection.getNode();
var $viewNode; var $viewNode;
if ( ! this.loader && $( node ).text() !== this.text ) { if ( ! this.loader && $( node ).text() !== this.text ) {
@ -440,6 +441,13 @@
); );
editor.$( node ).replaceWith( $viewNode ); editor.$( node ).replaceWith( $viewNode );
if ( selected ) {
setTimeout( function() {
editor.selection.select( $viewNode[0] );
editor.selection.collapse();
} );
}
} ); } );
}, },

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.8-alpha-39902'; $wp_version = '4.8-alpha-39903';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.