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