Merge "Fix interaction of "Add topic"/"Read as wiki page" buttons with categories"

This commit is contained in:
jenkins-bot 2023-02-02 12:09:48 +00:00 committed by Gerrit Code Review
commit 2d7fd5cabc
2 changed files with 20 additions and 2 deletions

View file

@ -872,6 +872,11 @@ h1, h2, h3, h4, h5, h6 {
}
}
// Tweak to prevent our footer buttons from overlapping Minerva skin elements (T328452).
.ext-discussiontools-init-button-notFlush {
margin-bottom: 32px;
}
.ext-discussiontools-init-lede-button-container {
margin: 0.5em 0;

View file

@ -142,13 +142,26 @@ function init( $container ) {
$( document.body ).removeClass( 'ext-discussiontools-visualenhancements-enabled ext-discussiontools-replytool-enabled' );
} );
}
/* eslint-disable no-jquery/no-global-selector */
if ( newTopicButton ) {
// eslint-disable-next-line no-jquery/no-global-selector
$( '.ext-discussiontools-init-new-topic' ).after( $readAsWikiPage );
} else {
// eslint-disable-next-line no-jquery/no-global-selector
$( '#mw-content-text' ).append( $readAsWikiPage );
}
// Tweak to prevent our footer buttons from overlapping Minerva skin elements (T328452).
// TODO: It would be more elegant to do this in just CSS somehow.
// BEWARE: I have wasted 4 hours here trying to make that happen. The elements are not nested in a
// helpful way, and moving them around tends to break the stickiness of the "Add topic" button.
if (
$( '.catlinks[data-mw="interface"]' ).length ||
$( '#page-secondary-actions > *' ).length ||
$( '.return-link' ).length
) {
$readAsWikiPage.addClass( 'ext-discussiontools-init-button-notFlush' );
}
/* eslint-enable no-jquery/no-global-selector */
}
module.exports = {