mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-25 22:01:13 +00:00
Add shortcut for submitting post (#1163)
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>
This commit is contained in:
parent
b0b3d526cf
commit
1f12ce9790
1 changed files with 23 additions and 8 deletions
|
@ -435,30 +435,45 @@ export class MarkdownTextArea extends Component<
|
||||||
handleKeyBinds(i: MarkdownTextArea, event: KeyboardEvent) {
|
handleKeyBinds(i: MarkdownTextArea, event: KeyboardEvent) {
|
||||||
if (event.ctrlKey) {
|
if (event.ctrlKey) {
|
||||||
switch (event.key) {
|
switch (event.key) {
|
||||||
case "k":
|
case "k": {
|
||||||
i.handleInsertLink(i, event);
|
i.handleInsertLink(i, event);
|
||||||
break;
|
break;
|
||||||
case "b":
|
}
|
||||||
|
case "Enter": {
|
||||||
|
if (!this.isDisabled) {
|
||||||
|
i.handleSubmit(i, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "b": {
|
||||||
i.handleInsertBold(i, event);
|
i.handleInsertBold(i, event);
|
||||||
break;
|
break;
|
||||||
case "i":
|
}
|
||||||
|
case "i": {
|
||||||
i.handleInsertItalic(i, event);
|
i.handleInsertItalic(i, event);
|
||||||
break;
|
break;
|
||||||
case "e":
|
}
|
||||||
|
case "e": {
|
||||||
i.handleInsertCode(i, event);
|
i.handleInsertCode(i, event);
|
||||||
break;
|
break;
|
||||||
case "8":
|
}
|
||||||
|
case "8": {
|
||||||
i.handleInsertList(i, event);
|
i.handleInsertList(i, event);
|
||||||
break;
|
break;
|
||||||
case "s":
|
}
|
||||||
|
case "s": {
|
||||||
i.handleInsertSpoiler(i, event);
|
i.handleInsertSpoiler(i, event);
|
||||||
break;
|
break;
|
||||||
case "p":
|
}
|
||||||
|
case "p": {
|
||||||
if (i.state.content) i.handlePreviewToggle(i, event);
|
if (i.state.content) i.handlePreviewToggle(i, event);
|
||||||
break;
|
break;
|
||||||
case ".":
|
}
|
||||||
|
case ".": {
|
||||||
i.handleInsertQuote(i, event);
|
i.handleInsertQuote(i, event);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue