Fix keybinds invalidated by capslock state (#1776)

* [Refactor] Simplify keybinds code

* [Refactor] Type safety

* Fix capslock inverts undo/redo shortcuts

* [Refactor] Type safety

* Fix capslock state changes keybinds

* Deprecate keybind deserialize

* Remove keybind deserialize
This commit is contained in:
filtered
2024-12-04 11:12:09 +11:00
committed by GitHub
parent 08ae36818a
commit 0fe0aea242
3 changed files with 35 additions and 45 deletions

View File

@@ -163,11 +163,13 @@ export class ChangeTracker {
}
async undoRedo(e: KeyboardEvent) {
if (e.ctrlKey || e.metaKey) {
if (e.key === 'y' || e.key == 'Z') {
if ((e.ctrlKey || e.metaKey) && !e.altKey) {
const key = e.key.toUpperCase()
// Redo: Ctrl + Y, or Ctrl + Shift + Z
if ((key === 'Y' && !e.shiftKey) || (key == 'Z' && e.shiftKey)) {
await this.redo()
return true
} else if (e.key === 'z') {
} else if (key === 'Z' && !e.shiftKey) {
await this.undo()
return true
}