ui: When enter is pressed on vector flag, add an item
This commit is contained in:
parent
7cdca440e6
commit
630c065825
|
@ -4,6 +4,7 @@
|
|||
Icon,
|
||||
Spinner,
|
||||
} from 'sveltestrap';
|
||||
import { tick } from 'svelte';
|
||||
|
||||
import { settings } from '../stores/settings.js';
|
||||
|
||||
|
@ -35,6 +36,10 @@
|
|||
|
||||
let wcsubmitted = false;
|
||||
async function wantchoices() {
|
||||
if (!confirm("Êtes-vous sûr de vouloir utiliser " + (flag.choices_cost * $settings.wchoiceCurrentCoefficient) + " points pour avoir une liste de propositions à la place de ce champ de texte à compléter ?")) {
|
||||
return;
|
||||
}
|
||||
|
||||
wcsubmitted = true;
|
||||
|
||||
const response = await fetch(
|
||||
|
@ -125,6 +130,7 @@
|
|||
bind:value={values[index]}
|
||||
placeholder={flag.placeholder}
|
||||
title={flag.placeholder}
|
||||
on:keydown={(e) => {if (flag.separator && e.keyCode === 13) { e.preventDefault(); addItem(); tick().then(() => { document.getElementById('sol_' + flag.type + '' + flag.id + '_' + (values.length - 1)).focus(); }); return false;}}}
|
||||
>
|
||||
{:else}
|
||||
<textarea
|
||||
|
@ -150,7 +156,7 @@
|
|||
{#if wcsubmitted}
|
||||
<Spinner size="sm" class="me-2" />
|
||||
{/if}
|
||||
<Icon name="tasks" />
|
||||
<Icon name="list-task" />
|
||||
Liste de propositions ({flag.choices_cost * $settings.wchoiceCurrentCoefficient} {flag.choices_cost * $settings.wchoiceCurrentCoefficient===1?"point":"points"})
|
||||
</Button>
|
||||
{:else if flag.separator && !flag.nb_lines && index == values.length - 1}
|
||||
|
|
Loading…
Reference in New Issue