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*$/, "");
|
.replace(/\n*$/, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
export const mathjaxConfig = {
|
export const mathjaxConfig = $state({
|
||||||
enabled: true,
|
enabled: true,
|
||||||
};
|
});
|
||||||
|
|
||||||
interface MathjaxProps {
|
interface MathjaxProps {
|
||||||
mathjax: string;
|
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 { 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>
|
||||||
|
|
|
||||||
|
|
@ -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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue