From 7f5960d1c4c8812145122368de985cc8486f83d2 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 15 Dec 2023 17:24:55 +0100 Subject: [PATCH] Add parenthesis around keyboard when there is no kbd tag This happens in title attributes, for example. --- umap/static/umap/js/umap.core.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/umap.core.js b/umap/static/umap/js/umap.core.js index 868fef9a..487bbff0 100644 --- a/umap/static/umap/js/umap.core.js +++ b/umap/static/umap/js/umap.core.js @@ -484,11 +484,14 @@ L.U.Help = L.Class.extend({ displayLabel: function (action, withKbdTag=true) { let {shortcut, label} = this.SHORTCUTS[action] + const modifier = this.isMacOS ? 'Cmd' : 'Ctrl' + shortcut = shortcut.replace('Modifier', modifier) if (withKbdTag) { shortcut = shortcut.split('+').map((el) => `${el}`).join('+') + label += ` ${shortcut}` + } else { + label += ` (${shortcut})` } - const modifier = this.isMacOS ? 'Cmd' : 'Ctrl' - label += ` ${shortcut.replace('Modifier', modifier)}` return label },