mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 07:07:13 -05:00
Add selector shortcuts
This commit is contained in:
parent
0137ca6c27
commit
4444942b46
4 changed files with 10 additions and 1 deletions
|
|
@ -31,4 +31,5 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
{onChange}
|
||||
items={decks}
|
||||
icon={mdiBookOutline}
|
||||
keyCombination="Control+D"
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -10,16 +10,18 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
import Modal from "./Modal.svelte";
|
||||
import type { IconData } from "./types";
|
||||
import * as tr from "@generated/ftl";
|
||||
import Shortcut from "./Shortcut.svelte";
|
||||
|
||||
interface Props {
|
||||
title: string;
|
||||
selectedItem?: Item | null;
|
||||
items: Item[];
|
||||
icon: IconData;
|
||||
keyCombination: string;
|
||||
onChange?: (item: Item) => void;
|
||||
}
|
||||
|
||||
let { title, onChange, icon, items, selectedItem = $bindable(null) }: Props = $props();
|
||||
let { title, onChange, icon, items, selectedItem = $bindable(null), keyCombination }: Props = $props();
|
||||
let modal: Modal | null = $state(null);
|
||||
let searchQuery = $state("");
|
||||
|
||||
|
|
@ -54,6 +56,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
{selectedItem?.name ?? "…"}
|
||||
</LabelButton>
|
||||
|
||||
<Shortcut keyCombination={keyCombination} on:action={() => modal?.toggle()} />
|
||||
<Modal bind:this={modal} dialogClass="modal-lg">
|
||||
<div slot="header" class="modal-header">
|
||||
<IconConstrain iconSize={90}>
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
modal.hide();
|
||||
}
|
||||
|
||||
export function toggle(): void {
|
||||
modal.toggle();
|
||||
}
|
||||
|
||||
export { onOkClicked_ as acceptHandler, onCancelClicked_ as cancelHandler };
|
||||
|
||||
const { set: setModalOpen, remove: removeModalClosingHandler } =
|
||||
|
|
|
|||
|
|
@ -30,4 +30,5 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
{onChange}
|
||||
items={notetypes}
|
||||
icon={mdiNewspaper}
|
||||
keyCombination="Control+N"
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue