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
This commit is contained in:
azaozz 2014-07-22 21:52:02 +00:00
parent c2bd765b32
commit 2d466f4c86

View File

@ -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();