fix error

This commit is contained in:
Chris Kruining 2025-01-16 16:17:24 +01:00
parent 50a1b7e2d5
commit 5862248153
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
2 changed files with 6 additions and 4 deletions

View file

@ -75,6 +75,10 @@ const Root: ParentComponent<{ commands: CommandType[] }> = (props) => {
}); });
const listener = (e: KeyboardEvent) => { const listener = (e: KeyboardEvent) => {
if (!e.key) {
return;
}
const key = e.key.toLowerCase(); const key = e.key.toLowerCase();
const modifiers = const modifiers =
(e.shiftKey ? 1 : 0) << 0 | (e.shiftKey ? 1 : 0) << 0 |

View file

@ -47,7 +47,7 @@ export function Grid(props: { class?: string, rows: Entry[], locales: string[],
renderer: ({ row, column, value, mutate }) => { renderer: ({ row, column, value, mutate }) => {
const entry = rows().value[row]!; const entry = rows().value[row]!;
return <TextArea row={row} key={entry.key} lang={String(column)} value={value} oninput={e => mutate(e.data ?? '')} />; return <TextArea row={row} key={entry.key} lang={String(column)} value={value ?? ''} oninput={e => mutate(e.data ?? '')} />;
}, },
})) }))
]); ]);
@ -58,9 +58,7 @@ export function Grid(props: { class?: string, rows: Entry[], locales: string[],
const r = rows(); const r = rows();
const l = locales(); const l = locales();
r.mutateEach(({ key, ...rest }) => { r.mutateEach(({ key, ...rest }) => ({ key, ...Object.fromEntries(l.map(locale => [locale, rest[locale] ?? ''])) }));
return ({ key, ...Object.fromEntries(l.map(locale => [locale, rest[locale] ?? ''])) });
});
}); });
createEffect(() => { createEffect(() => {