From 400f345182caec6038df631a4392762d50b52944 Mon Sep 17 00:00:00 2001 From: Adam Shea Date: Fri, 9 Jun 2023 21:30:12 +0000 Subject: [PATCH 1/2] Added Ctrl-K keybind --- src/shared/components/common/markdown-textarea.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/shared/components/common/markdown-textarea.tsx b/src/shared/components/common/markdown-textarea.tsx index eff10d72..efc812bf 100644 --- a/src/shared/components/common/markdown-textarea.tsx +++ b/src/shared/components/common/markdown-textarea.tsx @@ -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 }); From b54be0586d4559ed0e4a22c60dcf1409f77b4e22 Mon Sep 17 00:00:00 2001 From: Florian Heft Date: Sat, 10 Jun 2023 01:08:08 +0200 Subject: [PATCH 2/2] Only show 'saved' tab on own profile page * Users can't view saved posts of other users. * fixes #1090 --- src/shared/components/person/profile.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/components/person/profile.tsx b/src/shared/components/person/profile.tsx index 42c7c306..81186504 100644 --- a/src/shared/components/person/profile.tsx +++ b/src/shared/components/person/profile.tsx @@ -317,7 +317,7 @@ export class Profile extends Component< {this.getRadio(PersonDetailsView.Overview)} {this.getRadio(PersonDetailsView.Comments)} {this.getRadio(PersonDetailsView.Posts)} - {this.getRadio(PersonDetailsView.Saved)} + {this.amCurrentUser && this.getRadio(PersonDetailsView.Saved)} ); }