Skip to content

Commit e601717

Browse files
committed
chore: 一些优化
1 parent 325f8f0 commit e601717

6 files changed

Lines changed: 15 additions & 5 deletions

File tree

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/preview.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@slimkit/plus-editor",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "rich-text editor for plus",
55
"main": "dist/main.bundle.js",
66
"repository": "git@github.com:mutoe/plus-editor.git",

src/blots/image.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ export class ImageBlot extends BlockEmbed {
4545
} else {
4646
ImageBlot.uploadStatus[id] = {}
4747
}
48+
} else {
49+
setTimeout(() => {
50+
if (!this.prev) return
51+
const pNode = this.prev.domNode
52+
if (pNode.tagName === 'P' && !pNode.innerText.trim()) {
53+
this.prev.remove() // 移除图片前面的空行
54+
}
55+
}, 0)
4856
}
4957

5058
if (img && src) {
@@ -279,4 +287,4 @@ export class ImageBlot extends BlockEmbed {
279287
}
280288
}
281289

282-
Quill.register(ImageBlot)
290+
Quill.register(ImageBlot, true)

src/blots/video.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,4 @@ export class VideoBlot extends BlockEmbed {
262262
}
263263
}
264264

265-
Quill.register(VideoBlot)
265+
Quill.register(VideoBlot, true)

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ window.addEventListener('resize', () => {
276276
if (range && quill.hasFocus()) {
277277
quill.setSelection(range)
278278
}
279+
280+
fixSize()
279281
})
280282

281283
export default quill

0 commit comments

Comments
 (0)