Merge "Realtime Preview: only add window-resize handler if toolbar button is used"

This commit is contained in:
jenkins-bot 2022-07-11 04:00:49 +00:00 committed by Gerrit Code Review
commit fb8dfd0e31

View file

@ -68,8 +68,6 @@ function RealtimePreview() {
this.lastWikitext = null; this.lastWikitext = null;
// Used to average response times and automatically disable realtime preview if it's very slow. // Used to average response times and automatically disable realtime preview if it's very slow.
this.responseTimes = []; this.responseTimes = [];
$( window ).on( 'resize', this.enableFeatureWhenScreenIsWideEnough.bind( this ) );
} }
/** /**
@ -105,6 +103,9 @@ RealtimePreview.prototype.getToolbarButton = function ( context ) {
this.button.toggle( false ); this.button.toggle( false );
} }
// Hide or show the preview and toolbar button when the window is resized.
$( window ).on( 'resize', this.enableFeatureWhenScreenIsWideEnough.bind( this ) );
// Add the onboarding popup. // Add the onboarding popup.
var onboardingPopup = new OnboardingPopup(); var onboardingPopup = new OnboardingPopup();
this.button.connect( onboardingPopup, { change: onboardingPopup.onPreviewButtonClick } ); this.button.connect( onboardingPopup, { change: onboardingPopup.onPreviewButtonClick } );