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