opentiny / fluent-editor

Fluent Editor is a rich text editor based on Quill 2.0, which extends rich modules and formats on the basis of Quill. It is powerful and out-of-the-box. Fluent Editor 是一个基于 Quill 2.0 的富文本编辑器,在 Quill 基础上扩展了丰富的模块和格式,功能强大、开箱即用。
https://opentiny.github.io/fluent-editor/
MIT License
148 stars 17 forks source link

🐛 [Bug]: mathlive 可编辑公式无法通过 setContents 初始化渲染公式内容 #122

Open kagol opened 1 week ago

kagol commented 1 week ago

Version

latest

Link to minimal reproduction

通过 setContents 方法,无法初始化渲染公式。

const editor = new FluentEditor('#editor', {
  "theme": "snow",
  "modules": {
    "toolbar": ["formula"],
    "mathlive": true
  }
})

// 以下 delta 内容是通过 getContents 获取到的
const delta = {
  "ops": [
    {
      "insert": {
        "mathlive": {
          "value": "\\sum_{i=1}^{n} i^2",
          "mode": "dialog"
        }
      }
    },
    {
      "insert": "\n"
    }
  ]
}

editor.setContents(delta)

Step to reproduce

如上

What is expected

No response

What is actually happening

No response

What is your project name

Wiki

Any additional comments (optional)

No response