mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-12-26 04:41:26 +00:00
Merge pull request #1136 from Adam-Shea/main
This commit is contained in:
commit
5e51441ce7
1 changed files with 13 additions and 0 deletions
|
@ -148,6 +148,7 @@ export class MarkdownTextArea extends Component<
|
|||
value={this.state.content}
|
||||
onInput={linkEvent(this, this.handleContentChange)}
|
||||
onPaste={linkEvent(this, this.handleImageUploadPaste)}
|
||||
onKeyDown={linkEvent(this, this.handleKeyBinds)}
|
||||
required
|
||||
disabled={this.isDisabled}
|
||||
rows={2}
|
||||
|
@ -429,6 +430,18 @@ export class MarkdownTextArea extends Component<
|
|||
i.contentChange();
|
||||
}
|
||||
|
||||
// Keybind handler
|
||||
handleKeyBinds(i: MarkdownTextArea, event: KeyboardEvent) {
|
||||
if (event.ctrlKey) {
|
||||
switch (event.key) {
|
||||
case "k": {
|
||||
// Currently only one case but will support further keybinds
|
||||
i.handleInsertLink(i, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handlePreviewToggle(i: MarkdownTextArea, event: any) {
|
||||
event.preventDefault();
|
||||
i.setState({ previewMode: !i.state.previewMode });
|
||||
|
|
Loading…
Reference in a new issue