Refresh fields after MathJax toggle

There's probably a more efficient solution for this but I couldn't
figure it out
This commit is contained in:
Abdo 2025-10-01 11:50:27 +03:00
parent e5612b1340
commit 6165567238
3 changed files with 12 additions and 10 deletions

View file

@ -22,9 +22,9 @@ function trimBreaks(text: string): string {
.replace(/\n*$/, "");
}
export const mathjaxConfig = {
export const mathjaxConfig = $state({
enabled: true,
};
});
interface MathjaxProps {
mathjax: string;

View file

@ -6,6 +6,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import type { Readable } from "svelte/store";
import type { EditingAreaAPI } from "./EditingArea.svelte";
import { mathjaxConfig } from "$lib/editable/mathjax-element.svelte";
export interface FieldData {
name: string;
@ -117,13 +118,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
fontSize={field.fontSize}
api={editingArea}
>
{#if flipInputs}
<slot name="plain-text-input" />
<slot name="rich-text-input" />
{:else}
<slot name="rich-text-input" />
<slot name="plain-text-input" />
{/if}
{#key mathjaxConfig.enabled}
{#if flipInputs}
<slot name="plain-text-input" />
<slot name="rich-text-input" />
{:else}
<slot name="rich-text-input" />
<slot name="plain-text-input" />
{/if}
{/key}
</EditingArea>
</div>
</Collapsible>

View file

@ -34,7 +34,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
bridgeCommand("toggleMathjax");
} else {
setColConfig("renderMathjax", mathjaxConfig.enabled);
// FIXME: refresh
}
}