Add parenthesis around keyboard when there is no kbd tag

This happens in title attributes, for example.
This commit is contained in:
Yohan Boniface 2023-12-15 17:24:55 +01:00
parent 2f89a76e08
commit 7f5960d1c4

View file

@ -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) => `<kbd>${el}</kbd>`).join('+')
label += ` ${shortcut}`
} else {
label += ` (${shortcut})`
}
const modifier = this.isMacOS ? 'Cmd' : 'Ctrl'
label += ` ${shortcut.replace('Modifier', modifier)}`
return label
},