mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00

* Put PlainTextInput into its own directory * Create a directory for RichTextInput * Create editor-toolbar directory * Move PreviewButton into editor-toolbar * The time to refactor this is not quite yet here * Create tag-editor directory * Remove some of the uses of WithShortcut * Remove all uses of WithShortcut from editor package * Remove last uses of WithShortcut * Fix typo
34 lines
1 KiB
Svelte
34 lines
1 KiB
Svelte
<!--
|
|
Copyright: Ankitects Pty Ltd and contributors
|
|
License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
-->
|
|
<script context="module" lang="ts">
|
|
import { writable } from "svelte/store";
|
|
|
|
const active = writable(false);
|
|
export const togglePreviewButtonState = (state: boolean) => active.set(state);
|
|
</script>
|
|
|
|
<script lang="ts">
|
|
import { bridgeCommand } from "../../lib/bridgecommand";
|
|
import { getPlatformString } from "../../lib/shortcuts";
|
|
import * as tr from "../../lib/ftl";
|
|
|
|
import LabelButton from "../../components/LabelButton.svelte";
|
|
import Shortcut from "../../components/Shortcut.svelte";
|
|
|
|
const keyCombination = "Control+Shift+P";
|
|
function preview(): void {
|
|
bridgeCommand("preview");
|
|
}
|
|
</script>
|
|
|
|
<LabelButton
|
|
tooltip={tr.browsingPreviewSelectedCard({ val: getPlatformString(keyCombination) })}
|
|
active={$active}
|
|
on:click={preview}
|
|
>
|
|
{tr.actionsPreview()}
|
|
</LabelButton>
|
|
|
|
<Shortcut keyCombination="Control+Shift+P" on:action={preview} />
|