TinyMCE: Fix cursor position after updating a wpview node. Fix hiding the inline toolbar on editor blur.

Props iseulde, azaozz.
Fixes #40480 for trunk.

git-svn-id: https://develop.svn.wordpress.org/trunk@40481 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2017-04-19 22:09:44 +00:00
parent 66eb13d3b2
commit 2c50a6dd24
2 changed files with 4 additions and 1 deletions

View File

@ -729,6 +729,9 @@
$( node ).data( 'rendered', false );
editor.dom.setAttrib( node, 'data-wpview-text', encodeURIComponent( text ) );
wp.mce.views.createInstance( type, text, match.options, force ).render();
editor.selection.select( node );
editor.nodeChanged();
editor.focus();
return true;

View File

@ -992,7 +992,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
function hide( event ) {
if ( activeToolbar ) {
if ( activeToolbar.tempHide || event.type === 'hide' ) {
if ( activeToolbar.tempHide || event.type === 'hide' || event.type === 'blur' ) {
activeToolbar.hide();
activeToolbar = false;
} else if ( (