mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 05:45:19 +00:00
refac
This commit is contained in:
parent
f6b1b075e1
commit
d6094c2881
1 changed files with 15 additions and 2 deletions
|
|
@ -4,7 +4,9 @@ export function getSuggestionRenderer(Component: any, ComponentProps = {}) {
|
||||||
return function suggestionRenderer() {
|
return function suggestionRenderer() {
|
||||||
let component = null;
|
let component = null;
|
||||||
let container: HTMLDivElement | null = null;
|
let container: HTMLDivElement | null = null;
|
||||||
|
|
||||||
let popup: TippyInstance | null = null;
|
let popup: TippyInstance | null = null;
|
||||||
|
let refEl: HTMLDivElement | null = null; // dummy reference
|
||||||
|
|
||||||
return {
|
return {
|
||||||
onStart: (props: any) => {
|
onStart: (props: any) => {
|
||||||
|
|
@ -25,10 +27,21 @@ export function getSuggestionRenderer(Component: any, ComponentProps = {}) {
|
||||||
context: new Map<string, any>([['i18n', ComponentProps?.i18n]])
|
context: new Map<string, any>([['i18n', ComponentProps?.i18n]])
|
||||||
});
|
});
|
||||||
|
|
||||||
popup = tippy(document.body, {
|
// Create a tiny reference element so outside taps are truly "outside"
|
||||||
|
refEl = document.createElement('div');
|
||||||
|
Object.assign(refEl.style, {
|
||||||
|
position: 'fixed',
|
||||||
|
left: '0px',
|
||||||
|
top: '0px',
|
||||||
|
width: '0px',
|
||||||
|
height: '0px'
|
||||||
|
});
|
||||||
|
document.body.appendChild(refEl);
|
||||||
|
|
||||||
|
popup = tippy(refEl, {
|
||||||
getReferenceClientRect: props.clientRect as any,
|
getReferenceClientRect: props.clientRect as any,
|
||||||
appendTo: () => document.body,
|
appendTo: () => document.body,
|
||||||
content: container, // ✅ real element, not Svelte internals
|
content: container,
|
||||||
interactive: true,
|
interactive: true,
|
||||||
trigger: 'manual',
|
trigger: 'manual',
|
||||||
theme: 'transparent',
|
theme: 'transparent',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue