From 74f26350267d057fb9df9f977114577ed9d7c90c Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Fri, 6 Dec 2024 13:40:32 +0000 Subject: [PATCH] Fix lede section button in Parsoid output Change-Id: I3807984a3c57de7a41e06fb4b12cc4732343e39f --- modules/dt.init.less | 5 ++++- modules/mobile.js | 9 +++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/modules/dt.init.less b/modules/dt.init.less index 212f2a466..281d65106 100644 --- a/modules/dt.init.less +++ b/modules/dt.init.less @@ -788,8 +788,11 @@ h1, h2, h3, h4, h5, h6 { // .mw-body-content selector prevents this applying to content in the preview (T318758) // On non-existent pages MobileFrontend wrapping isn't there .mw-body-content > .mw-talkpageheader, + /* Legacy parser */ .mw-body-content > .mf-section-0, - .mw-body-content > .mw-parser-output > .mf-section-0 { + .mw-body-content > .mw-parser-output > .mf-section-0, + /* Parsoid */ + .mw-body-content > .mw-parser-output > section[ data-mw-section-id='0' ] { > *:not( .ext-discussiontools-emptystate ) { display: none; } diff --git a/modules/mobile.js b/modules/mobile.js index 784f0a754..c3c6e03bc 100644 --- a/modules/mobile.js +++ b/modules/mobile.js @@ -36,9 +36,10 @@ function init( $container ) { $( visualViewport ).on( 'resize', onViewportChangeThrottled ); } - // Mobile overflow menu - - const $ledeContent = $container.find( '.mf-section-0' ).children( ':not( .ext-discussiontools-emptystate )' ) + // Lede section button + // mf-section-0: Legacy parser + // data-mw-section-id: Parsoid + const $ledeContent = $container.find( '.mf-section-0, [data-mw-section-id="0"]' ).children( ':not( .ext-discussiontools-emptystate )' ) // On non-existent pages MobileFrontend wrapping isn't there .add( $container.find( '.mw-talkpageheader' ) ); const $ledeButton = $container.find( '.ext-discussiontools-init-lede-button' ); @@ -50,7 +51,6 @@ function init( $container ) { windowManager.addWindows( [ ledeSectionDialog ] ); } - // Lede section popup OO.ui.infuse( $ledeButton ).on( 'click', () => { mw.loader.using( 'oojs-ui-windows' ).then( () => { windowManager.openWindow( 'ledeSection', { $content: $ledeContent } ); @@ -60,6 +60,7 @@ function init( $container ) { mw.track( 'webuiactions_log.show', 'lede-button' ); } + // New topic button // eslint-disable-next-line no-jquery/no-global-selector const $newTopicWrapper = $( '.ext-discussiontools-init-new-topic' );