From 1871c70378c2d20e88476aed1a5c047ff74c1510 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Sun, 22 Nov 2020 22:04:25 +0000 Subject: [PATCH] Show keyboard shortcuts in button tooltips Bug: T264913 Change-Id: I3c5b248f7c7b0ef381baab84fe98d4ba0cefd35a --- extension.json | 5 ++++- modules/dt.ui.ReplyWidget.js | 17 +++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/extension.json b/extension.json index e1f6e040b..aea4933e9 100644 --- a/extension.json +++ b/extension.json @@ -124,7 +124,10 @@ "discussiontools-replywidget-reply", "discussiontools-replywidget-summary", "discussiontools-replywidget-terms-click", - "discussiontools-replywidget-transcluded" + "discussiontools-replywidget-transcluded", + "visualeditor-key-ctrl", + "visualeditor-key-enter", + "visualeditor-key-escape" ], "dependencies": [ "oojs-ui-widgets", diff --git a/modules/dt.ui.ReplyWidget.js b/modules/dt.ui.ReplyWidget.js index 4c0096065..5285a9ec9 100644 --- a/modules/dt.ui.ReplyWidget.js +++ b/modules/dt.ui.ReplyWidget.js @@ -53,12 +53,25 @@ function ReplyWidget( commentController, comment, pageName, oldId, config ) { this.replyBodyWidget = this.createReplyBodyWidget( inputConfig ); this.replyButton = new OO.ui.ButtonWidget( { flags: [ 'primary', 'progressive' ], - label: mw.msg( 'discussiontools-replywidget-reply' ) + label: mw.msg( 'discussiontools-replywidget-reply' ), + title: mw.msg( 'discussiontools-replywidget-reply' ) + ' ' + + // TODO: Use VE keyboard shortcut generating code + ( $.client.profile().platform === 'mac' ? + '⌘⏎' : + mw.msg( 'visualeditor-key-ctrl' ) + '+' + mw.msg( 'visualeditor-key-enter' ) + ) + } ); this.cancelButton = new OO.ui.ButtonWidget( { flags: [ 'destructive' ], label: mw.msg( 'discussiontools-replywidget-cancel' ), - framed: false + framed: false, + title: mw.msg( 'discussiontools-replywidget-cancel' ) + ' ' + + // TODO: Use VE keyboard shortcut generating code + ( $.client.profile().platform === 'mac' ? + '⎋' : + mw.msg( 'visualeditor-key-escape' ) + ) } ); this.modeTabSelect = new OO.ui.TabSelectWidget( {