Anki/ts/editor/decorated-elements.ts
llama 9d167feb8f
Remove use of createClassComponent in mathjax-element.ts (#3919)
* replace use of deprecated createClassComponent with mount

* bump esbuild-svelte from 0.8.1 to 0.9.2

* mathjax-element.ts -> mathjax-element.svelte.ts

* move caret after tick
2025-04-13 16:21:22 +10:00

32 lines
1.1 KiB
TypeScript

// Copyright: Ankitects Pty Ltd and contributors
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
import { BLOCK_ELEMENTS } from "@tslib/dom";
import { CustomElementArray } from "../editable/decorated";
import { FrameElement } from "../editable/frame-element";
import { FrameEnd, FrameStart } from "../editable/frame-handle";
import { Mathjax } from "../editable/mathjax-element.svelte";
import { parsingInstructions } from "./plain-text-input";
const decoratedElements = new CustomElementArray();
function registerMathjax() {
decoratedElements.push(Mathjax);
parsingInstructions.push("<style>anki-mathjax { white-space: pre; }</style>");
}
function registerFrameElement() {
customElements.define(FrameElement.tagName, FrameElement);
customElements.define(FrameStart.tagName, FrameStart);
customElements.define(FrameEnd.tagName, FrameEnd);
/* This will ensure that they are not targeted by surrounding algorithms */
BLOCK_ELEMENTS.push(FrameStart.tagName.toUpperCase());
BLOCK_ELEMENTS.push(FrameEnd.tagName.toUpperCase());
}
registerMathjax();
registerFrameElement();
export { decoratedElements };