Fix:修复添加数学公式报错的问题

This commit is contained in:
街角小林 2024-12-12 16:33:24 +08:00
parent 3f002ce2ee
commit 5a291b4a5f
3 changed files with 7 additions and 7 deletions

View File

@ -15,7 +15,7 @@
"katex": "^0.16.8",
"mdast-util-from-markdown": "^1.3.0",
"pdf-lib": "^1.17.1",
"quill": "^2.0.2",
"quill": "^2.0.3",
"tern": "^0.24.3",
"uuid": "^9.0.0",
"ws": "^7.5.9",

View File

@ -35,7 +35,7 @@
"katex": "^0.16.8",
"mdast-util-from-markdown": "^1.3.0",
"pdf-lib": "^1.17.1",
"quill": "^2.0.2",
"quill": "^2.0.3",
"tern": "^0.24.3",
"uuid": "^9.0.0",
"ws": "^7.5.9",

View File

@ -376,10 +376,9 @@ class RichText {
// 获取当前正在编辑的内容
getEditText() {
// https://github.com/slab/quill/issues/4509
return this.quill
.getSemanticHTML()
.replaceAll(/ +/g, match => ' '.repeat(match.length))
// return this.quill.container.firstChild.innerHTML
return this.quill.container.firstChild.innerHTML.replaceAll(/ +/g, match =>
' '.repeat(match.length)
)
// 去除ql-cursor节点
// https://github.com/wanglin2/mind-map/commit/138cc4b3e824671143f0bf70e5c46796f48520d0
// https://github.com/wanglin2/mind-map/commit/0760500cebe8ec4e8ad84ab63f877b8b2a193aa1
@ -495,7 +494,8 @@ class RichText {
'color',
'background',
'font',
'size'
'size',
'formula'
], // 明确指定允许的格式,不包含有序列表,无序列表等
theme: 'snow'
})