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:
Damien Elmes 2022-12-03 23:04:08 +10:00
parent 7761f609a0
commit 65fd1a6772

View File

@ -5,8 +5,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
<script lang="ts">
import Col from "../components/Col.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";
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;
let oldIndex = $info.getOldIndex(ctx, newIndex);
const options = $info.getOldNamesIncludingNothing(ctx);
$: state.setOldIndex(ctx, newIndex, oldIndex);
$: label = options[oldIndex];
function onChange(evt: Event) {
const oldIdx = parseInt((evt.target as HTMLSelectElement).value, 10);
state.setOldIndex(ctx, newIndex, oldIdx);
}
</script>
<Row --cols={2}>
<Col --col-size={1}>
<Select bind:value={oldIndex} {label}>
{#each options as name, idx}
<SelectOption value={idx}>{name}</SelectOption>
<select
value={$info.getOldIndex(ctx, newIndex)}
class="form-select"
on:change={onChange}
>
{#each $info.getOldNamesIncludingNothing(ctx) as name, idx}
<option value={idx}>{name}</option>
{/each}
</Select>
</select>
</Col>
<Col --col-size={1}>
{$info.getNewName(ctx, newIndex)}