From 331622383a50e5c30d50512b4376928246dae92b Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Wed, 31 Mar 2021 10:11:08 +1000 Subject: [PATCH] Post: allow submission with ctrl+enter Fixes urbit/landscape#677 --- .../src/views/landscape/components/Home/Post/PostInput.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkg/interface/src/views/landscape/components/Home/Post/PostInput.js b/pkg/interface/src/views/landscape/components/Home/Post/PostInput.js index df31608b0..7d2b0d461 100644 --- a/pkg/interface/src/views/landscape/components/Home/Post/PostInput.js +++ b/pkg/interface/src/views/landscape/components/Home/Post/PostInput.js @@ -34,6 +34,12 @@ export function PostInput(props) { }, [promptUpload]); + const handleKeyDown = (e) => { + if((e.getModifierState('Control') || e.metaKey) && e.key === 'Enter') { + sendPost(); + } + } + const sendPost = async () => { if (!graphResource) { console.error("graphResource is undefined, cannot post"); @@ -90,6 +96,7 @@ export function PostInput(props) { spellCheck="false" value={postContent} onChange={e => setPostContent(e.target.value)} + onKeyDown={handleKeyDown} />