refactoring
This commit is contained in:
@@ -113,14 +113,13 @@ 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
|
|
||||||
|
|
||||||
// Wait until editor element is attached to the document
|
|
||||||
if (editorElement.parentElement) {
|
|
||||||
this.tippy = tippy(editorElement, {
|
this.tippy = tippy(editorElement, {
|
||||||
duration: 0,
|
duration: 0,
|
||||||
getReferenceClientRect: null,
|
getReferenceClientRect: null,
|
||||||
@@ -132,7 +131,6 @@ export class BubbleMenuView {
|
|||||||
...this.tippyOptions,
|
...this.tippyOptions,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
update(view: EditorView, oldState?: EditorState) {
|
update(view: EditorView, oldState?: EditorState) {
|
||||||
const { state, composing } = view
|
const { state, composing } = view
|
||||||
|
|||||||
@@ -99,14 +99,13 @@ 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
|
|
||||||
|
|
||||||
// Wait until editor element is attached to the document
|
|
||||||
if (editorElement.parentElement) {
|
|
||||||
this.tippy = tippy(editorElement, {
|
this.tippy = tippy(editorElement, {
|
||||||
duration: 0,
|
duration: 0,
|
||||||
getReferenceClientRect: null,
|
getReferenceClientRect: null,
|
||||||
@@ -118,7 +117,6 @@ export class FloatingMenuView {
|
|||||||
...this.tippyOptions,
|
...this.tippyOptions,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
update(view: EditorView, oldState?: EditorState) {
|
update(view: EditorView, oldState?: EditorState) {
|
||||||
const { state, composing } = view
|
const { state, composing } = view
|
||||||
|
|||||||
Reference in New Issue
Block a user