mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Generalize accesing anki-mathjax from image in MathjaxHandle
This commit is contained in:
parent
b6bea18b22
commit
c02973a85d
1 changed files with 6 additions and 2 deletions
|
@ -31,8 +31,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
let updateSelection: () => void;
|
||||
let title: string;
|
||||
|
||||
function getComponent(image: HTMLImageElement): HTMLElement {
|
||||
return (image.closest("anki-mathjax")! as HTMLElement);
|
||||
}
|
||||
|
||||
function onUpdate(event: CustomEvent) {
|
||||
activeImage!.parentElement!.dataset.mathjax = event.detail.mathjax;
|
||||
getComponent(activeImage!).dataset.mathjax = event.detail.mathjax;
|
||||
setTimeout(() => {
|
||||
updateSelection();
|
||||
title = activeImage!.title;
|
||||
|
@ -63,7 +67,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
|
||||
<DropdownMenu>
|
||||
<MathjaxHandleEditor
|
||||
initialValue={activeImage.parentElement?.dataset.mathjax ?? ""}
|
||||
initialValue={getComponent(activeImage).dataset.mathjax ?? ""}
|
||||
on:update={(event) => {
|
||||
onUpdate(event);
|
||||
setTimeout(dropdownObject.update);
|
||||
|
|
Loading…
Reference in a new issue