From faa88426986f70d006bdbf32895bd0b7ed46c759 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Wed, 20 Jan 2021 11:32:58 +0100 Subject: [PATCH] fix tippy position --- docs/src/demos/Nodes/Mention/index.vue | 4 ++-- packages/suggestion/src/suggestion.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/demos/Nodes/Mention/index.vue b/docs/src/demos/Nodes/Mention/index.vue index 900e9800..16bbf954 100644 --- a/docs/src/demos/Nodes/Mention/index.vue +++ b/docs/src/demos/Nodes/Mention/index.vue @@ -50,7 +50,7 @@ export default { }) popup = tippy('body', { - getReferenceClientRect: () => props.clientRect, + getReferenceClientRect: props.clientRect, appendTo: () => document.body, content: component.element, showOnCreate: true, @@ -63,7 +63,7 @@ export default { component.updateProps(props) popup[0].setProps({ - getReferenceClientRect: () => props.clientRect, + getReferenceClientRect: props.clientRect, }) }, onKeyDown(props) { diff --git a/packages/suggestion/src/suggestion.ts b/packages/suggestion/src/suggestion.ts index 4a04b524..3f1aabbc 100644 --- a/packages/suggestion/src/suggestion.ts +++ b/packages/suggestion/src/suggestion.ts @@ -32,7 +32,7 @@ export interface SuggestionProps { items: any[], command: (attributes: AnyObject) => void, decorationNode: Element | null, - clientRect: DOMRect | null, + clientRect: () => (DOMRect | null), } export interface SuggestionKeyDownProps { @@ -98,7 +98,7 @@ export function Suggestion({ decorationNode, // virtual node for popper.js or tippy.js // this can be used for building popups without a DOM node - clientRect: decorationNode?.getBoundingClientRect() || null, + clientRect: () => decorationNode?.getBoundingClientRect() || null, } if (handleStart) {