From 292afd774d5075eccf63935a5b53f032ffe20ead Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Mon, 21 Sep 2020 00:21:35 -0700 Subject: [PATCH] fix: CMD+Enter in title should leave editing mode --- app/scenes/Document/components/Editor.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/scenes/Document/components/Editor.js b/app/scenes/Document/components/Editor.js index 385fe8a84..5ab15a5c6 100644 --- a/app/scenes/Document/components/Editor.js +++ b/app/scenes/Document/components/Editor.js @@ -21,7 +21,7 @@ type Props = { isDraft: boolean, isShare: boolean, readOnly?: boolean, - onSave: () => mixed, + onSave: ({ publish?: boolean, done?: boolean }) => mixed, innerRef: { current: any }, }; @@ -50,8 +50,13 @@ class DocumentEditor extends React.Component { }; handleTitleKeyDown = (event: SyntheticKeyboardEvent<>) => { - if (event.key === "Enter" && !event.metaKey) { + if (event.key === "Enter") { event.preventDefault(); + if (event.metaKey) { + this.props.onSave({ publish: true, done: true }); + return; + } + this.insertParagraph(); this.focusAtStart(); return;