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

View file

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