From 87b63772648bd397d332f946872ec46361f64f89 Mon Sep 17 00:00:00 2001 From: Jesse Wierzbinski Date: Wed, 25 Dec 2024 21:45:33 +0100 Subject: [PATCH] fix: :bug: Fix bugs with mentions picker --- components/editor/suggestion.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/components/editor/suggestion.ts b/components/editor/suggestion.ts index 66334b4..352f188 100644 --- a/components/editor/suggestion.ts +++ b/components/editor/suggestion.ts @@ -57,9 +57,9 @@ export default { } // @ts-expect-error Tippy types are wrong - popup = tippy("body", { + popup = tippy(props.editor.options.element, { getReferenceClientRect: props.clientRect, - appendTo: () => document.body, + appendTo: () => props.editor.options.element, content: component.element, showOnCreate: true, interactive: true, @@ -75,14 +75,14 @@ export default { return; } - popup[0]?.setProps({ + popup.setProps({ getReferenceClientRect: props.clientRect as () => DOMRect, }); }, onKeyDown(props) { if (props.event.key === "Escape") { - popup[0]?.hide(); + popup.hide(); return true; } @@ -91,7 +91,8 @@ export default { }, onExit() { - popup[0]?.destroy(); + popup.hide(); + popup.destroy(); component.destroy(); }, };