@mytec: fix und from 1.1.1
This commit is contained in:
@@ -40,15 +40,21 @@ export function useKeyboardShortcuts({
|
||||
return;
|
||||
}
|
||||
|
||||
// Undo/Redo: use e.code (layout-independent) as primary, e.key as fallback.
|
||||
// e.key can be uppercase 'Z' with Shift, or a control char on some layouts.
|
||||
// e.code is always 'KeyZ' / 'KeyY' regardless of modifier or layout.
|
||||
const isZ = e.code === 'KeyZ' || e.key.toLowerCase() === 'z';
|
||||
const isY = e.code === 'KeyY' || e.key.toLowerCase() === 'y';
|
||||
|
||||
// Undo: Ctrl+Z (or Cmd+Z on Mac)
|
||||
if (modKey && e.key === 'z' && !e.shiftKey) {
|
||||
if (modKey && isZ && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
onUndo?.();
|
||||
return;
|
||||
}
|
||||
|
||||
// Redo: Ctrl+Shift+Z or Ctrl+Y (Cmd+Shift+Z or Cmd+Y on Mac)
|
||||
if (modKey && ((e.key === 'z' && e.shiftKey) || e.key === 'y')) {
|
||||
if (modKey && ((isZ && e.shiftKey) || isY)) {
|
||||
e.preventDefault();
|
||||
onRedo?.();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user