diff --git a/src/wp-includes/js/tinymce/plugins/wpview/plugin.js b/src/wp-includes/js/tinymce/plugins/wpview/plugin.js index 295bb8e1f8..2d5ce5c12e 100644 --- a/src/wp-includes/js/tinymce/plugins/wpview/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpview/plugin.js @@ -119,6 +119,11 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { return; } + // Make sure that the editor is focused. + // It is possible that the editor is not focused when the mouse event fires + // without focus, the selection will not work properly. + editor.getBody().focus(); + deselect(); selected = viewNode; dom.setAttrib( viewNode, 'data-mce-selected', 1 ); @@ -134,11 +139,6 @@ tinymce.PluginManager.add( 'wpview', function( editor ) { dom.bind( clipboard, 'beforedeactivate focusin focusout', _stop ); dom.bind( selected, 'beforedeactivate focusin focusout', _stop ); - // Make sure that the editor is focused. - // It is possible that the editor is not focused when the mouse event fires - // without focus, the selection will not work properly. - editor.getBody().focus(); - // select the hidden div editor.selection.select( clipboard, true ); editor.nodeChanged();