Fix editor menu workflow (#366)

This commit is contained in:
Ilya Y 2024-01-17 18:33:25 +03:00 committed by GitHub
parent 2bb600c8c6
commit d4ef39e6ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 0 deletions

View File

@ -93,6 +93,7 @@ export const EditorFloatingMenu = (props: FloatingMenuProps) => {
const closeUploadModalHandler = () => {
setSelectedMenuItem()
setMenuOpen(false)
setSelectedMenuItem()
}
useOutsideClickHandler({
@ -104,6 +105,7 @@ export const EditorFloatingMenu = (props: FloatingMenuProps) => {
if (menuOpen()) {
setMenuOpen(false)
setSelectedMenuItem()
}
},
})

View File

@ -39,6 +39,9 @@ export const TextBubbleMenu = (props: BubbleMenuProps) => {
if (!props.shouldShow) {
setFootNote()
setFootnoteEditorOpen(false)
setLinkEditorOpen(false)
setTextSizeBubbleOpen(false)
setListBubbleOpen(false)
}
})
@ -93,11 +96,13 @@ export const TextBubbleMenu = (props: BubbleMenuProps) => {
props.editor.chain().focus().setFootnote({ value: footnote }).run()
}
setFootNote()
setLinkEditorOpen(false)
setFootnoteEditorOpen(false)
}
const handleOpenFootnoteEditor = () => {
updateCurrentFootnoteValue()
setLinkEditorOpen(false)
setFootnoteEditorOpen(true)
}
@ -120,6 +125,7 @@ export const TextBubbleMenu = (props: BubbleMenuProps) => {
window.addEventListener('keydown', handleKeyDown)
onCleanup(() => {
window.removeEventListener('keydown', handleKeyDown)
setLinkEditorOpen(false)
})
})