Make WordPress Core

Ticket #45461: 45461.diff

File 45461.diff, 1.4 KB (added by azaozz, 6 years ago)
  • src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js

     
    1919        }
    2020
    2121        function toggleToolbars( state ) {
    22                 var initial, toolbars,
     22                var initial, toolbars, iframeHeight,
    2323                        pixels = 0,
    2424                        classicBlockToolbar = tinymce.$( '.block-library-classic__toolbar' );
    2525
     
    4444                                if ( i > 0 ) {
    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                                }
    5353                        });
     
    5454                }
    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
    6167                if ( ! initial ) {