mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Fix MathJax editor not loading
This commit is contained in:
parent
797f6a02c5
commit
929053f01e
2 changed files with 9 additions and 5 deletions
|
@ -5,6 +5,7 @@ import { on } from "@tslib/events";
|
|||
|
||||
import { placeCaretAfter, placeCaretBefore } from "$lib/domlib/place-caret";
|
||||
|
||||
import { createClassComponent } from "svelte/legacy";
|
||||
import type { DecoratedElement, DecoratedElementConstructor } from "./decorated";
|
||||
import { FrameElement, frameElement } from "./frame-element";
|
||||
import Mathjax_svelte from "./Mathjax.svelte";
|
||||
|
@ -113,8 +114,8 @@ export const Mathjax: DecoratedElementConstructor = class Mathjax extends HTMLEl
|
|||
this.dataset.mathjax = this.innerHTML;
|
||||
this.innerHTML = "";
|
||||
this.style.whiteSpace = "normal";
|
||||
|
||||
this.component = new Mathjax_svelte({
|
||||
this.component = createClassComponent({
|
||||
component: Mathjax_svelte,
|
||||
target: this,
|
||||
props: {
|
||||
mathjax: this.dataset.mathjax,
|
||||
|
|
|
@ -7,8 +7,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
|
||||
export let closeMathjaxEditor: (() => void) | null = null;
|
||||
|
||||
const closeSignalStore = writable<symbol>(Symbol(), (set) => {
|
||||
closeMathjaxEditor = () => set(Symbol());
|
||||
const closeSignalStore = writable<boolean>(false, (set) => {
|
||||
closeMathjaxEditor = () => set(true);
|
||||
return () => (closeMathjaxEditor = null);
|
||||
});
|
||||
</script>
|
||||
|
@ -107,7 +107,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
});
|
||||
});
|
||||
|
||||
$: $closeSignalStore, dispatch("close");
|
||||
$: if ($closeSignalStore) {
|
||||
dispatch("close");
|
||||
$closeSignalStore = false;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="mathjax-editor" class:light-theme={!$pageTheme.isDark}>
|
||||
|
|
Loading…
Reference in a new issue