diff --git a/ts/editable/Mathjax.svelte b/ts/editable/Mathjax.svelte index 59ecfc33e..d471c6fed 100644 --- a/ts/editable/Mathjax.svelte +++ b/ts/editable/Mathjax.svelte @@ -3,12 +3,14 @@ Copyright: Ankitects Pty Ltd and contributors License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html --> - wrapCurrent("", "")} + wrapCurrent( + "", + "" + )} on:mount={withButton(createShortcut)} > {tr.editingMathjaxInline()} @@ -118,7 +121,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html wrapCurrent( - '', + '', "" )} on:mount={withButton(createShortcut)} @@ -135,7 +138,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html > - wrapCurrent("\\ce{", "}")} + wrapCurrent( + "\\ce{", + "}" + )} on:mount={withButton(createShortcut)} > {tr.editingMathjaxChemistry()} diff --git a/ts/editor/editing-area.ts b/ts/editor/editing-area.ts index 90867bf93..127963c2c 100644 --- a/ts/editor/editing-area.ts +++ b/ts/editor/editing-area.ts @@ -238,18 +238,19 @@ export class EditingArea extends HTMLDivElement { async showHandles(event: MouseEvent): Promise { if (event.target instanceof HTMLImageElement) { + const image = event.target as HTMLImageElement; await this.resetHandles(); - if (!event.target.dataset.anki) { + if (!image.dataset.anki) { await this.imageHandle.then((imageHandle) => (imageHandle as any).$set({ - activeImage: event.target, + activeImage: image, isRtl: this.isRightToLeft(), }) ); - } else if (event.target.dataset.anki === "mathjax") { + } else if (image.dataset.anki === "mathjax") { (this.mathjaxHandle as any).$set({ - activeImage: event.target, + activeImage: image, isRtl: this.isRightToLeft(), }); }