diff --git a/packages/plugin-formula/src/module/render-elem.ts b/packages/plugin-formula/src/module/render-elem.ts index 5abebf1c3..f380ab072 100644 --- a/packages/plugin-formula/src/module/render-elem.ts +++ b/packages/plugin-formula/src/module/render-elem.ts @@ -26,6 +26,7 @@ function renderFormula(elem: SlateElement, children: VNode[] | null, editor: IDo const containerVnode = h( 'div', { + className: 'w-e-textarea-formula-container', props: { contentEditable: false, // 不可编辑 }, diff --git a/packages/plugin-formula/src/register-custom-elem/index.ts b/packages/plugin-formula/src/register-custom-elem/index.ts index 0011cf191..419af31e7 100644 --- a/packages/plugin-formula/src/register-custom-elem/index.ts +++ b/packages/plugin-formula/src/register-custom-elem/index.ts @@ -19,16 +19,6 @@ class WangEditorFormulaCard extends HTMLElement { super() const shadow = this.attachShadow({ mode: 'open' }) const document = shadow.ownerDocument - - // 将样式通过 link 标签引入 - const styleLink = document.createElement('link') - - styleLink.rel = 'stylesheet' - styleLink.href = 'https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css' - styleLink.integrity = 'sha384-n8MVd4RsNIU0tAv4ct0nTaAbDJwPJzDEaqSD1odI+WdtXRGWt2kTvGFasHpSy3SV' - styleLink.crossOrigin = 'anonymous' - shadow.appendChild(styleLink) - const span = document.createElement('span') span.style.display = 'inline-block' @@ -58,6 +48,7 @@ class WangEditorFormulaCard extends HTMLElement { private render(value: string) { katex.render(value, this.span, { throwOnError: false, + output: 'mathml', }) } }