mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 12:47:11 -05:00
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:
parent
e5612b1340
commit
6165567238
3 changed files with 12 additions and 10 deletions
|
|
@ -22,9 +22,9 @@ function trimBreaks(text: string): string {
|
|||
.replace(/\n*$/, "");
|
||||
}
|
||||
|
||||
export const mathjaxConfig = {
|
||||
export const mathjaxConfig = $state({
|
||||
enabled: true,
|
||||
};
|
||||
});
|
||||
|
||||
interface MathjaxProps {
|
||||
mathjax: string;
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue