mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-15 02:59:01 +08:00
prevent error in bubble menu, fix #386
This commit is contained in:
parent
81d4333bec
commit
3fee68b692
@ -66,7 +66,14 @@ class Menu {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const editorBoundings = this.options.element.offsetParent.getBoundingClientRect()
|
const parent = this.options.element.offsetParent
|
||||||
|
|
||||||
|
if (!parent) {
|
||||||
|
this.hide()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const editorBoundings = parent.getBoundingClientRect()
|
||||||
const cursorBoundings = view.coordsAtPos(state.selection.anchor)
|
const cursorBoundings = view.coordsAtPos(state.selection.anchor)
|
||||||
const top = cursorBoundings.top - editorBoundings.top
|
const top = cursorBoundings.top - editorBoundings.top
|
||||||
|
|
||||||
|
@ -111,7 +111,14 @@ class Menu {
|
|||||||
const end = coordsAtPos(view, to, true)
|
const end = coordsAtPos(view, to, true)
|
||||||
|
|
||||||
// The box in which the tooltip is positioned, to use as base
|
// The box in which the tooltip is positioned, to use as base
|
||||||
const box = this.options.element.offsetParent.getBoundingClientRect()
|
const parent = this.options.element.offsetParent
|
||||||
|
|
||||||
|
if (!parent) {
|
||||||
|
this.hide()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const box = parent.getBoundingClientRect()
|
||||||
const el = this.options.element.getBoundingClientRect()
|
const el = this.options.element.getBoundingClientRect()
|
||||||
|
|
||||||
// Find a center-ish x position from the selection endpoints (when
|
// Find a center-ish x position from the selection endpoints (when
|
||||||
|
Loading…
Reference in New Issue
Block a user