1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-02-04 19:15:49 +02:00

[GH-1946] Fix losing focus for the card title in the dialog (#1952)

This commit is contained in:
kamre 2021-12-09 20:14:29 +03:00 committed by GitHub
parent 42eb5ad6be
commit e518c391aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,28 +74,16 @@ const MarkdownEditorInput = (props: Props): ReactElement => {
}, [])
useEffect(() => {
setTimeout(() => ref.current?.focus(), 200)
})
useEffect(() => {
let isMounted = true
if (isEditing && isMounted) {
setEditorState(EditorState.moveSelectionToEnd(editorState))
}
return () => {
isMounted = false
if (isEditing) {
if (initialText === '') {
setEditorState(EditorState.createEmpty())
} else {
setEditorState(EditorState.moveSelectionToEnd(editorState))
}
setTimeout(() => ref.current?.focus(), 200)
}
}, [isEditing])
useEffect(() => {
if (initialText === '') {
setTimeout(() => {
setEditorState(EditorState.createEmpty())
}, 200)
}
}, [initialText])
const customKeyBindingFn = useCallback((e: React.KeyboardEvent) => {
if (isMentionPopoverOpen || isEmojiPopoverOpen) {
return undefined