anki/ts/ChangeNotetype/SaveButton.svelte
Damien Elmes 61e86cc29d new change notetype implementation for the frontend
- changes can now be undone
- the same field can now be mapped to multiple target fields, allowing
fields to be cloned
- the old Qt dialog has been removed
- the old col.models.change() API calls the new code, to avoid
breaking existing consumers. It requires the field map to always
be passed in, but that appears to have been the common case.
- closes #1175
2021-06-10 22:19:24 +10:00

37 lines
1.1 KiB
Svelte

<!--
Copyright: Ankitects Pty Ltd and contributors
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
-->
<script lang="ts">
import * as tr from "lib/i18n";
import type { ChangeNotetypeState } from "./lib";
import ButtonGroup from "components/ButtonGroup.svelte";
import ButtonGroupItem from "components/ButtonGroupItem.svelte";
import LabelButton from "components/LabelButton.svelte";
import WithShortcut from "components/WithShortcut.svelte";
export let state: ChangeNotetypeState;
function save(): void {
if (document.activeElement instanceof HTMLElement) {
document.activeElement.blur();
}
state.save();
}
</script>
<ButtonGroup>
<ButtonGroupItem>
<WithShortcut shortcut={"Control+Enter"} let:createShortcut let:shortcutLabel>
<LabelButton
theme="primary"
on:click={() => save()}
tooltip={shortcutLabel}
on:mount={createShortcut}>{tr.actionsSave()}</LabelButton
>
</WithShortcut>
</ButtonGroupItem>
</ButtonGroup>