Solved #387 Bug: Comment box doesn't clear after sending (#547)

Co-authored-by: prakharporwal <prakharporwal99@gmail.com>
This commit is contained in:
prakharporwal 2021-06-21 10:28:57 +05:30 committed by GitHub
parent 81192418d6
commit e4fbd2aed5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,6 @@
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {useState, useEffect, useRef} from 'react'
import React, {useState, useRef} from 'react'
import EasyMDE from 'easymde'
import SimpleMDE from 'react-simplemde-editor'
@ -21,11 +21,10 @@ type Props = {
}
const MarkdownEditor = (props: Props): JSX. Element => {
const {placeholderText, uniqueId, onFocus, onBlur, onChange} = props
const {placeholderText, uniqueId, onFocus, onBlur, onChange, text} = props
const [isEditing, setIsEditing] = useState(false)
const [active, setActive] = useState(false)
const [text, setText] = useState(props.text)
const [editorInstance, setEditorInstance] = useState<EasyMDE>()
const showEditor = (): void => {
@ -42,12 +41,6 @@ const MarkdownEditor = (props: Props): JSX. Element => {
setIsEditing(true)
}
useEffect(() => {
if (!isEditing && text !== props.text) {
setText(props.text)
}
}, [props.text])
const stateAndPropsValue = {
isEditing,
setIsEditing,