refactoring
This commit is contained in:
@@ -113,25 +113,23 @@ export class BubbleMenuView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createTooltip() {
|
createTooltip() {
|
||||||
if (this.tippy) {
|
const { element: editorElement } = this.editor.options
|
||||||
|
const editorIsAttached = !!editorElement.parentElement
|
||||||
|
|
||||||
|
if (this.tippy || !editorIsAttached) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const { element: editorElement } = this.editor.options
|
this.tippy = tippy(editorElement, {
|
||||||
|
duration: 0,
|
||||||
// Wait until editor element is attached to the document
|
getReferenceClientRect: null,
|
||||||
if (editorElement.parentElement) {
|
content: this.element,
|
||||||
this.tippy = tippy(editorElement, {
|
interactive: true,
|
||||||
duration: 0,
|
trigger: 'manual',
|
||||||
getReferenceClientRect: null,
|
placement: 'top',
|
||||||
content: this.element,
|
hideOnClick: 'toggle',
|
||||||
interactive: true,
|
...this.tippyOptions,
|
||||||
trigger: 'manual',
|
})
|
||||||
placement: 'top',
|
|
||||||
hideOnClick: 'toggle',
|
|
||||||
...this.tippyOptions,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update(view: EditorView, oldState?: EditorState) {
|
update(view: EditorView, oldState?: EditorState) {
|
||||||
|
|||||||
@@ -99,25 +99,23 @@ export class FloatingMenuView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createTooltip() {
|
createTooltip() {
|
||||||
if (this.tippy) {
|
const { element: editorElement } = this.editor.options
|
||||||
|
const editorIsAttached = !!editorElement.parentElement
|
||||||
|
|
||||||
|
if (this.tippy || !editorIsAttached) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const { element: editorElement } = this.editor.options
|
this.tippy = tippy(editorElement, {
|
||||||
|
duration: 0,
|
||||||
// Wait until editor element is attached to the document
|
getReferenceClientRect: null,
|
||||||
if (editorElement.parentElement) {
|
content: this.element,
|
||||||
this.tippy = tippy(editorElement, {
|
interactive: true,
|
||||||
duration: 0,
|
trigger: 'manual',
|
||||||
getReferenceClientRect: null,
|
placement: 'right',
|
||||||
content: this.element,
|
hideOnClick: 'toggle',
|
||||||
interactive: true,
|
...this.tippyOptions,
|
||||||
trigger: 'manual',
|
})
|
||||||
placement: 'right',
|
|
||||||
hideOnClick: 'toggle',
|
|
||||||
...this.tippyOptions,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update(view: EditorView, oldState?: EditorState) {
|
update(view: EditorView, oldState?: EditorState) {
|
||||||
|
|||||||
Reference in New Issue
Block a user