mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-15 05:45:19 +00:00
refac
This commit is contained in:
parent
2e733b46b0
commit
4a57e581d9
1 changed files with 15 additions and 5 deletions
|
|
@ -93,11 +93,19 @@
|
||||||
class=""
|
class=""
|
||||||
type="button"
|
type="button"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
|
let id = `new-button`;
|
||||||
|
let idx = 0;
|
||||||
|
|
||||||
|
while (floatingActionButtons.some((b) => b.id === id)) {
|
||||||
|
idx++;
|
||||||
|
id = `new-button-${idx}`;
|
||||||
|
}
|
||||||
|
|
||||||
floatingActionButtons = [
|
floatingActionButtons = [
|
||||||
...floatingActionButtons,
|
...floatingActionButtons,
|
||||||
{
|
{
|
||||||
id: 'new-button',
|
id: id,
|
||||||
label: $i18n.t('New Button'),
|
label: `${$i18n.t('New Button')}`,
|
||||||
input: true,
|
input: true,
|
||||||
prompt: `{{CONTENT}}\n\n\n{{INPUT_CONTENT}}`
|
prompt: `{{CONTENT}}\n\n\n{{INPUT_CONTENT}}`
|
||||||
}
|
}
|
||||||
|
|
@ -117,17 +125,17 @@
|
||||||
{:else}
|
{:else}
|
||||||
{#each floatingActionButtons as button (button.id)}
|
{#each floatingActionButtons as button (button.id)}
|
||||||
<div class=" py-1 flex w-full justify-between items-start">
|
<div class=" py-1 flex w-full justify-between items-start">
|
||||||
<div class="flex flex-col items-start">
|
<div class="flex flex-col items-start pr-2">
|
||||||
<input
|
<input
|
||||||
class=" self-center text-xs outline-none w-20"
|
class=" self-center text-xs outline-none w-20"
|
||||||
placeholder={$i18n.t('Button Label')}
|
placeholder={$i18n.t('Button Label')}
|
||||||
value={button.label}
|
bind:value={button.label}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<input
|
<input
|
||||||
class=" self-center text-xs outline-none w-20 text-gray-600 dark:text-gray-400"
|
class=" self-center text-xs outline-none w-20 text-gray-600 dark:text-gray-400"
|
||||||
placeholder={$i18n.t('Button ID')}
|
placeholder={$i18n.t('Button ID')}
|
||||||
value={button.id}
|
bind:value={button.id}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -151,6 +159,8 @@
|
||||||
<Minus className="h-4 w-4" />
|
<Minus className="h-4 w-4" />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr class="border-gray-50 dark:border-gray-850 my-2" />
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue