feat: esc to cancel editing (#532)

This commit is contained in:
Zeng1998 2022-11-22 19:54:25 +08:00 committed by GitHub
parent 7c78fb064f
commit 5e069f79a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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") {