diff --git a/ts/editable/MathjaxBlock.svelte b/ts/editable/MathjaxBlock.svelte index ba78b659a..0ff5f6a5f 100644 --- a/ts/editable/MathjaxBlock.svelte +++ b/ts/editable/MathjaxBlock.svelte @@ -6,7 +6,6 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import { convertMathjax } from "./mathjax"; export let mathjax: string; - $: console.log(mathjax, convertMathjax(`\\(${mathjax}\\)`)); $: converted = convertMathjax(`\\(${mathjax}\\)`); diff --git a/ts/editable/mathjax-components.ts b/ts/editable/mathjax-components.ts index 9b905b376..7ed48f1bf 100644 --- a/ts/editable/mathjax-components.ts +++ b/ts/editable/mathjax-components.ts @@ -41,10 +41,11 @@ export function toMathjaxTags(html: string): string { .replace( mathjaxInlineDelimiterPattern, (_match: string, text: string) => - `${text}` + `${text}` ) .replace( mathjaxBlockDelimiterPattern, - (_match: string, text: string) => `${text}` + (_match: string, text: string) => + `${text}` ); } diff --git a/ts/editor/editing-area.ts b/ts/editor/editing-area.ts index c7bdc8468..ee226995d 100644 --- a/ts/editor/editing-area.ts +++ b/ts/editor/editing-area.ts @@ -17,6 +17,7 @@ import { bridgeCommand } from "./lib"; import { onInput, onKey, onKeyUp } from "./input-handlers"; import { onFocus, onBlur } from "./focus-handlers"; import { nightModeKey } from "components/context-keys"; +import { toMathjaxTags, toMathjaxDelimiters } from "editable/mathjax-components"; function onCutOrCopy(): void { bridgeCommand("cutOrCopy"); @@ -92,11 +93,13 @@ export class EditingArea extends HTMLDivElement { } set fieldHTML(content: string) { - this.imageHandle.then(() => (this.activeInput.fieldHTML = content)); + this.imageHandle.then( + () => (this.activeInput.fieldHTML = toMathjaxTags(content)) + ); } get fieldHTML(): string { - return this.activeInput.fieldHTML; + return toMathjaxDelimiters(this.activeInput.fieldHTML); } connectedCallback(): void {