mirror of
https://github.com/ankitects/anki.git
synced 2026-01-09 03:53:55 -05:00
Migrate TagAddButton to Svelte 5 callback props
This commit is contained in:
parent
dda192f24c
commit
d4bdcc8c66
2 changed files with 4 additions and 5 deletions
|
|
@ -5,7 +5,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
<script lang="ts">
|
||||
import * as tr from "@generated/ftl";
|
||||
import { getPlatformString } from "@tslib/shortcuts";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
|
||||
import Icon from "$lib/components/Icon.svelte";
|
||||
import IconConstrain from "$lib/components/IconConstrain.svelte";
|
||||
|
|
@ -16,10 +15,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
|
||||
export let keyCombination: string;
|
||||
|
||||
const dispatch = createEventDispatcher<{ tagappend: null }>();
|
||||
export let onTagAppend: (() => void) | undefined;
|
||||
|
||||
function appendTag() {
|
||||
dispatch("tagappend");
|
||||
if (onTagAppend) onTagAppend();
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
@ -43,7 +42,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<Shortcut {keyCombination} on:action={() => dispatch("tagappend")} />
|
||||
<Shortcut {keyCombination} on:action={appendTag} />
|
||||
|
||||
<style lang="scss">
|
||||
.tag-add-button {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
{#if tagsSelected}
|
||||
<TagsSelectedButton on:tagselectall on:tagcopy on:tagdelete />
|
||||
{:else}
|
||||
<TagAddButton on:tagappend {keyCombination} />
|
||||
<TagAddButton {keyCombination} />
|
||||
{/if}
|
||||
{/key}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue