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.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32789 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ella Iseulde Van Dorpe 2015-06-17 07:08:25 +00:00
parent c465640107
commit 8fba763f37
4 changed files with 25 additions and 12 deletions

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 || {};

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.3-alpha-32817';
$wp_version = '4.3-alpha-32818';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.