TinyMCE: when inserting a wpview, place the caret after is so the user can continue typing without interruption.
Props iseulde. Fixes #39337. git-svn-id: https://develop.svn.wordpress.org/trunk@39903 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
976976b4a1
commit
7592ee11bd
@ -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();
|
||||||
|
} );
|
||||||
|
}
|
||||||
} );
|
} );
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user