Restore toggleMathjax for legacy editor

This commit is contained in:
Abdo 2025-09-30 15:52:43 +03:00
parent 6bd560ea3a
commit fbd21ba7f1
4 changed files with 13 additions and 5 deletions

View file

@ -1377,7 +1377,7 @@ components and functionality for general note editing.
/> />
{/if} {/if}
<EditorToolbar {size} {wrap} api={toolbar}> <EditorToolbar {size} {wrap} {isLegacy} api={toolbar}>
<svelte:fragment slot="notetypeButtons"> <svelte:fragment slot="notetypeButtons">
{#if mode === "browser"} {#if mode === "browser"}
<ButtonGroupItem> <ButtonGroupItem>

View file

@ -64,6 +64,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import TemplateButtons from "./TemplateButtons.svelte"; import TemplateButtons from "./TemplateButtons.svelte";
import type { InlineButtonsAPI } from "./InlineButtons.svelte"; import type { InlineButtonsAPI } from "./InlineButtons.svelte";
export let isLegacy = false;
export let size: number; export let size: number;
export let wrap: boolean; export let wrap: boolean;
@ -105,7 +106,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</Item> </Item>
<Item id="settings"> <Item id="settings">
<OptionsButtons api={optionsButtons} /> <OptionsButtons api={optionsButtons} {isLegacy} />
</Item> </Item>
<Item id="inlineFormatting"> <Item id="inlineFormatting">

View file

@ -17,7 +17,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { shrinkImagesByDefault } from "../image-overlay/ImageOverlay.svelte"; import { shrinkImagesByDefault } from "../image-overlay/ImageOverlay.svelte";
import { closeHTMLTags } from "../plain-text-input/PlainTextInput.svelte"; import { closeHTMLTags } from "../plain-text-input/PlainTextInput.svelte";
import { setColConfig } from "@tslib/profile"; import { setColConfig } from "@tslib/profile";
import { bridgeCommand } from "@tslib/bridgecommand";
export let isLegacy = false;
let showFloating = false; let showFloating = false;
function toggleShrinkImages(_evt: MouseEvent): void { function toggleShrinkImages(_evt: MouseEvent): void {
@ -28,9 +30,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
function toggleShowMathjax(_evt: MouseEvent): void { function toggleShowMathjax(_evt: MouseEvent): void {
mathjaxConfig.enabled = !mathjaxConfig.enabled; mathjaxConfig.enabled = !mathjaxConfig.enabled;
if (isLegacy) {
bridgeCommand("toggleMathjax");
} else {
setColConfig("renderMathjax", mathjaxConfig.enabled); setColConfig("renderMathjax", mathjaxConfig.enabled);
// FIXME: refresh // FIXME: refresh
} }
}
function toggleCloseHTMLTags(_evt: MouseEvent): void { function toggleCloseHTMLTags(_evt: MouseEvent): void {
$closeHTMLTags = !$closeHTMLTags; $closeHTMLTags = !$closeHTMLTags;

View file

@ -14,6 +14,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import OptionsButton from "./OptionsButton.svelte"; import OptionsButton from "./OptionsButton.svelte";
export let api = {}; export let api = {};
export let isLegacy = false;
</script> </script>
<ButtonGroup> <ButtonGroup>
@ -25,7 +26,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
{api} {api}
> >
<ButtonGroupItem id="options"> <ButtonGroupItem id="options">
<OptionsButton /> <OptionsButton {isLegacy} />
</ButtonGroupItem> </ButtonGroupItem>
</DynamicallySlottable> </DynamicallySlottable>
</ButtonGroup> </ButtonGroup>