From ce363a2cb45b6d51321494bd9b09f11c8f088e49 Mon Sep 17 00:00:00 2001 From: Amund Tenstad Date: Thu, 14 Nov 2024 08:24:39 +0100 Subject: [PATCH] fix: only display language-specific codes for chosen host language --- src/store/keycodes.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/store/keycodes.js b/src/store/keycodes.js index c30dbdcd36..8409d1fa8d 100644 --- a/src/store/keycodes.js +++ b/src/store/keycodes.js @@ -14,9 +14,10 @@ const keycodePickerTabLayout = { ANSI_ISO: [...ansi, ...iso_jis], ISO_ANSI: [...iso_jis, ...ansi], special: [...quantum, ...settings, ...media], - extra: Object.values(keymapExtras) - .map(({ keycodeLUT, prefix }) => { + extra: Object.fromEntries( + Object.entries(keymapExtras).map(([keymap, { keycodeLUT, prefix }]) => { const keycodes = []; + Object.entries(keycodeLUT).forEach(([code, { name, title }]) => { if (title === undefined) { return; @@ -43,9 +44,10 @@ const keycodePickerTabLayout = { title: code }); }); - return keycodes; + + return [keymap, keycodes]; }) - .flat() + ) }; /** @@ -113,7 +115,7 @@ function generateKeycodes(osKeyboardLayout, isSteno = false) { ...keycodes.map((keycodeObject) => toLocaleKeycode(keycodeLUT, keycodeObject) ), - ...keycodePickerTabLayout.extra + ...keycodePickerTabLayout.extra[getOSKeyboardLayout()] ]; } @@ -153,8 +155,7 @@ export const useKeycodesStore = defineStore('keycodes', { state: () => ({ keycodes: [ ...keycodePickerTabLayout.ANSI_ISO, - ...keycodePickerTabLayout.special, - ...keycodePickerTabLayout.extra + ...keycodePickerTabLayout.special ], searchFilter: '', searchCounters: {