mirror of
https://github.com/mattermost/focalboard.git
synced 2025-02-07 19:30:18 +02:00
Fix card loading on open card (#800)
* Fix card loading on open card * Fix MDE problem * Fix eslint
This commit is contained in:
parent
cfac3fe81b
commit
8823991eb9
@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
import React, {useState} from 'react'
|
||||
import React, {useState, useEffect} from 'react'
|
||||
import {FormattedMessage, useIntl} from 'react-intl'
|
||||
|
||||
import mutator from '../mutator'
|
||||
@ -27,6 +27,13 @@ const CardDialog = (props: Props) => {
|
||||
const [syncComplete, setSyncComplete] = useState(false)
|
||||
const [cardTree, setCardTree] = useState<CardTree>()
|
||||
const intl = useIntl()
|
||||
useEffect(() => {
|
||||
MutableCardTree.sync(props.cardId).then((ct) => {
|
||||
setCardTree(ct)
|
||||
setSyncComplete(true)
|
||||
})
|
||||
}, [props.boardTree])
|
||||
|
||||
useCardListener(
|
||||
async (blocks) => {
|
||||
Utils.log(`cardListener.onChanged: ${blocks.length}`)
|
||||
|
@ -1,6 +1,6 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
import React, {useState, useRef} from 'react'
|
||||
import React, {useState, useRef, useMemo} from 'react'
|
||||
import EasyMDE from 'easymde'
|
||||
import SimpleMDE from 'react-simplemde-editor'
|
||||
|
||||
@ -52,6 +52,23 @@ const MarkdownEditor = (props: Props): JSX. Element => {
|
||||
const stateAndPropsRef = useRef(stateAndPropsValue)
|
||||
stateAndPropsRef.current = stateAndPropsValue
|
||||
|
||||
const mdeOptions = useMemo(() => ({
|
||||
autoDownloadFontAwesome: true,
|
||||
toolbar: false,
|
||||
status: false,
|
||||
spellChecker: true,
|
||||
nativeSpellcheck: true,
|
||||
minHeight: '10px',
|
||||
shortcuts: {
|
||||
toggleStrikethrough: 'Cmd-.',
|
||||
togglePreview: null,
|
||||
drawImage: null,
|
||||
drawLink: null,
|
||||
toggleSideBySide: null,
|
||||
toggleFullScreen: null,
|
||||
},
|
||||
}), [])
|
||||
|
||||
const html: string = Utils.htmlFromMarkdown(text || placeholderText || '')
|
||||
|
||||
const previewElement = (
|
||||
@ -132,22 +149,7 @@ const MarkdownEditor = (props: Props): JSX. Element => {
|
||||
}
|
||||
},
|
||||
}}
|
||||
options={{
|
||||
autoDownloadFontAwesome: true,
|
||||
toolbar: false,
|
||||
status: false,
|
||||
spellChecker: true,
|
||||
nativeSpellcheck: true,
|
||||
minHeight: '10px',
|
||||
shortcuts: {
|
||||
toggleStrikethrough: 'Cmd-.',
|
||||
togglePreview: null,
|
||||
drawImage: null,
|
||||
drawLink: null,
|
||||
toggleSideBySide: null,
|
||||
toggleFullScreen: null,
|
||||
},
|
||||
}}
|
||||
options={mdeOptions}
|
||||
/>
|
||||
</div>)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user