Bartosz Dziewoński has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/380650 )

Change subject: [WIP] mediawiki.special.apisandbox: Stop using double scrollbars
......................................................................

[WIP] mediawiki.special.apisandbox: Stop using double scrollbars

OOjs UI BookletLayout no longer has to be 'expanded' to the dimensions
of its parent element, and can instead naturally accommodate its
contents. This means we no longer have to explicitly set the size of
the panel.

Depends on I19cd1f2f3f7c4afa22a507a89c75fb206386eb0d in OOjs UI.

WIP because the toolbar and menu no longer stay onscreen when scrolling
in fullscreen mode. We'll probably have to toggle 'expanded' for all the
nested panels to fix this.

Bug: T129157
Change-Id: I18ae3f8b891fcd4b06cd826ecb7da9ac94232581
---
M resources/src/mediawiki.special/mediawiki.special.apisandbox.css
M resources/src/mediawiki.special/mediawiki.special.apisandbox.js
2 files changed, 7 insertions(+), 29 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/50/380650/1

diff --git a/resources/src/mediawiki.special/mediawiki.special.apisandbox.css 
b/resources/src/mediawiki.special/mediawiki.special.apisandbox.css
index 750a567..96dcbf0 100644
--- a/resources/src/mediawiki.special/mediawiki.special.apisandbox.css
+++ b/resources/src/mediawiki.special/mediawiki.special.apisandbox.css
@@ -25,6 +25,7 @@
        right: 0;
        background: #fff;
        z-index: 100;
+       overflow: auto;
 }
 
 .mw-apisandbox-fullscreen .mw-apisandbox-container {
diff --git a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js 
b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js
index 7029116..e680013 100644
--- a/resources/src/mediawiki.special/mediawiki.special.apisandbox.js
+++ b/resources/src/mediawiki.special/mediawiki.special.apisandbox.js
@@ -2,7 +2,7 @@
 ( function ( $, mw, OO ) {
        'use strict';
        var ApiSandbox, Util, WidgetMethods, Validators,
-               $content, panel, booklet, oldhash, windowManager, 
fullscreenButton,
+               $toolbar, $content, panel, booklet, oldhash, windowManager, 
fullscreenButton,
                formatDropdown,
                api = new mw.Api(),
                bookletPages = [],
@@ -735,8 +735,6 @@
                 * Automatically called on $.ready()
                 */
                init: function () {
-                       var $toolbar;
-
                        ApiSandbox.isFullscreen = false;
 
                        $content = $( '#mw-apisandbox' );
@@ -767,6 +765,7 @@
                                );
 
                        booklet = new OO.ui.BookletLayout( {
+                               expanded: false,
                                outlined: true,
                                autoFocus: false
                        } );
@@ -807,10 +806,6 @@
                                                .append( $toolbar )
                                                .append( panel.$element )
                                );
-
-                       $( window ).on( 'resize', ApiSandbox.resizePanel );
-
-                       ApiSandbox.resizePanel();
                },
 
                /**
@@ -832,26 +827,6 @@
                                fullscreenButton.setLabel( mw.message( 
'apisandbox-fullscreen' ).text() );
                                fullscreenButton.setTitle( mw.message( 
'apisandbox-fullscreen-tooltip' ).text() );
                                $content.append( $ui );
-                       }
-                       ApiSandbox.resizePanel();
-               },
-
-               /**
-                * Set the height of the panel based on the current viewport.
-                */
-               resizePanel: function () {
-                       var height = $( window ).height(),
-                               contentTop = $content.offset().top;
-
-                       if ( ApiSandbox.isFullscreen ) {
-                               height -= panel.$element.offset().top - $( 
'#mw-apisandbox-ui' ).offset().top;
-                               panel.$element.height( height - 1 );
-                       } else {
-                               // Subtract the height of the intro text
-                               height -= panel.$element.offset().top - 
contentTop;
-
-                               panel.$element.height( height - 10 );
-                               $( window ).scrollTop( contentTop - 5 );
                        }
                },
 
@@ -1053,7 +1028,9 @@
                                $result = $( '<div>' )
                                        .append( progress.$element );
 
-                               resultPage = page = new OO.ui.PageLayout( 
'|results|' );
+                               resultPage = page = new OO.ui.PageLayout( 
'|results|', {
+                                       expanded: false
+                               } );
                                page.setupOutlineItem = function () {
                                        this.outlineItem.setLabel( mw.message( 
'apisandbox-results' ).text() );
                                };
@@ -1305,7 +1282,7 @@
         * @param {Object} [config] Configuration options
         */
        ApiSandbox.PageLayout = function ( config ) {
-               config = $.extend( { prefix: '' }, config );
+               config = $.extend( { prefix: '', expanded: false }, config );
                this.displayText = config.key;
                this.apiModule = config.path;
                this.prefix = config.prefix;

-- 
To view, visit https://gerrit.wikimedia.org/r/380650
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I18ae3f8b891fcd4b06cd826ecb7da9ac94232581
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <matma....@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to