mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-11 17:02:28 +00:00
Merge "Remove jquery.makeCollapsible workarounds for mobile"
This commit is contained in:
commit
a3adda8ed7
|
@ -205,13 +205,6 @@ class PageHooks implements
|
|||
] ) )
|
||||
)
|
||||
);
|
||||
|
||||
// Preload jquery.makeCollapsible for LedeSectionDialog.
|
||||
// Using the same approach as in Skin::getDefaultModules in MediaWiki core.
|
||||
if ( str_contains( $output->getHTML(), 'mw-collapsible' ) ) {
|
||||
$output->addModules( 'jquery.makeCollapsible' );
|
||||
$output->addModuleStyles( 'jquery.makeCollapsible.styles' );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -36,20 +36,10 @@ LedeSectionDialog.prototype.getSetupProcess = function ( data ) {
|
|||
return LedeSectionDialog.super.prototype.getSetupProcess.call( this, data )
|
||||
.next( () => {
|
||||
this.contentLayout.$element.empty().append( data.$content );
|
||||
|
||||
// Enable collapsible content (T323639), which is normally not handled on mobile (T111565).
|
||||
// It's safe to do this twice if that changes (makeCollapsible() checks if each element was
|
||||
// already handled). Using the same approach as in 'mediawiki.page.ready' in MediaWiki core.
|
||||
const $collapsible = this.contentLayout.$element.find( '.mw-collapsible' );
|
||||
if ( $collapsible.length ) {
|
||||
// This module is also preloaded in PageHooks to avoid visual jumps when things collapse.
|
||||
mw.loader.using( 'jquery.makeCollapsible' ).then( () => {
|
||||
$collapsible.makeCollapsible();
|
||||
$collapsible.on( 'afterExpand.mw-collapsible afterCollapse.mw-collapsible', () => {
|
||||
this.updateSize();
|
||||
} );
|
||||
} );
|
||||
}
|
||||
// Resize dialog if collapsible banners are toggled, see T323639 for context
|
||||
this.contentLayout.$element.on( 'afterExpand.mw-collapsible afterCollapse.mw-collapsible', () => {
|
||||
this.updateSize();
|
||||
} );
|
||||
} );
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue