mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-13 18:37:07 +00:00
Merge "Put mobile ellipsis button menu in an overlay"
This commit is contained in:
commit
db961ecd24
|
@ -171,6 +171,8 @@ h1, h2, h3, h4, h5, h6 {
|
|||
min-width: 20em;
|
||||
|
||||
.skin-minerva& {
|
||||
// Prevent the ellipsis button's focus ring from being clipped.
|
||||
// We have no floated links/buttons on mobile, so this is okay.
|
||||
overflow: visible;
|
||||
}
|
||||
}
|
||||
|
@ -560,6 +562,14 @@ h1, h2, h3, h4, h5, h6 {
|
|||
}
|
||||
}
|
||||
|
||||
&.skin-minerva .ext-discussiontools-init-section-overflowMenu {
|
||||
// Not sure if this should have custom styles like this…
|
||||
// They were once accidentally inherited from the heading,
|
||||
// before the menu was moved to an overlay.
|
||||
font-weight: bold;
|
||||
font-size: 0.875em;
|
||||
}
|
||||
|
||||
&.skin-minerva .mf-section-0 + .ext-discussiontools-init-section {
|
||||
border-top: 0;
|
||||
margin-top: 0;
|
||||
|
|
|
@ -49,9 +49,13 @@ function init( $container, pageThreads ) {
|
|||
}
|
||||
var threadItem = pageThreads.findCommentById( $threadMarker.data( 'mw-thread-id' ) );
|
||||
|
||||
var buttonMenu = OO.ui.infuse( this, { menu: {
|
||||
horizontalPosition: threadItem.type === 'heading' ? 'end' : 'start'
|
||||
} } );
|
||||
var buttonMenu = OO.ui.infuse( this, {
|
||||
$overlay: true,
|
||||
menu: {
|
||||
classes: [ 'ext-discussiontools-init-section-overflowMenu' ],
|
||||
horizontalPosition: threadItem.type === 'heading' ? 'end' : 'start'
|
||||
}
|
||||
} );
|
||||
|
||||
mw.loader.using( buttonMenu.getData().resourceLoaderModules || [] ).then( function () {
|
||||
var itemConfigs = buttonMenu.getData().itemConfigs;
|
||||
|
@ -186,10 +190,11 @@ function init( $container, pageThreads ) {
|
|||
}
|
||||
|
||||
// Handler for "edit" link in overflow menu, only setup once as the hook is global
|
||||
mw.hook( 'discussionToolsOverflowMenuOnChoose' ).add( function ( id, menuItem ) {
|
||||
mw.hook( 'discussionToolsOverflowMenuOnChoose' ).add( function ( id, menuItem, threadItem ) {
|
||||
if ( id === 'edit' ) {
|
||||
// Click the hidden section-edit link
|
||||
menuItem.$element.closest( '.ext-discussiontools-init-section' ).find( '.mw-editsection > a' ).trigger( 'click' );
|
||||
$( threadItem.getNativeRange().commonAncestorContainer )
|
||||
.closest( '.ext-discussiontools-init-section' ).find( '.mw-editsection > a' ).trigger( 'click' );
|
||||
}
|
||||
} );
|
||||
|
||||
|
|
Loading…
Reference in a new issue