Fix lede section button in Parsoid output

Change-Id: I3807984a3c57de7a41e06fb4b12cc4732343e39f
This commit is contained in:
Ed Sanders 2024-12-06 13:40:32 +00:00
parent cd7b389bce
commit 74f2635026
2 changed files with 9 additions and 5 deletions

View file

@ -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;
}

View file

@ -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' );