Make Suggestion use view.dom instead of document (#3093)

This commit is contained in:
Faleij
2022-08-22 14:23:46 +02:00
committed by GitHub
parent 313b8b8d0a
commit 791c89d943

View File

@@ -100,7 +100,7 @@ export function Suggestion<I = any>({
const state = handleExit && !handleStart
? prev
: next
const decorationNode = document.querySelector(`[data-decoration-id="${state.decorationId}"]`)
const decorationNode = view.dom.querySelector(`[data-decoration-id="${state.decorationId}"]`)
props = {
editor,
@@ -122,7 +122,7 @@ export function Suggestion<I = any>({
? () => {
// because of `items` can be asynchrounous well search for the current docoration node
const { decorationId } = this.key?.getState(editor.state) // eslint-disable-line
const currentDecorationNode = document.querySelector(`[data-decoration-id="${decorationId}"]`)
const currentDecorationNode = view.dom.querySelector(`[data-decoration-id="${decorationId}"]`)
return currentDecorationNode?.getBoundingClientRect() || null
}