diff --git a/ts/editable/mathjax-element.ts b/ts/editable/mathjax-element.ts index 00422972c..efd217cf1 100644 --- a/ts/editable/mathjax-element.ts +++ b/ts/editable/mathjax-element.ts @@ -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, diff --git a/ts/editor/mathjax-overlay/MathjaxEditor.svelte b/ts/editor/mathjax-overlay/MathjaxEditor.svelte index 3ed0028ef..6c9d32bea 100644 --- a/ts/editor/mathjax-overlay/MathjaxEditor.svelte +++ b/ts/editor/mathjax-overlay/MathjaxEditor.svelte @@ -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(), (set) => { - closeMathjaxEditor = () => set(Symbol()); + const closeSignalStore = writable(false, (set) => { + closeMathjaxEditor = () => set(true); return () => (closeMathjaxEditor = null); }); @@ -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; + }