mirror of
https://github.com/usememos/memos.git
synced 2025-10-19 02:37:19 +08:00
fix: shortcuts should exclude the shift judgment (#796)
* fix: Shortcuts should exclude the shift judgment * fix: eslint
This commit is contained in:
parent
2658b1fd09
commit
3c2cd43d28
1 changed files with 6 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue