mirror of
https://github.com/open-webui/open-webui
synced 2025-06-04 03:37:35 +00:00
refac: textarea
This commit is contained in:
parent
4383306770
commit
789e1db260
@ -55,13 +55,14 @@
|
|||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form
|
{#if taskConfig}
|
||||||
|
<form
|
||||||
class="flex flex-col h-full justify-between space-y-3 text-sm"
|
class="flex flex-col h-full justify-between space-y-3 text-sm"
|
||||||
on:submit|preventDefault={() => {
|
on:submit|preventDefault={() => {
|
||||||
updateInterfaceHandler();
|
updateInterfaceHandler();
|
||||||
dispatch('save');
|
dispatch('save');
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class=" overflow-y-scroll scrollbar-hidden h-full pr-1.5">
|
<div class=" overflow-y-scroll scrollbar-hidden h-full pr-1.5">
|
||||||
<div>
|
<div>
|
||||||
<div class=" mb-2.5 text-sm font-medium flex items-center">
|
<div class=" mb-2.5 text-sm font-medium flex items-center">
|
||||||
@ -130,7 +131,9 @@
|
|||||||
>
|
>
|
||||||
<Textarea
|
<Textarea
|
||||||
bind:value={taskConfig.TITLE_GENERATION_PROMPT_TEMPLATE}
|
bind:value={taskConfig.TITLE_GENERATION_PROMPT_TEMPLATE}
|
||||||
placeholder={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
placeholder={$i18n.t(
|
||||||
|
'Leave empty to use the default prompt, or enter a custom prompt'
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
@ -190,7 +193,9 @@
|
|||||||
>
|
>
|
||||||
<Textarea
|
<Textarea
|
||||||
bind:value={taskConfig.QUERY_GENERATION_PROMPT_TEMPLATE}
|
bind:value={taskConfig.QUERY_GENERATION_PROMPT_TEMPLATE}
|
||||||
placeholder={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
|
placeholder={$i18n.t(
|
||||||
|
'Leave empty to use the default prompt, or enter a custom prompt'
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
@ -245,7 +250,8 @@
|
|||||||
required
|
required
|
||||||
>
|
>
|
||||||
{#if banner.type == ''}
|
{#if banner.type == ''}
|
||||||
<option value="" selected disabled class="text-gray-900">{$i18n.t('Type')}</option
|
<option value="" selected disabled class="text-gray-900"
|
||||||
|
>{$i18n.t('Type')}</option
|
||||||
>
|
>
|
||||||
{/if}
|
{/if}
|
||||||
<option value="info" class="text-gray-900">{$i18n.t('Info')}</option>
|
<option value="info" class="text-gray-900">{$i18n.t('Info')}</option>
|
||||||
@ -387,4 +393,5 @@
|
|||||||
{$i18n.t('Save')}
|
{$i18n.t('Save')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
{/if}
|
||||||
|
@ -13,28 +13,15 @@
|
|||||||
// Adjust height on mount and after setting the element.
|
// Adjust height on mount and after setting the element.
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
await tick();
|
await tick();
|
||||||
adjustHeight();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// This reactive statement runs whenever `value` changes
|
|
||||||
$: adjustHeight();
|
|
||||||
|
|
||||||
// Adjust height to match content
|
|
||||||
const adjustHeight = () => {
|
|
||||||
if (textareaElement) {
|
|
||||||
// Reset height to calculate the correct scroll height
|
|
||||||
textareaElement.style.height = 'auto';
|
|
||||||
textareaElement.style.height = `${textareaElement.scrollHeight}px`;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<textarea
|
<textarea
|
||||||
bind:this={textareaElement}
|
bind:this={textareaElement}
|
||||||
bind:value
|
bind:value
|
||||||
{placeholder}
|
{placeholder}
|
||||||
on:input={adjustHeight}
|
|
||||||
class={className}
|
class={className}
|
||||||
|
style="field-sizing: content;"
|
||||||
{rows}
|
{rows}
|
||||||
{required}
|
{required}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user