0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-02 20:50:17 -05:00

Fix undo shortcut sometimes not working

Same deal - does the Shift modifier also modify the character? Just
allow both.

Fixes #457.
This commit is contained in:
Neil Jenkins 2024-03-04 10:52:34 +11:00
parent 46bc36861e
commit d2e211796b

View file

@ -211,12 +211,15 @@ keyHandlers[ctrlKey + 'z'] = (self: Squire, event: KeyboardEvent): void => {
event.preventDefault();
self.undo();
};
keyHandlers[ctrlKey + 'y'] = keyHandlers[ctrlKey + 'Shift-z'] = (
self: Squire,
event: KeyboardEvent,
): void => {
keyHandlers[ctrlKey + 'y'] =
// Depending on platform, the Shift may cause the key to come through as
// upper case, but sometimes not. Just add both as shortcuts — the browser
// will only ever fire one or the other.
keyHandlers[ctrlKey + 'Shift-z'] =
keyHandlers[ctrlKey + 'Shift-Z'] =
(self: Squire, event: KeyboardEvent): void => {
event.preventDefault();
self.redo();
};
};
export { _onKey, keyHandlers };