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.

fix: shortcuts should exclude the shift judgment (#796)

ChasLui3c2cd43d28df
diff --git a/web/src/components/MemoEditor.tsx b/web/src/components/MemoEditor.tsx
index a1d0a5cff..12455cbd0 100644
--- a/web/src/components/MemoEditor.tsx
+++ b/web/src/components/MemoEditor.tsx
@@ -102,7 +102,9 @@ const MemoEditor = () => {
return;
}
- if (event.ctrlKey || event.metaKey) {
+ const isMetaKey = event.ctrlKey || event.metaKey;
+ const isShiftKey = event.shiftKey;
+ if (!isShiftKey && isMetaKey) {
if (event.key === "Enter") {
handleSaveBtnClick();
return;
@@ -134,7 +136,7 @@ const MemoEditor = () => {
}
}
- if (event.key === "Enter") {
+ if (!isShiftKey && event.key === "Enter") {
const cursorPosition = editorRef.current.getCursorPosition();
const contentBeforeCursor = editorRef.current.getContent().slice(0, cursorPosition);
const rowValue = last(contentBeforeCursor.split("\n"));
@@ -169,13 +171,13 @@ const MemoEditor = () => {
}
return;
}
- if (event.key === "Escape") {
+ if (!isShiftKey && event.key === "Escape") {
if (state.fullscreen) {
handleFullscreenBtnClick();
}
return;
}
- if (event.key === "Tab") {
+ if (!isShiftKey && event.key === "Tab") {
event.preventDefault();
editorRef.current.insertText(" ".repeat(TAB_SPACE_WIDTH));
return;