wpView: make sure the editor is focused before selecting/deselecting a view, or IE may throw an invalid range error, see #28595.

Built from https://develop.svn.wordpress.org/trunk@29273


git-svn-id: http://core.svn.wordpress.org/trunk@29055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2014-07-22 21:53:16 +00:00
parent c40feac4d9
commit 8e973f2c29
3 changed files with 6 additions and 6 deletions

View File

@ -119,6 +119,11 @@ tinymce.PluginManager.add( 'wpview', function( editor ) {
return; 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(); deselect();
selected = viewNode; selected = viewNode;
dom.setAttrib( viewNode, 'data-mce-selected', 1 ); 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( clipboard, 'beforedeactivate focusin focusout', _stop );
dom.bind( selected, '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 // select the hidden div
editor.selection.select( clipboard, true ); editor.selection.select( clipboard, true );
editor.nodeChanged(); editor.nodeChanged();

File diff suppressed because one or more lines are too long