From: SleeplessOne1917 Date: Mon, 12 Jun 2023 18:13:33 +0000 (+0000) Subject: Add shortcut for submitting post (#1163) X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%22https:/nerdica.net/%7B?a=commitdiff_plain;h=1f12ce97906efe9439bbe2fa667c5c26726643ca;p=lemmy-ui.git Add shortcut for submitting post (#1163) Co-authored-by: Dessalines --- diff --git a/src/shared/components/common/markdown-textarea.tsx b/src/shared/components/common/markdown-textarea.tsx index 7702d2b..b92170d 100644 --- a/src/shared/components/common/markdown-textarea.tsx +++ b/src/shared/components/common/markdown-textarea.tsx @@ -435,30 +435,45 @@ export class MarkdownTextArea extends Component< handleKeyBinds(i: MarkdownTextArea, event: KeyboardEvent) { if (event.ctrlKey) { switch (event.key) { - case "k": + case "k": { i.handleInsertLink(i, event); break; - case "b": + } + case "Enter": { + if (!this.isDisabled) { + i.handleSubmit(i, event); + } + + break; + } + case "b": { i.handleInsertBold(i, event); break; - case "i": + } + case "i": { i.handleInsertItalic(i, event); break; - case "e": + } + case "e": { i.handleInsertCode(i, event); break; - case "8": + } + case "8": { i.handleInsertList(i, event); break; - case "s": + } + case "s": { i.handleInsertSpoiler(i, event); break; - case "p": + } + case "p": { if (i.state.content) i.handlePreviewToggle(i, event); break; - case ".": + } + case ".": { i.handleInsertQuote(i, event); break; + } } } }