mirror of
https://github.com/open-webui/open-webui
synced 2025-01-01 08:42:14 +00:00
refac
This commit is contained in:
parent
b44b7e8162
commit
2c8fb66383
@ -22,6 +22,7 @@
|
|||||||
import GarbageBin from '$lib/components/icons/GarbageBin.svelte';
|
import GarbageBin from '$lib/components/icons/GarbageBin.svelte';
|
||||||
import Pencil from '$lib/components/icons/Pencil.svelte';
|
import Pencil from '$lib/components/icons/Pencil.svelte';
|
||||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||||
|
import Textarea from '$lib/components/common/Textarea.svelte';
|
||||||
|
|
||||||
export let message;
|
export let message;
|
||||||
export let showUserProfile = true;
|
export let showUserProfile = true;
|
||||||
@ -142,16 +143,11 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if edit}
|
{#if edit}
|
||||||
<div class="py-1">
|
<div class="py-2">
|
||||||
<textarea
|
<Textarea
|
||||||
id="message-edit-{message.id}"
|
|
||||||
class=" bg-transparent outline-none w-full resize-none"
|
class=" bg-transparent outline-none w-full resize-none"
|
||||||
bind:value={editedContent}
|
bind:value={editedContent}
|
||||||
on:input={(e) => {
|
onKeydown={(e) => {
|
||||||
e.target.style.height = '';
|
|
||||||
e.target.style.height = `${e.target.scrollHeight}px`;
|
|
||||||
}}
|
|
||||||
on:keydown={(e) => {
|
|
||||||
if (e.key === 'Escape') {
|
if (e.key === 'Escape') {
|
||||||
document.getElementById('close-edit-message-button')?.click();
|
document.getElementById('close-edit-message-button')?.click();
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
export let className =
|
export let className =
|
||||||
'w-full rounded-lg px-3 py-2 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none resize-none h-full';
|
'w-full rounded-lg px-3 py-2 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none resize-none h-full';
|
||||||
|
|
||||||
|
export let onKeydown: Function = () => {};
|
||||||
|
|
||||||
let textareaElement;
|
let textareaElement;
|
||||||
|
|
||||||
$: if (textareaElement) {
|
$: if (textareaElement) {
|
||||||
@ -48,6 +50,7 @@
|
|||||||
value = text;
|
value = text;
|
||||||
}}
|
}}
|
||||||
on:paste={handlePaste}
|
on:paste={handlePaste}
|
||||||
|
on:keydown={onKeydown}
|
||||||
data-placeholder={placeholder}
|
data-placeholder={placeholder}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user