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/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/%22https:/nerdica.net/readmes/README.ru.md?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 (
- +