From acb04fdf1a1ea81b080fe2917337fa2329fa7a8e Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Sun, 6 Sep 2020 10:33:39 -0700 Subject: [PATCH] fix: CMD+S should save when editor title is focused --- app/scenes/Document/components/Editor.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/scenes/Document/components/Editor.js b/app/scenes/Document/components/Editor.js index 893c1ea19..c05237b91 100644 --- a/app/scenes/Document/components/Editor.js +++ b/app/scenes/Document/components/Editor.js @@ -21,6 +21,7 @@ type Props = { isDraft: boolean, isShare: boolean, readOnly?: boolean, + onSave: () => mixed, innerRef: { current: any }, }; @@ -58,6 +59,12 @@ class DocumentEditor extends React.Component { if (event.key === "Tab" || event.key === "ArrowDown") { event.preventDefault(); this.focusAtStart(); + return; + } + if (event.key === "s" && event.metaKey) { + event.preventDefault(); + this.props.onSave(); + return; } };