Skip to content

Commit

Permalink
Allow ref for insertBefore to be null
Browse files Browse the repository at this point in the history
  • Loading branch information
luin committed Apr 4, 2024
1 parent 6b48eca commit 20f02f5
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Fix overload declarations for `quill.formatText()` and other methods
- Expose Bounds type for getBounds()
- Expose Range type
- Allow ref for insertBefore to be null

# 2.0.0-rc.4

Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/quill/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"dependencies": {
"eventemitter3": "^5.0.1",
"lodash-es": "^4.17.21",
"parchment": "3.0.0-rc.0",
"parchment": "3.0.0-rc.1",
"quill-delta": "^5.1.0"
},
"devDependencies": {
Expand Down
4 changes: 0 additions & 4 deletions packages/quill/src/blots/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ class Block extends BlockBlot {
}

moveChildren(target: Parent, ref?: Blot | null) {
// @ts-expect-error Parchment types are wrong
super.moveChildren(target, ref);
this.cache = {};
}
Expand All @@ -116,7 +115,6 @@ class Block extends BlockBlot {
this.parent.insertBefore(clone, this);
return this;
}
// @ts-expect-error Fix me later
this.parent.insertBefore(clone, this.next);
return clone;
}
Expand Down Expand Up @@ -172,11 +170,9 @@ class BlockEmbed extends EmbedBlot {
});
const ref = this.split(index);
blocks.forEach((block) => {
// @ts-expect-error Fix me later
this.parent.insertBefore(block, ref);
});
if (text) {
// @ts-expect-error Fix me later
this.parent.insertBefore(this.scroll.create('text', text), ref);
}
}
Expand Down
1 change: 0 additions & 1 deletion packages/quill/src/blots/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class Embed extends EmbedBlot {
};
} else {
textNode = document.createTextNode(text);
// @ts-expect-error Fix me later
this.parent.insertBefore(this.scroll.create(textNode), this.next);
range = {
startNode: textNode,
Expand Down
2 changes: 1 addition & 1 deletion packages/quill/src/blots/scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class Scroll extends ScrollBlot {
this.optimize();
}

insertBefore(blot: Blot, ref?: Blot) {
insertBefore(blot: Blot, ref?: Blot | null) {
if (blot.statics.scope === Scope.INLINE_BLOT) {
const wrapper = this.scroll.create(
this.statics.defaultChild.blotName,
Expand Down
1 change: 0 additions & 1 deletion packages/quill/src/core/selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ class Selection {
// TODO Give blot ability to not split
if (blot instanceof LeafBlot) {
const after = blot.split(nativeRange.start.offset);
// @ts-expect-error Fix me later
blot.parent.insertBefore(this.cursor, after);
} else {
// @ts-expect-error TODO: nativeRange.start.node doesn't seem to match function signature
Expand Down

0 comments on commit 20f02f5

Please sign in to comment.