mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac
This commit is contained in:
parent
ec45d77ce9
commit
9b7c3ff999
1 changed files with 5 additions and 1 deletions
|
|
@ -8,6 +8,7 @@
|
||||||
export let onClick: Function = () => {};
|
export let onClick: Function = () => {};
|
||||||
|
|
||||||
let containerElement;
|
let containerElement;
|
||||||
|
let openPreview = false;
|
||||||
|
|
||||||
// Helper function to return only the domain from a URL
|
// Helper function to return only the domain from a URL
|
||||||
function getDomain(url: string): string {
|
function getDomain(url: string): string {
|
||||||
|
|
@ -40,10 +41,13 @@
|
||||||
{#if (token?.ids ?? []).length == 1}
|
{#if (token?.ids ?? []).length == 1}
|
||||||
<Source id={token.ids[0] - 1} title={sourceIds[token.ids[0] - 1]} {onClick} />
|
<Source id={token.ids[0] - 1} title={sourceIds[token.ids[0] - 1]} {onClick} />
|
||||||
{:else}
|
{:else}
|
||||||
<LinkPreview.Root openDelay={0}>
|
<LinkPreview.Root openDelay={0} bind:open={openPreview}>
|
||||||
<LinkPreview.Trigger>
|
<LinkPreview.Trigger>
|
||||||
<button
|
<button
|
||||||
class="text-[10px] w-fit translate-y-[2px] px-2 py-0.5 dark:bg-white/5 dark:text-white/80 dark:hover:text-white bg-gray-50 text-black/80 hover:text-black transition rounded-xl"
|
class="text-[10px] w-fit translate-y-[2px] px-2 py-0.5 dark:bg-white/5 dark:text-white/80 dark:hover:text-white bg-gray-50 text-black/80 hover:text-black transition rounded-xl"
|
||||||
|
on:click={() => {
|
||||||
|
openPreview = !openPreview;
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<span class="line-clamp-1">
|
<span class="line-clamp-1">
|
||||||
{getDisplayTitle(formattedTitle(decodeURIComponent(sourceIds[token.ids[0] - 1])))}
|
{getDisplayTitle(formattedTitle(decodeURIComponent(sourceIds[token.ids[0] - 1])))}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue