Feat:升级quill版本;Fix:修复富文本模式下文本输入连续多个空格会压缩成一个的问题

This commit is contained in:
街角小林
2024-12-09 11:38:11 +08:00
parent c29477ed55
commit 68784f3e4d
2 changed files with 16 additions and 12 deletions

View File

@@ -1,11 +1,11 @@
{
"name": "simple-mind-map",
"version": "0.10.6",
"version": "0.12.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"version": "0.10.6",
"version": "0.12.1",
"license": "MIT",
"dependencies": {
"@svgdotjs/svg.js": "3.2.0",
@@ -1822,9 +1822,9 @@
]
},
"node_modules/quill": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/quill/-/quill-2.0.2.tgz",
"integrity": "sha512-QfazNrhMakEdRG57IoYFwffUIr04LWJxbS/ZkidRFXYCQt63c1gK6Z7IHUXMx/Vh25WgPBU42oBaNzQ0K1R/xw==",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/quill/-/quill-2.0.3.tgz",
"integrity": "sha512-xEYQBqfYx/sfb33VJiKnSJp8ehloavImQ2A6564GAbqG55PGw1dAWUn1MUbQB62t0azawUS2CZZhWCjO8gRvTw==",
"dependencies": {
"eventemitter3": "^5.0.1",
"lodash-es": "^4.17.21",
@@ -3553,9 +3553,9 @@
"integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="
},
"quill": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/quill/-/quill-2.0.2.tgz",
"integrity": "sha512-QfazNrhMakEdRG57IoYFwffUIr04LWJxbS/ZkidRFXYCQt63c1gK6Z7IHUXMx/Vh25WgPBU42oBaNzQ0K1R/xw==",
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/quill/-/quill-2.0.3.tgz",
"integrity": "sha512-xEYQBqfYx/sfb33VJiKnSJp8ehloavImQ2A6564GAbqG55PGw1dAWUn1MUbQB62t0azawUS2CZZhWCjO8gRvTw==",
"requires": {
"eventemitter3": "^5.0.1",
"lodash-es": "^4.17.21",

View File

@@ -229,14 +229,14 @@ class RichText {
this.textEditNode = document.createElement('div')
this.textEditNode.classList.add('smm-richtext-node-edit-wrap')
this.textEditNode.style.cssText = `
position:fixed;
box-sizing: border-box;
position:fixed;
box-sizing: border-box;
${
openRealtimeRenderOnNodeTextEdit
? ''
: 'box-shadow: 0 0 20px rgba(0,0,0,.5);'
}
outline: none;
outline: none;
word-break: break-all;
padding: ${paddingY}px ${paddingX}px;
`
@@ -370,7 +370,11 @@ class RichText {
// 获取当前正在编辑的内容
getEditText() {
return this.quill.container.firstChild.innerHTML
// https://github.com/slab/quill/issues/4509
return this.quill
.getSemanticHTML()
.replaceAll(/ +/g, match => ' '.repeat(match.length))
// return this.quill.container.firstChild.innerHTML
// 去除ql-cursor节点
// https://github.com/wanglin2/mind-map/commit/138cc4b3e824671143f0bf70e5c46796f48520d0
// https://github.com/wanglin2/mind-map/commit/0760500cebe8ec4e8ad84ab63f877b8b2a193aa1