editor-fullmenu-fix
All checks were successful
deploy / testbuild (push) Successful in 2m15s
deploy / Update templates on Mailgun (push) Has been skipped

This commit is contained in:
Untone 2024-10-11 21:43:17 +03:00
parent ffe0ede835
commit 10ef9e1828
2 changed files with 5 additions and 5 deletions

View File

@ -68,7 +68,7 @@ export const EditorComponent = (props: Props) => {
BubbleMenu.configure({
pluginKey: 'textBubbleMenu',
element: textBubbleMenuRef()!,
shouldShow: ({ editor: e, view, state: { doc, selection } , from, to }) => {
shouldShow: ({ editor: e, view, state: { doc, selection }, from, to }) => {
const isEmptyTextBlock = doc.textBetween(from, to).length === 0 && isTextSelection(selection)
if (isEmptyTextBlock) {
e.chain().focus().removeTextWrap({ class: 'highlight-fake-selection' }).run()
@ -153,7 +153,7 @@ export const EditorComponent = (props: Props) => {
html && props.onChange(html)
const wordCount: number = e.storage.characterCount.words()
const charsCount: number = e.storage.characterCount.characters()
wordCount && countWords({ words: wordCount, characters: charsCount })
charsCount && countWords({ words: wordCount, characters: charsCount })
}
}
}))

View File

@ -45,9 +45,9 @@ export const FullBubbleMenu = (props: FullBubbleMenuProps) => {
const isHighlight = isActive('highlight')
// toggle open / close on submenus
createEffect(on(props.shouldShow, setFootnoteEditorOpen))
createEffect(on(props.shouldShow, setTextSizeBubbleOpen))
createEffect(on(props.shouldShow, setListBubbleOpen))
createEffect(on(props.shouldShow, (x) => !x && setFootnoteEditorOpen(false)))
createEffect(on(props.shouldShow, (x) => !x && setTextSizeBubbleOpen(false)))
createEffect(on(props.shouldShow, (x) => !x && setListBubbleOpen(false)))
const toggleTextSizeMenu = () => setTextSizeBubbleOpen((x) => !x)
const toggleListMenu = () => setListBubbleOpen((x) => !x)
const toggleFootnoteEditor = () => setFootnoteEditorOpen((x) => !x)