fix(bubble-menu): prevent null pointer exception in BubbleMenu (#5842)

This commit is contained in:
Felix Gabler 2024-11-19 03:27:06 +01:00 committed by GitHub
parent 2ea807d1db
commit 1959eb5920
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 7 deletions

View File

@ -0,0 +1,5 @@
---
"@tiptap/extension-bubble-menu": patch
---
Fix a potential null pointer exception

View File

@ -266,6 +266,7 @@ export class BubbleMenuView {
if (isNodeSelection(state.selection)) {
let node = view.nodeDOM(from) as HTMLElement
if (node) {
const nodeViewWrapper = node.dataset.nodeViewWrapper ? node : node.querySelector('[data-node-view-wrapper]')
if (nodeViewWrapper) {
@ -276,6 +277,7 @@ export class BubbleMenuView {
return node.getBoundingClientRect()
}
}
}
return posToDOMRect(view, from, to)
}),