wangEditor icon indicating copy to clipboard operation
wangEditor copied to clipboard

WangEditor 的插入公式功能时仍然遇到了 Failed to construct 'HTMLElement': Illegal constructor 错误。这个错误表明在 qiankun 微前端环境中,插件尝试直接构造 HTMLElement,但这在沙箱环境中是不允许的。

Open git-lwd opened this issue 7 months ago • 1 comments

问题描述

我在qiankun微前端的子应用使用该富文本的插入数学公式的功能的时候遇到了这个问题,AI识别后发现时微前端的沙箱导致了这个问题,大佬能不能帮忙处理一下

wangEditor 版本

5.1.23

是否查阅了文档 ?

(文档链接 www.wangeditor.com

最小成本的复现步骤

(请告诉我们,如何最快的复现该问题?)

  • 步骤一 添加kityformula编辑公式

  • 步骤二Boot.registerModule(formulaModule)注册

  • 步骤三 let latex = kfe.execCommand("get.source"); latex = latex.replace(/\s/g, ""); // 去掉空格

    const formulaNode = {
      type: "paragraph",
      children: [
        {
          type: "formula",
          value: latex,
          children: [
            {
              text: "",
            },
          ],
        },
      ],
    };
    console.log(editor, "编辑器", formulaNode);
    editor.insertNode(formulaNode);
    editor.hidePanelOrModal();
    

执行插入节点时候出现报错

git-lwd avatar Apr 24 '25 10:04 git-lwd

切换 wangeditor-next 试试

cycleccc avatar Apr 25 '25 02:04 cycleccc