mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-09-23 10:29:11 +00:00
VisualEnhancements: in some languages put an arrow by the reply button
New config: DiscussionTools_visualenhancements_reply_icon_languages
Config is set up with a provide_default merge strategy so we can remove
items from it quickly if need be.
Bug: T323537
Change-Id: Ib748897a2162bb233000f7364e30b268932f4c4a
(cherry picked from commit c706562ce9
)
This commit is contained in:
parent
3b48d1ab47
commit
15c8ace753
|
@ -532,6 +532,11 @@
|
|||
"value": "default",
|
||||
"description": "Override availability of DiscussionTools visual enhancements's reply buttons sub-feature. 'default', 'available', or 'unavailable'."
|
||||
},
|
||||
"DiscussionTools_visualenhancements_reply_icon_languages": {
|
||||
"value": [ "ar", "zh", "zh-yue", "ja", "nod" ],
|
||||
"description": "A list of language codes which will receive an icon in their enhanced reply-button treatment",
|
||||
"merge_strategy": "provide_default"
|
||||
},
|
||||
"DiscussionToolsEnablePermalinksBackend": {
|
||||
"value": true,
|
||||
"description": "Enable the permalinks backend. Do not enable this unless the database tables exist."
|
||||
|
|
|
@ -534,7 +534,7 @@ class CommentFormatter {
|
|||
|
||||
$text = preg_replace_callback(
|
||||
'/<!--__DTREPLYBUTTONSCONTENT__-->/',
|
||||
static function ( $matches ) use ( $doc, $replyLinkText, $replyButtonText, $isMobile ) {
|
||||
static function ( $matches ) use ( $doc, $replyLinkText, $replyButtonText, $isMobile, $lang ) {
|
||||
$replyLinkButtons = $doc->createElement( 'span' );
|
||||
|
||||
// Reply
|
||||
|
@ -554,11 +554,12 @@ class CommentFormatter {
|
|||
$bracketClose->textContent = ']';
|
||||
|
||||
// Visual enhancements button
|
||||
$useIcon = $isMobile || static::isLanguageRequiringReplyIcon( $lang );
|
||||
$replyLinkButton = new \OOUI\ButtonWidget( [
|
||||
'classes' => [ 'ext-discussiontools-init-replybutton' ],
|
||||
'framed' => false,
|
||||
'label' => $replyButtonText,
|
||||
'icon' => $isMobile ? 'share' : null,
|
||||
'icon' => $useIcon ? 'share' : null,
|
||||
'flags' => [ 'progressive' ],
|
||||
'infusable' => true,
|
||||
] );
|
||||
|
@ -822,4 +823,10 @@ class CommentFormatter {
|
|||
return strpos( $text, '<!--__DTHASCOMMENTSINLEDECONTENT__-->' ) !== false;
|
||||
}
|
||||
|
||||
public static function isLanguageRequiringReplyIcon( Language $lang ): bool {
|
||||
$dtConfig = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'discussiontools' );
|
||||
$languages = $dtConfig->get( 'DiscussionTools_visualenhancements_reply_icon_languages' );
|
||||
return in_array( $lang->getCode(), $languages );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -282,11 +282,21 @@ class PageHooks implements
|
|||
'oojs-ui.styles.icons-alerts',
|
||||
] );
|
||||
}
|
||||
if ( $isMobile ) {
|
||||
if (
|
||||
$isMobile ||
|
||||
(
|
||||
HookUtils::isFeatureEnabledForOutput( $output, HookUtils::VISUALENHANCEMENTS_REPLY ) &&
|
||||
CommentFormatter::isLanguageRequiringReplyIcon( $lang )
|
||||
)
|
||||
) {
|
||||
$output->addModuleStyles( [
|
||||
// Mobile reply button:
|
||||
// Reply button:
|
||||
// share
|
||||
'oojs-ui.styles.icons-content',
|
||||
] );
|
||||
}
|
||||
if ( $isMobile ) {
|
||||
$output->addModuleStyles( [
|
||||
// Mobile overflow menu:
|
||||
// ellipsis
|
||||
'oojs-ui.styles.icons-interactions',
|
||||
|
|
|
@ -330,9 +330,14 @@ h1, h2, h3, h4, h5, h6 {
|
|||
margin-top: -8px;
|
||||
margin-bottom: -6px;
|
||||
|
||||
> .oo-ui-buttonElement-button {
|
||||
&:not( .oo-ui-iconElement ) > .oo-ui-buttonElement-button {
|
||||
padding: 4px 6px;
|
||||
}
|
||||
|
||||
&.oo-ui-iconElement > .oo-ui-buttonElement-button {
|
||||
padding-top: 4px;
|
||||
padding-bottom: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
&.skin-minerva .ext-discussiontools-init-replylink-buttons {
|
||||
|
|
Loading…
Reference in a new issue