mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: add shortcut to edit the previous memo (#3122)
* Add shortcut to edit the previous memo * Fix compilation * Update web/src/components/MemoEditor/index.tsx Co-authored-by: boojack <stevenlgtm@gmail.com> --------- Co-authored-by: boojack <stevenlgtm@gmail.com>
This commit is contained in:
@ -37,6 +37,7 @@ interface Props {
|
||||
relationList?: MemoRelation[];
|
||||
autoFocus?: boolean;
|
||||
onConfirm?: (memoId: number) => void;
|
||||
onEditPrevious?: () => void;
|
||||
}
|
||||
|
||||
interface State {
|
||||
@ -144,7 +145,7 @@ const MemoEditor = (props: Props) => {
|
||||
const isMetaKey = event.ctrlKey || event.metaKey;
|
||||
if (isMetaKey) {
|
||||
if (event.key === "Enter") {
|
||||
handleSaveBtnClick();
|
||||
void handleSaveBtnClick();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -161,6 +162,12 @@ const MemoEditor = (props: Props) => {
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (!!props.onEditPrevious && event.key === "ArrowDown" && !state.isComposing && editorRef.current.getContent() === "") {
|
||||
event.preventDefault();
|
||||
props.onEditPrevious();
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
const handleMemoVisibilityChange = (visibility: Visibility) => {
|
||||
|
Reference in New Issue
Block a user