Make WordPress Core

Changeset 29738


Ignore:
Timestamp:
09/12/2014 01:20:09 AM (12 years ago)
Author:
azaozz
Message:

Editor expand: hide TinyMCE float panels and tooltips when scrolling, props avryl, fixes #29516 for trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/js/editor-expand.js

    r29698 r29738  
    33window.wp = window.wp || {};
    44
    5 jQuery( document ).ready( function($) {
     5jQuery( document ).ready( function( $ ) {
    66    var $window = $( window ),
    77        $document = $( document ),
     
    149149    // We need to wait for TinyMCE to initialize.
    150150    $document.on( 'tinymce-editor-init.editor-expand', function( event, editor ) {
     151        var hideFloatPanels = _.debounce( function() {
     152            ! $( '.mce-floatpanel:hover' ).length && tinymce.ui.FloatPanel.hideAll();
     153            $( '.mce-tooltip' ).hide();
     154        }, 1000, true );
     155
    151156        // Make sure it's the main editor.
    152157        if ( editor.id !== 'content' ) {
     
    225230        // Adjust when switching editor modes.
    226231        function mceShow() {
     232            $window.on( 'scroll.mce-float-panels', hideFloatPanels );
     233
    227234            setTimeout( function() {
    228235                editor.execCommand( 'wpAutoResize' );
     
    232239
    233240        function mceHide() {
     241            $window.off( 'scroll.mce-float-panels' );
     242
    234243            setTimeout( function() {
    235244                var top = $contentWrap.offset().top;
     
    252261            // Adjust when the editor resizes.
    253262            editor.on( 'setcontent wp-autoresize wp-toolbar-toggle', adjust );
     263
     264            $window.off( 'scroll.mce-float-panels' ).on( 'scroll.mce-float-panels', hideFloatPanels );
    254265        };
    255266
     
    259270            editor.off( 'hide', mceHide );
    260271            editor.off( 'setcontent wp-autoresize wp-toolbar-toggle', adjust );
     272
     273            $window.off( 'scroll.mce-float-panels' );
    261274        };
    262275
Note: See TracChangeset for help on using the changeset viewer.