Co-authored-by: prakharporwal <prakharporwal99@gmail.com>
This commit is contained in:
parent
81192418d6
commit
e4fbd2aed5
1 changed files with 2 additions and 9 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue