mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Revert to old select in change notetype screen for now
Fixes https://forums.ankiweb.net/t/anki-2-1-55-beta-5/24870/25, introduced in #2082
This commit is contained in:
parent
7761f609a0
commit
65fd1a6772
1 changed files with 12 additions and 11 deletions
|
@ -5,8 +5,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Col from "../components/Col.svelte";
|
import Col from "../components/Col.svelte";
|
||||||
import Row from "../components/Row.svelte";
|
import Row from "../components/Row.svelte";
|
||||||
import Select from "../components/Select.svelte";
|
|
||||||
import SelectOption from "../components/SelectOption.svelte";
|
|
||||||
import type { ChangeNotetypeState, MapContext } from "./lib";
|
import type { ChangeNotetypeState, MapContext } from "./lib";
|
||||||
|
|
||||||
export let state: ChangeNotetypeState;
|
export let state: ChangeNotetypeState;
|
||||||
|
@ -15,20 +13,23 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
|
|
||||||
const info = state.info;
|
const info = state.info;
|
||||||
|
|
||||||
let oldIndex = $info.getOldIndex(ctx, newIndex);
|
function onChange(evt: Event) {
|
||||||
|
const oldIdx = parseInt((evt.target as HTMLSelectElement).value, 10);
|
||||||
const options = $info.getOldNamesIncludingNothing(ctx);
|
state.setOldIndex(ctx, newIndex, oldIdx);
|
||||||
$: state.setOldIndex(ctx, newIndex, oldIndex);
|
}
|
||||||
$: label = options[oldIndex];
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Row --cols={2}>
|
<Row --cols={2}>
|
||||||
<Col --col-size={1}>
|
<Col --col-size={1}>
|
||||||
<Select bind:value={oldIndex} {label}>
|
<select
|
||||||
{#each options as name, idx}
|
value={$info.getOldIndex(ctx, newIndex)}
|
||||||
<SelectOption value={idx}>{name}</SelectOption>
|
class="form-select"
|
||||||
|
on:change={onChange}
|
||||||
|
>
|
||||||
|
{#each $info.getOldNamesIncludingNothing(ctx) as name, idx}
|
||||||
|
<option value={idx}>{name}</option>
|
||||||
{/each}
|
{/each}
|
||||||
</Select>
|
</select>
|
||||||
</Col>
|
</Col>
|
||||||
<Col --col-size={1}>
|
<Col --col-size={1}>
|
||||||
{$info.getNewName(ctx, newIndex)}
|
{$info.getNewName(ctx, newIndex)}
|
||||||
|
|
Loading…
Reference in a new issue