mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
Bind entry value to select component in deck config selector (#2354)
This commit is contained in:
parent
13d557589f
commit
766d1fdb5c
1 changed files with 3 additions and 2 deletions
|
@ -22,7 +22,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
const dispatchPresetChange = () => dispatch("presetchange");
|
const dispatchPresetChange = () => dispatch("presetchange");
|
||||||
|
|
||||||
$: label = configLabel($configList.find((entry) => entry.current)!);
|
let value = $configList.findIndex((entry) => entry.current);
|
||||||
|
$: label = configLabel($configList[value]);
|
||||||
|
|
||||||
function configLabel(entry: ConfigListEntry): string {
|
function configLabel(entry: ConfigListEntry): string {
|
||||||
const count = tr.deckConfigUsedByDecks({ decks: entry.useCount });
|
const count = tr.deckConfigUsedByDecks({ decks: entry.useCount });
|
||||||
|
@ -93,7 +94,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
<StickyContainer --gutter-block="0.5rem" --sticky-borders="0 0 1px" breakpoint="sm">
|
<StickyContainer --gutter-block="0.5rem" --sticky-borders="0 0 1px" breakpoint="sm">
|
||||||
<ButtonToolbar class="justify-content-between flex-grow-1" wrap={false}>
|
<ButtonToolbar class="justify-content-between flex-grow-1" wrap={false}>
|
||||||
<Select class="flex-grow-1" {label} on:change={blur}>
|
<Select class="flex-grow-1" bind:value {label} on:change={blur}>
|
||||||
{#each $configList as entry}
|
{#each $configList as entry}
|
||||||
<SelectOption value={entry.idx}>{configLabel(entry)}</SelectOption>
|
<SelectOption value={entry.idx}>{configLabel(entry)}</SelectOption>
|
||||||
{/each}
|
{/each}
|
||||||
|
|
Loading…
Reference in a new issue