Skip to content

Commit

Permalink
TinyMCE: Fix cursor position after updating a wpview node. Fix hiding…
Browse files Browse the repository at this point in the history
… the inline toolbar on editor blur.

Props iseulde, azaozz.
Fixes #40480 for trunk.
Built from https://develop.svn.wordpress.org/trunk@40481


git-svn-id: http://core.svn.wordpress.org/trunk@40357 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
azaozz committed Apr 19, 2017
1 parent 1d739a0 commit c0399b4
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions wp-includes/js/mce-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/js/mce-view.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wp-includes/js/tinymce/plugins/wordpress/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 ( (
Expand Down
Loading

0 comments on commit c0399b4

Please sign in to comment.