Refactor ZenKeyboardShortcuts to handle key actions gracefully

This commit is contained in:
mauro-balades 2024-09-24 21:10:41 +02:00
parent 4fcc367d75
commit 160e85f337

View file

@ -348,10 +348,12 @@ class KeyShortcut {
// identify the default keybinds.
key.setAttribute('data-l10n-id', this.#l10nId);
key.setAttribute('modifiers', this.#modifiers.toString());
if (this.#action?.startsWith('code:')) {
key.setAttribute('oncommand', this.#action.substring(5));
} else {
key.setAttribute('command', this.#action);
if (this.#action) {
if (this.#action?.startsWith('code:')) {
key.setAttribute('oncommand', this.#action.substring(5));
} else {
key.setAttribute('command', this.#action);
}
}
key.setAttribute('disabled', this.#disabled);
key.setAttribute('reserved', this.#reserved);