Allow ref blots to be null

This commit is contained in:
Zihua Li 2024-04-04 21:12:56 +08:00
parent 5566ee0b5e
commit 37690992c5
3 changed files with 5 additions and 3 deletions

View File

@ -1,5 +1,7 @@
# [Unreleased]
- Allow ref blots to be null
# 3.0.0-rc.0
- Keep identify names in built code bundle

View File

@ -96,8 +96,8 @@ export interface Parent extends Blot {
index: number,
length: number,
): T[];
insertBefore(child: Blot, refNode?: Blot): void;
moveChildren(parent: Parent, refNode?: Blot): void;
insertBefore(child: Blot, refNode?: Blot | null): void;
moveChildren(parent: Parent, refNode?: Blot | null): void;
path(index: number, inclusive?: boolean): [Blot, number][];
removeChild(child: Blot): void;
unwrap(): void;

View File

@ -243,7 +243,7 @@ class ParentBlot extends ShadowBlot implements Parent {
}, 0);
}
public moveChildren(targetParent: Parent, refNode?: Blot): void {
public moveChildren(targetParent: Parent, refNode?: Blot | null): void {
this.children.forEach((child) => {
targetParent.insertBefore(child, refNode);
});