Make WordPress Core

Changeset 32818


Ignore:
Timestamp:
06/17/2015 07:07:50 AM (8 years ago)
Author:
iseulde
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js

    r32816 r32818  
    447447        var Factory = tinymce.ui.Factory,
    448448            settings = editor.settings,
    449             currentToolbar,
     449            activeToolbar,
    450450            currentSelection,
    451451            wpAdminbar = document.getElementById( 'wpadminbar' ),
     
    668668
    669669            toolbar.on( 'show', function() {
    670                 currentToolbar = this;
    671670                this.reposition();
    672             } );
    673 
    674             toolbar.on( 'hide', function() {
    675                 currentToolbar = false;
    676671            } );
    677672
     
    704699            var node;
    705700
    706             if ( currentToolbar ) {
    707                 node = currentToolbar.find( 'toolbar' )[0];
     701            if ( activeToolbar ) {
     702                node = activeToolbar.find( 'toolbar' )[0];
    708703                node && node.focus( true );
    709704            }
     
    723718            currentSelection = args.selection || args.element;
    724719
    725             currentToolbar && currentToolbar.hide();
    726             args.toolbar && args.toolbar.show();
     720            if ( activeToolbar ) {
     721                activeToolbar.hide();
     722            }
     723
     724            if ( args.toolbar ) {
     725                activeToolbar = args.toolbar;
     726                activeToolbar.show();
     727            } else {
     728                activeToolbar = false;
     729            }
     730        } );
     731
     732        editor.on( 'focus', function() {
     733            if ( activeToolbar ) {
     734                activeToolbar.show();
     735            }
     736        } );
     737
     738        editor.on( 'hide', function() {
     739            activeToolbar = false;
    727740        } );
    728741
Note: See TracChangeset for help on using the changeset viewer.