diff --git a/src/wp-includes/js/mce-view.js b/src/wp-includes/js/mce-view.js index 8c8de56a0e..16d860d470 100644 --- a/src/wp-includes/js/mce-view.js +++ b/src/wp-includes/js/mce-view.js @@ -428,6 +428,7 @@ */ replaceMarkers: function() { this.getMarkers( function( editor, node ) { + var selected = node === editor.selection.getNode(); var $viewNode; if ( ! this.loader && $( node ).text() !== this.text ) { @@ -440,6 +441,13 @@ ); editor.$( node ).replaceWith( $viewNode ); + + if ( selected ) { + setTimeout( function() { + editor.selection.select( $viewNode[0] ); + editor.selection.collapse(); + } ); + } } ); },