prevent error in bubble menu, fix #386
This commit is contained in:
@@ -66,7 +66,14 @@ class Menu {
|
||||
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 top = cursorBoundings.top - editorBoundings.top
|
||||
|
||||
|
||||
@@ -111,7 +111,14 @@ class Menu {
|
||||
const end = coordsAtPos(view, to, true)
|
||||
|
||||
// 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()
|
||||
|
||||
// Find a center-ish x position from the selection endpoints (when
|
||||
|
||||
Reference in New Issue
Block a user