From 7cb82b686255bfa9d8c2a3d8f6974f69eec5e307 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Tue, 25 Feb 2020 17:57:23 +0000 Subject: [PATCH] Reply-to placeholder Sets the placeholder text to "Reply to ". Bug: T245227 Depends-On: I7f3a58b7093d00aace9f9c6a95a121ba4e901ad8 Change-Id: Ie51f1848c17bb892e7f64adf6f7f19fc38e56202 --- extension.json | 1 + i18n/en.json | 2 +- i18n/qqq.json | 1 + modules/dt.ui.ReplyWidget.js | 8 ++++++-- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/extension.json b/extension.json index 2eda1c8fa..9c712d932 100644 --- a/extension.json +++ b/extension.json @@ -103,6 +103,7 @@ "messages": [ "discussiontools-replywidget-anon-warning", "discussiontools-replywidget-cancel", + "discussiontools-replywidget-placeholder-reply", "discussiontools-replywidget-preview", "discussiontools-replywidget-reply", "discussiontools-replywidget-terms-click" diff --git a/i18n/en.json b/i18n/en.json index ed3beeedf..79e7cd285 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -13,6 +13,7 @@ "discussiontools-replywidget-anon-warning": "You are not logged in. To receive attribution with your name instead of your IP address, you can [$1 log in] or [$2 create an account].", "discussiontools-replywidget-cancel": "Cancel", "discussiontools-replywidget-loading": "Loading…", + "discussiontools-replywidget-placeholder-reply": "Reply to {{BIDI:$1}}", "discussiontools-replywidget-preview": "Preview", "discussiontools-replywidget-reply": "Reply", "discussiontools-replywidget-terms-click": "By clicking \"$1\", you agree to the terms of use for this wiki.", @@ -29,5 +30,4 @@ "tag-discussiontools-source-description": "DiscussionTools was in source mode", "tag-discussiontools-visual": "Visual", "tag-discussiontools-visual-description": "DiscussionTools was in VisualEditor mode" - } diff --git a/i18n/qqq.json b/i18n/qqq.json index 3211994fc..63d8ca97e 100644 --- a/i18n/qqq.json +++ b/i18n/qqq.json @@ -18,6 +18,7 @@ "discussiontools-replywidget-anon-warning": "Warning message to be displayed when anonymous user starts writing a new topic or reply.\n* $1 is a URL to log in.\n* $2 is a URL to register an account.", "discussiontools-replywidget-cancel": "Label for the cancel button in the reply widget", "discussiontools-replywidget-loading": "Message shown while the reply widget is loading", + "discussiontools-replywidget-placeholder-reply": "Placeholder describing who is being replied to", "discussiontools-replywidget-preview": "Label for the preview area of the reply widget", "discussiontools-replywidget-reply": "Label for the button to submit a reply in the reply widget", "discussiontools-replywidget-terms-click": "Terms of use for posting a reply.\n\n* $1 is the label of the button to be clicked, e.g. {{msg-mw|discussiontools-replywidget-reply}}.", diff --git a/modules/dt.ui.ReplyWidget.js b/modules/dt.ui.ReplyWidget.js index 17c42ba79..d5a2ccaa1 100644 --- a/modules/dt.ui.ReplyWidget.js +++ b/modules/dt.ui.ReplyWidget.js @@ -13,7 +13,7 @@ var controller = require( 'ext.discussionTools.controller' ), * @param {Object} [config.input] Configuration options for the comment input widget */ function ReplyWidget( comment, config ) { - var returnTo, contextNode; + var returnTo, contextNode, inputConfig; config = config || {}; @@ -24,7 +24,11 @@ function ReplyWidget( comment, config ) { contextNode = modifier.closest( this.comment.range.endContainer, 'dl, ul, ol' ); this.context = contextNode ? contextNode.nodeName.toLowerCase() : 'dl'; - this.replyBodyWidget = this.createReplyBodyWidget( config.input ); + inputConfig = $.extend( + { placeholder: mw.msg( 'discussiontools-replywidget-placeholder-reply', comment.author ) }, + config.input + ); + this.replyBodyWidget = this.createReplyBodyWidget( inputConfig ); this.replyButton = new OO.ui.ButtonWidget( { flags: [ 'primary', 'progressive' ], label: mw.msg( 'discussiontools-replywidget-reply' )