@rtdui/editor
Version:
React rich text editor based on tiptap
22 lines (19 loc) • 607 B
JavaScript
import { KatexInlinePlugin } from "./math-katex-inline-plugin.mjs";
import { Extension } from "@tiptap/core";
//#region packages/editor/src/RichTextEditor/tiptap_extensions/extension-math/math-katex-inline.ts
/** 将文档中所有段落中的$...$转换为katex */
const MathKatexInline = Extension.create({
name: "mathKatex",
addOptions() {
return { katexOptions: {} };
},
addProseMirrorPlugins() {
return [...this.parent?.() || [], KatexInlinePlugin({
editor: this.editor,
name: this.name,
katexOptions: this.options.katexOptions
})];
}
});
//#endregion
export { MathKatexInline };