diff --git a/ts/editable/Mathjax.svelte b/ts/editable/Mathjax.svelte index 01d99ec71..59ecfc33e 100644 --- a/ts/editable/Mathjax.svelte +++ b/ts/editable/Mathjax.svelte @@ -15,12 +15,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const nightMode = getContext(nightModeKey); $: [converted, title] = convertMathjax(mathjax, nightMode, fontSize); + $: empty = title === "MathJax"; $: encoded = encodeURIComponent(converted); Mathjax diff --git a/ts/editable/mathjax.ts b/ts/editable/mathjax.ts index f11923ebb..ad8eb1cd1 100644 --- a/ts/editable/mathjax.ts +++ b/ts/editable/mathjax.ts @@ -11,10 +11,6 @@ function getCSS(nightMode: boolean, fontSize: number): string { return `svg { color: ${color}; fill: ${color}; font-size: ${fontSize}px; }`; } -function getErrorCSS(fontSize: number): string { - return `svg { color: yellow; font-size: ${fontSize}px; }`; -} - function getStyle(css: string): HTMLStyleElement { const style = document.createElement("style") as HTMLStyleElement; style.appendChild(document.createTextNode(css)); @@ -26,7 +22,7 @@ function getEmptyIcon(style: HTMLStyleElement): [string, string] { const svg = icon.children[0]; svg.insertBefore(style, svg.children[0]); - return [svg.outerHTML, ""]; + return [svg.outerHTML, "MathJax"]; } export function convertMathjax( diff --git a/ts/editor/TemplateButtons.svelte b/ts/editor/TemplateButtons.svelte index 4601fea07..22e4d42f3 100644 --- a/ts/editor/TemplateButtons.svelte +++ b/ts/editor/TemplateButtons.svelte @@ -101,7 +101,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html let:shortcutLabel > wrapCurrent("", "")} + on:click={() => + wrapCurrent("", "")} on:mount={withButton(createShortcut)} > {tr.editingMathjaxInline()} @@ -115,7 +116,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html let:shortcutLabel > wrapCurrent("", "")} + on:click={() => + wrapCurrent( + '', + "" + )} on:mount={withButton(createShortcut)} > {tr.editingMathjaxBlock()} @@ -129,7 +134,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html let:shortcutLabel > wrapCurrent("\\ce{", "}")} + on:click={() => + wrapCurrent("\\ce{", "}")} on:mount={withButton(createShortcut)} > {tr.editingMathjaxChemistry()}