mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-03 18:17:56 -05:00
The image viewer took the full screen height including the part behind Safari's toolbars, so the image sat off-centre and the bottom of a tall image was cut off. It now fits the visible screen, as the other dialogs already do. The expanded message editor had the same extra height and now fits the visible screen too. Fixes #35411
81 lines
2.1 KiB
Svelte
81 lines
2.1 KiB
Svelte
<script lang="ts">
|
|
import { onMount, getContext } from 'svelte';
|
|
import { settings } from '$lib/stores';
|
|
|
|
import Drawer from './Drawer.svelte';
|
|
import RichTextInput from './RichTextInput.svelte';
|
|
|
|
const i18n: any = getContext('i18n');
|
|
|
|
export let id = 'input-modal';
|
|
|
|
export let show = false;
|
|
export let value = null;
|
|
export let inputContent = null;
|
|
|
|
export let autocomplete = false;
|
|
export let generateAutoCompletion = null;
|
|
|
|
export let onChange = () => {};
|
|
export let oninput: ((event: Event) => void) | undefined = undefined;
|
|
export let onClose = () => {};
|
|
|
|
let inputElement;
|
|
</script>
|
|
|
|
<Drawer bind:show ariaLabel={$i18n.t('Input')}>
|
|
<div class="flex h-full min-h-[100dvh] flex-col" {oninput}>
|
|
<div
|
|
class=" sticky top-0 z-30 flex justify-between bg-base-0 px-4 pt-3 pb-2 dark:bg-base-900 dark:text-base-100"
|
|
>
|
|
<div class="text-sm font-medium self-center">
|
|
{$i18n.t('Input')}
|
|
</div>
|
|
<button
|
|
class="self-center"
|
|
aria-label={$i18n.t('Close')}
|
|
onclick={() => {
|
|
show = false;
|
|
onClose();
|
|
}}
|
|
>
|
|
<svg
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 20 20"
|
|
fill="currentColor"
|
|
class="h-5 w-5"
|
|
>
|
|
<path
|
|
d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"
|
|
/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
|
|
<div class="flex w-full px-4 dark:text-base-200 min-h-full flex-1">
|
|
<div class="flex-1 w-full min-h-full">
|
|
<RichTextInput
|
|
bind:this={inputElement}
|
|
{id}
|
|
onChange={(content) => {
|
|
value = content.md;
|
|
inputContent = content;
|
|
|
|
onChange(content);
|
|
}}
|
|
json={true}
|
|
value={inputContent?.json}
|
|
html={inputContent?.html}
|
|
richText={$settings?.richTextInput ?? true}
|
|
messageInput={true}
|
|
showFormattingToolbar={$settings?.showFormattingToolbar ?? false}
|
|
floatingMenuPlacement={'top-start'}
|
|
insertPromptAsRichText={$settings?.insertPromptAsRichText ?? false}
|
|
{autocomplete}
|
|
{generateAutoCompletion}
|
|
/>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</Drawer>
|