From 12e27b4c6452ca25f632f33a35e8c51fad21b252 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Sun, 21 Feb 2021 21:30:11 -0500 Subject: [PATCH] Fixing markup not throwing onContentChange. Fixes #182 --- src/shared/components/markdown-textarea.tsx | 153 +++++++++++--------- 1 file changed, 81 insertions(+), 72 deletions(-) diff --git a/src/shared/components/markdown-textarea.tsx b/src/shared/components/markdown-textarea.tsx index a8579305..1aaf4db1 100644 --- a/src/shared/components/markdown-textarea.tsx +++ b/src/shared/components/markdown-textarea.tsx @@ -1,5 +1,5 @@ -import { Component, linkEvent } from 'inferno'; -import { Prompt } from 'inferno-router'; +import { Component, linkEvent } from "inferno"; +import { Prompt } from "inferno-router"; import { mdToHtml, randomStr, @@ -9,12 +9,12 @@ import { pictrsDeleteToast, setupTippy, isBrowser, -} from '../utils'; -import { UserService } from '../services'; -import autosize from 'autosize'; -import { i18n } from '../i18next'; -import { pictrsUri } from '../env'; -import { Icon, Spinner } from './icon'; +} from "../utils"; +import { UserService } from "../services"; +import autosize from "autosize"; +import { i18n } from "../i18next"; +import { pictrsUri } from "../env"; +import { Icon, Spinner } from "./icon"; interface MarkdownTextAreaProps { initialContent: string; @@ -65,7 +65,7 @@ export class MarkdownTextArea extends Component< if (textarea) { autosize(textarea); this.tribute.attach(textarea); - textarea.addEventListener('tribute-replaced', () => { + textarea.addEventListener("tribute-replaced", () => { this.state.content = textarea.value; this.setState(this.state); autosize.update(textarea); @@ -94,7 +94,7 @@ export class MarkdownTextArea extends Component< if (nextProps.finished) { this.state.previewMode = false; this.state.loading = false; - this.state.content = ''; + this.state.content = ""; this.setState(this.state); if (this.props.replyType) { this.props.onReplyCancel(); @@ -117,13 +117,13 @@ export class MarkdownTextArea extends Component<