From 791c89d9438773ea3834819a5f61bd17e2ef0c76 Mon Sep 17 00:00:00 2001 From: Faleij Date: Mon, 22 Aug 2022 14:23:46 +0200 Subject: [PATCH] Make Suggestion use view.dom instead of document (#3093) --- packages/suggestion/src/suggestion.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/suggestion/src/suggestion.ts b/packages/suggestion/src/suggestion.ts index 6b6895cc..b07fe367 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 }