diff --git a/packages/suggestion/src/suggestion.ts b/packages/suggestion/src/suggestion.ts index 6b6895cc4b..b07fe367bc 100644 --- a/packages/suggestion/src/suggestion.ts +++ b/packages/suggestion/src/suggestion.ts @@ -100,7 +100,7 @@ export function Suggestion({ 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({ ? () => { // 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 currentDecorationNode = document.querySelector(`[data-decoration-id="${decorationId}"]`) + const currentDecorationNode = view.dom.querySelector(`[data-decoration-id="${decorationId}"]`) return currentDecorationNode?.getBoundingClientRect() || null }