fix: 🐛 Fix bugs with mentions picker

This commit is contained in:
Jesse Wierzbinski 2024-12-25 21:45:33 +01:00
parent f0516cb58a
commit 87b6377264
No known key found for this signature in database

View file

@ -57,9 +57,9 @@ export default {
} }
// @ts-expect-error Tippy types are wrong // @ts-expect-error Tippy types are wrong
popup = tippy("body", { popup = tippy(props.editor.options.element, {
getReferenceClientRect: props.clientRect, getReferenceClientRect: props.clientRect,
appendTo: () => document.body, appendTo: () => props.editor.options.element,
content: component.element, content: component.element,
showOnCreate: true, showOnCreate: true,
interactive: true, interactive: true,
@ -75,14 +75,14 @@ export default {
return; return;
} }
popup[0]?.setProps({ popup.setProps({
getReferenceClientRect: props.clientRect as () => DOMRect, getReferenceClientRect: props.clientRect as () => DOMRect,
}); });
}, },
onKeyDown(props) { onKeyDown(props) {
if (props.event.key === "Escape") { if (props.event.key === "Escape") {
popup[0]?.hide(); popup.hide();
return true; return true;
} }
@ -91,7 +91,8 @@ export default {
}, },
onExit() { onExit() {
popup[0]?.destroy(); popup.hide();
popup.destroy();
component.destroy(); component.destroy();
}, },
}; };