Make WordPress Core

Ticket #27348: 27348.2.patch

File 27348.2.patch, 2.8 KB (added by ocean90, 11 years ago)
  • src/wp-admin/css/customize-widgets.css

     
    5454        position: fixed;
    5555        left: 299px;
    5656        top: 25%;
    57         padding: 20px;
    5857        border: 1px solid rgb(229, 229, 229);
    5958        z-index: -1;
     59        overflow: auto;
    6060}
     61.customize-control-widget_form.wide-widget-control .widget-inside > .form {
     62        padding: 20px;
     63}
    6164.customize-control-widget_form.wide-widget-control.collapsing .widget-inside {
    6265        z-index: -2;
    6366}
  • src/wp-admin/js/customize-widgets.js

     
    649649                _setupWideWidget: function () {
    650650                        var control = this,
    651651                                widget_inside,
     652                                widget_form,
    652653                                customize_sidebar,
    653654                                position_widget,
    654655                                theme_controls_container;
     
    658659                        }
    659660
    660661                        widget_inside = control.container.find( '.widget-inside' );
     662                        widget_form = widget_inside.find( '> .form' );
    661663                        customize_sidebar = $( '.wp-full-overlay-sidebar-content:first' );
    662664                        control.container.addClass( 'wide-widget-control' );
    663665
     
    671673                         * element is at the same top position as the widget-top. When the
    672674                         * widget-top is scrolled out of view, keep the widget-top in view;
    673675                         * likewise, don't allow the widget to drop off the bottom of the window.
     676                         * If a widget is too tall to fit in the window, don't let the height
     677                         * exceed the window height so that the contents of the widget control
     678                         * will become scrollable (overflow:auto).
    674679                         */
    675680                        position_widget = function () {
    676681                                var offset_top = control.container.offset().top,
    677                                         height,
    678                                         top,
    679                                         max_top;
    680 
    681                                 height = widget_inside.outerHeight();
    682                                 top = Math.max( offset_top, 0 );
    683                                 max_top = $( window ).height() - height;
    684                                 top = Math.min( top, max_top );
     682                                        window_height = $( window ).height(),
     683                                        form_height = widget_form.outerHeight(),
     684                                        top;
     685                                widget_inside.css( 'max-height', window_height );
     686                                top = Math.max(
     687                                        0, // prevent top from going off screen
     688                                        Math.min(
     689                                                Math.max( offset_top, 0 ), // distance widget in panel is from top of screen
     690                                                window_height - form_height // flush up against bottom of screen
     691                                        )
     692                                );
    685693                                widget_inside.css( 'top', top );
    686694                        };
    687695
     
    690698                                customize_sidebar.on( 'scroll', position_widget );
    691699                                $( window ).on( 'resize', position_widget );
    692700                                theme_controls_container.on( 'expanded collapsed', position_widget );
    693                                 position_widget();
    694701                        } );
    695702                        control.container.on( 'collapsed', function () {
    696703                                customize_sidebar.off( 'scroll', position_widget );