1
1
mirror of https://github.com/urbit/shrub.git synced 2024-12-28 14:42:53 +03:00

Post: allow submission with ctrl+enter

Fixes 
This commit is contained in:
Liam Fitzgerald 2021-03-31 10:11:08 +10:00
parent 4fd0188d2c
commit 331622383a
No known key found for this signature in database
GPG Key ID: D390E12C61D1CFFB

View File

@ -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}
/>
<Row
borderTop={1}