editor-fullmenu-fix
This commit is contained in:
parent
ffe0ede835
commit
10ef9e1828
|
@ -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 })
|
||||
}
|
||||
}
|
||||
}))
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user