Skip to content
Snippets Groups Projects
Unverified Commit 79e56b9b authored by Jed Fox's avatar Jed Fox Committed by GitHub
Browse files

Improve handling of the undo/redo shortcuts (#659)

* Prevent Cmd+Z/Cmd+Shift+Z from propagating to the browser

* Allow browser to handle undo/redo shortcuts in input fields

* Don’t change a transaction’s note from null to ''
parent 19218be1
No related branches found
No related tags found
No related merge requests found
......@@ -168,6 +168,14 @@ document.addEventListener('keydown', e => {
}
// Cmd/Ctrl+z
else if (e.keyCode === 90) {
if (
e.target.tagName === 'INPUT' ||
e.target.tagName === 'TEXTAREA' ||
e.target.isContentEditable
) {
return;
}
e.preventDefault();
if (e.shiftKey) {
// Redo
window.__actionsForMenu.redo();
......
......@@ -557,6 +557,11 @@ export const Transaction = React.memo(function Transaction(props) {
if (transaction[name] !== value) {
let newTransaction = { ...transaction, [name]: value };
// Don't change the note to an empty string if it's null (since they are both rendered the same)
if (name === 'note' && value === '' && transaction.note == null) {
return;
}
if (
name === 'account' &&
value &&
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment