mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-23 19:19:03 +08:00
fix(bubble-menu): prevent null pointer exception in BubbleMenu
(#5842)
This commit is contained in:
parent
2ea807d1db
commit
1959eb5920
5
.changeset/seven-hats-thank.md
Normal file
5
.changeset/seven-hats-thank.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"@tiptap/extension-bubble-menu": patch
|
||||
---
|
||||
|
||||
Fix a potential null pointer exception
|
@ -266,14 +266,16 @@ export class BubbleMenuView {
|
||||
if (isNodeSelection(state.selection)) {
|
||||
let node = view.nodeDOM(from) as HTMLElement
|
||||
|
||||
const nodeViewWrapper = node.dataset.nodeViewWrapper ? node : node.querySelector('[data-node-view-wrapper]')
|
||||
|
||||
if (nodeViewWrapper) {
|
||||
node = nodeViewWrapper.firstChild as HTMLElement
|
||||
}
|
||||
|
||||
if (node) {
|
||||
return node.getBoundingClientRect()
|
||||
const nodeViewWrapper = node.dataset.nodeViewWrapper ? node : node.querySelector('[data-node-view-wrapper]')
|
||||
|
||||
if (nodeViewWrapper) {
|
||||
node = nodeViewWrapper.firstChild as HTMLElement
|
||||
}
|
||||
|
||||
if (node) {
|
||||
return node.getBoundingClientRect()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user