From: Dessalines Date: Sun, 2 Aug 2020 14:41:17 +0000 (-0400) Subject: Hide navigation warnings on markdown textarea for site-form and user bios. Fixes... X-Git-Url: http://these/git/%24%7BgetStaticDir%28%29%7D/styles/static/readmes/%24%7Bargs.pageFn.prev%7D?a=commitdiff_plain;h=089aefc7af1137902bad7fc7bb4106167b1d70ee;p=lemmy.git Hide navigation warnings on markdown textarea for site-form and user bios. Fixes #1051 --- diff --git a/ui/src/components/markdown-textarea.tsx b/ui/src/components/markdown-textarea.tsx index 002d7c86..0a7f904a 100644 --- a/ui/src/components/markdown-textarea.tsx +++ b/ui/src/components/markdown-textarea.tsx @@ -25,6 +25,7 @@ interface MarkdownTextAreaProps { onSubmit?(msg: { val: string; formId: string }): any; onContentChange?(val: string): any; onReplyCancel?(): any; + hideNavigationWarnings?: boolean; } interface MarkdownTextAreaState { @@ -78,7 +79,7 @@ export class MarkdownTextArea extends Component< } componentDidUpdate() { - if (this.state.content) { + if (!this.props.hideNavigationWarnings && this.state.content) { window.onbeforeunload = () => true; } else { window.onbeforeunload = undefined; @@ -110,7 +111,10 @@ export class MarkdownTextArea extends Component< render() { return (
- +