Make Suggestion use view.dom instead of document (#3093)
This commit is contained in:
@@ -100,7 +100,7 @@ export function Suggestion<I = any>({
|
|||||||
const state = handleExit && !handleStart
|
const state = handleExit && !handleStart
|
||||||
? prev
|
? prev
|
||||||
: next
|
: next
|
||||||
const decorationNode = document.querySelector(`[data-decoration-id="${state.decorationId}"]`)
|
const decorationNode = view.dom.querySelector(`[data-decoration-id="${state.decorationId}"]`)
|
||||||
|
|
||||||
props = {
|
props = {
|
||||||
editor,
|
editor,
|
||||||
@@ -122,7 +122,7 @@ export function Suggestion<I = any>({
|
|||||||
? () => {
|
? () => {
|
||||||
// because of `items` can be asynchrounous we’ll search for the current docoration node
|
// because of `items` can be asynchrounous we’ll search for the current docoration node
|
||||||
const { decorationId } = this.key?.getState(editor.state) // eslint-disable-line
|
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
|
return currentDecorationNode?.getBoundingClientRect() || null
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user