mirror of
https://github.com/ankitects/anki.git
synced 2025-09-27 10:16:36 -04:00

* Use anki.updateCard instead of window.onmessage in card-info * Make card-info placeholder text grey --------- Co-authored-by: Abdo <abdo@abdnh.net>
25 lines
738 B
Svelte
25 lines
738 B
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 { page } from "$app/stores";
|
|
|
|
import CardInfo from "../CardInfo.svelte";
|
|
import type { PageData } from "./$types";
|
|
import { goto } from "$app/navigation";
|
|
|
|
export let data: PageData;
|
|
|
|
const showRevlog = $page.url.searchParams.get("revlog") !== "0";
|
|
|
|
globalThis.anki ||= {};
|
|
globalThis.anki.updateCard = async (card_id: string): Promise<void> => {
|
|
const path = `/card-info/${card_id}`;
|
|
return goto(path).catch(() => {
|
|
window.location.href = path;
|
|
});
|
|
};
|
|
</script>
|
|
|
|
<CardInfo stats={data.info} {showRevlog} />
|