Make WordPress Core

Changeset 44832


Ignore:
Timestamp:
03/12/2019 08:13:14 PM (6 years ago)
Author:
azaozz
Message:

TinyMCE: fix editor height when loaded hidden.

Props nnikolov, azaozz.
Fixes #45461.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js

    r44697 r44832  
    2020
    2121    function toggleToolbars( state ) {
    22         var initial, toolbars,
     22        var initial, toolbars, iframeHeight,
    2323            pixels = 0,
    2424            classicBlockToolbar = tinymce.$( '.block-library-classic__toolbar' );
     
    4545                    if ( state === 'hide' ) {
    4646                        toolbar.hide();
    47                         pixels += 30;
     47                        pixels += 34;
    4848                    } else {
    4949                        toolbar.show();
    50                         pixels -= 30;
     50                        pixels -= 34;
    5151                    }
    5252                }
     
    5555
    5656        // Resize editor iframe, not needed for iOS and inline instances.
    57         if ( pixels && ! tinymce.Env.iOS && editor.iframeElement ) {
    58             DOM.setStyle( editor.iframeElement, 'height', editor.iframeElement.clientHeight + pixels );
     57        // Don't resize if the editor is in a hidden container.
     58        if ( pixels && ! tinymce.Env.iOS && editor.iframeElement && editor.iframeElement.clientHeight ) {
     59            iframeHeight = editor.iframeElement.clientHeight + pixels;
     60
     61            // Keep min-height.
     62            if ( iframeHeight > 50  ) {
     63                DOM.setStyle( editor.iframeElement, 'height', iframeHeight );
     64            }
    5965        }
    6066
Note: See TracChangeset for help on using the changeset viewer.