mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Expose onUpdateHook/onShownHook via package
This commit is contained in:
parent
88f613aaf0
commit
1e00b7d4c4
2 changed files with 13 additions and 1 deletions
|
@ -26,7 +26,8 @@ type AnkiPackages =
|
|||
| "anki/theme"
|
||||
| "anki/location"
|
||||
| "anki/surround"
|
||||
| "anki/ui";
|
||||
| "anki/ui"
|
||||
| "anki/reviewer";
|
||||
type PackageDeprecation<T extends Record<string, unknown>> = {
|
||||
[key in keyof T]?: string;
|
||||
};
|
||||
|
|
|
@ -17,6 +17,7 @@ globalThis.anki.mutateNextCardStates = mutateNextCardStates;
|
|||
globalThis.anki.setupImageCloze = setupImageCloze;
|
||||
|
||||
import { bridgeCommand } from "@tslib/bridgecommand";
|
||||
import { registerPackage } from "@tslib/runtime-require";
|
||||
|
||||
import { allImagesLoaded, preloadAnswerImages } from "./images";
|
||||
import { preloadResources } from "./preload";
|
||||
|
@ -261,3 +262,13 @@ document.addEventListener("focusout", (event) => {
|
|||
document.body.removeChild(dummyButton);
|
||||
}
|
||||
});
|
||||
|
||||
registerPackage("anki/reviewer", {
|
||||
// If you append a function to this each time the question or answer
|
||||
// is shown, it will be called before MathJax has been rendered.
|
||||
onUpdateHook,
|
||||
// If you append a function to this each time the question or answer
|
||||
// is shown, it will be called after images have been preloaded and
|
||||
// MathJax has been rendered.
|
||||
onShownHook,
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue