Skip to content

A local-first personal finance app

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

Jed Fox79e56b9bbb94
diff --git a/packages/desktop-client/src/browser-preload.browser.js b/packages/desktop-client/src/browser-preload.browser.js
index b8b26bee6f..3f183e4ee7 100644
--- a/packages/desktop-client/src/browser-preload.browser.js
+++ b/packages/desktop-client/src/browser-preload.browser.js
@@ -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();
diff --git a/packages/desktop-client/src/components/accounts/TransactionsTable.js b/packages/desktop-client/src/components/accounts/TransactionsTable.js
index 0d5a3d50d5..54d15ac2c7 100644
--- a/packages/desktop-client/src/components/accounts/TransactionsTable.js
+++ b/packages/desktop-client/src/components/accounts/TransactionsTable.js
@@ -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 &&