TinyMCE: show active inline toolbar after focus

This makes sure that e.g. the image toolbar shows up again after closing the media library modal.

See #32604.


git-svn-id: https://develop.svn.wordpress.org/trunk@32818 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ella Iseulde Van Dorpe 2015-06-17 07:07:50 +00:00
parent f81208f55a
commit 361e7d9717

View File

@ -446,7 +446,7 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
( function() {
var Factory = tinymce.ui.Factory,
settings = editor.settings,
currentToolbar,
activeToolbar,
currentSelection,
wpAdminbar = document.getElementById( 'wpadminbar' ),
mceIframe, mceToolbar, mceStatusbar, wpStatusbar;
@ -667,14 +667,9 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
}
toolbar.on( 'show', function() {
currentToolbar = this;
this.reposition();
} );
toolbar.on( 'hide', function() {
currentToolbar = false;
} );
toolbar.on( 'keydown', function( event ) {
if ( event.keyCode === 27 ) {
this.hide();
@ -703,8 +698,8 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
editor.shortcuts.add( 'alt+119', '', function() {
var node;
if ( currentToolbar ) {
node = currentToolbar.find( 'toolbar' )[0];
if ( activeToolbar ) {
node = activeToolbar.find( 'toolbar' )[0];
node && node.focus( true );
}
} );
@ -722,8 +717,26 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
currentSelection = args.selection || args.element;
currentToolbar && currentToolbar.hide();
args.toolbar && args.toolbar.show();
if ( activeToolbar ) {
activeToolbar.hide();
}
if ( args.toolbar ) {
activeToolbar = args.toolbar;
activeToolbar.show();
} else {
activeToolbar = false;
}
} );
editor.on( 'focus', function() {
if ( activeToolbar ) {
activeToolbar.show();
}
} );
editor.on( 'hide', function() {
activeToolbar = false;
} );
editor.wp = editor.wp || {};