From 2d466f4c86b479f14409560664c80c372238c91f Mon Sep 17 00:00:00 2001 From: azaozz Date: Tue, 22 Jul 2014 21:52:02 +0000 Subject: [PATCH] wpView: make sure the editor is focused before selecting/deselecting a view, or IE may throw an invalid range error, see #28595. git-svn-id: https://develop.svn.wordpress.org/trunk@29273 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/js/tinymce/plugins/wpview/plugin.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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();