mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-24 00:13:36 +00:00
Enable collapsible content in mobile talk page lede content
Bug: T323639 Change-Id: I3cfc8e7337172b44156a7f3bed9ff134c0851475
This commit is contained in:
parent
2c9ec88c0f
commit
af7097f02f
|
@ -230,6 +230,13 @@ class PageHooks implements
|
|||
] ) )
|
||||
)
|
||||
);
|
||||
|
||||
// Preload jquery.makeCollapsible for LedeSectionDialog.
|
||||
// Using the same approach as in Skin::getDefaultModules in MediaWiki core.
|
||||
if ( strpos( $output->getHTML(), 'mw-collapsible' ) !== false ) {
|
||||
$output->addModules( 'jquery.makeCollapsible' );
|
||||
$output->addModuleStyles( 'jquery.makeCollapsible.styles' );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,22 @@ LedeSectionDialog.prototype.initialize = function () {
|
|||
LedeSectionDialog.prototype.getSetupProcess = function ( data ) {
|
||||
return LedeSectionDialog.super.prototype.getSetupProcess.call( this, data )
|
||||
.next( function () {
|
||||
var dialog = this;
|
||||
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.
|
||||
var $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( function () {
|
||||
$collapsible.makeCollapsible();
|
||||
$collapsible.on( 'afterExpand.mw-collapsible afterCollapse.mw-collapsible', function () {
|
||||
dialog.updateSize();
|
||||
} );
|
||||
} );
|
||||
}
|
||||
}, this );
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue