mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-03 10:17:43 -05:00
refac
This commit is contained in:
1 parent
c2eee1aad9
commit
db971b7d38
2 files changed
+8
-8
No files matched your search
@@ -71,13 +71,13 @@
|
||||
|
||||
let showButtons = false;
|
||||
|
||||
// Preserve the CSS anchor while letting actions escape the message scroll container.
|
||||
const portalActions = (node: HTMLElement, keepOpen: boolean) => {
|
||||
// The top layer escapes scroll clipping without moving actions out of the message's tab order.
|
||||
const positionActions = (node: HTMLElement, keepOpen: boolean) => {
|
||||
const anchor = node.parentElement!;
|
||||
const messageElement = anchor.parentElement!;
|
||||
let cleanup: (() => void) | undefined;
|
||||
let destroyed = false;
|
||||
document.body.appendChild(node);
|
||||
node.showPopover();
|
||||
|
||||
const update = () => {
|
||||
if (destroyed) return;
|
||||
@@ -116,7 +116,6 @@
|
||||
for (const element of [messageElement, node]) {
|
||||
for (const event of events) element.removeEventListener(event, scheduleUpdate);
|
||||
}
|
||||
node.remove();
|
||||
}
|
||||
};
|
||||
};
|
||||
@@ -272,9 +271,10 @@
|
||||
{#if !edit && !disabled && !$$slots.header}
|
||||
<div class="absolute right-1 -top-3">
|
||||
<div
|
||||
use:portalActions={showButtons}
|
||||
use:positionActions={showButtons}
|
||||
popover="manual"
|
||||
class="fixed z-9999 flex w-max gap-1 rounded-lg bg-white dark:bg-gray-850 shadow-md p-0.5 border border-gray-100/30 dark:border-gray-850/30"
|
||||
style="opacity: 0; pointer-events: none;"
|
||||
style="inset: auto; margin: 0; color: inherit; opacity: 0; pointer-events: none;"
|
||||
>
|
||||
<slot name="actions">
|
||||
{#if onReaction}
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
let pageBusy = false;
|
||||
let showNoteTabs = false;
|
||||
let noteTabsPreferenceReady = false;
|
||||
$: if (noteTabsPreferenceReady && $user?.id) {
|
||||
$: if (noteTabsPreferenceReady && !$mobile && $user?.id) {
|
||||
localStorage.setItem(`note-tabs-open:${$user.id}`, String(showNoteTabs));
|
||||
}
|
||||
const pendingFileUploads = new Set<Promise<any>>();
|
||||
@@ -1023,7 +1023,7 @@ ${content}
|
||||
};
|
||||
|
||||
onMount(async () => {
|
||||
showNoteTabs = localStorage.getItem(`note-tabs-open:${$user?.id}`) === 'true';
|
||||
showNoteTabs = !$mobile && localStorage.getItem(`note-tabs-open:${$user?.id}`) === 'true';
|
||||
noteTabsPreferenceReady = true;
|
||||
await tick();
|
||||
|
||||
|
||||
Reference in new issue
Block a user