Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

feat: esc to cancel editing (#532)

Zeng19985e069f79a2ad
diff --git a/web/src/components/MemoEditor.tsx b/web/src/components/MemoEditor.tsx
index 6c547c917..d9678c265 100644
--- a/web/src/components/MemoEditor.tsx
+++ b/web/src/components/MemoEditor.tsx
@@ -99,8 +99,12 @@ const MemoEditor = () => {
}, [editorState.editMemoId]);
const handleKeyDown = (event: React.KeyboardEvent) => {
- if (event.key === "Escape" && state.fullscreen) {
- handleFullscreenBtnClick();
+ if (event.key === "Escape") {
+ if (state.fullscreen) {
+ handleFullscreenBtnClick();
+ } else {
+ handleCancelEdit();
+ }
return;
}
if (event.key === "Tab") {