From 630f0402c133f7e6cf054394f1ca6188ebeee7ff Mon Sep 17 00:00:00 2001 From: Zihua Li Date: Thu, 4 Apr 2024 21:12:56 +0800 Subject: [PATCH] Allow ref blots to be null --- CHANGELOG.md | 2 ++ src/blot/abstract/blot.ts | 4 ++-- src/blot/abstract/parent.ts | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 77b0430..7f18a55 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # [Unreleased] +- Allow ref blots to be null + # 3.0.0-rc.0 - Keep identify names in built code bundle diff --git a/src/blot/abstract/blot.ts b/src/blot/abstract/blot.ts index a1bad9d..257b484 100644 --- a/src/blot/abstract/blot.ts +++ b/src/blot/abstract/blot.ts @@ -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; diff --git a/src/blot/abstract/parent.ts b/src/blot/abstract/parent.ts index c5e58a9..2b1c5fd 100644 --- a/src/blot/abstract/parent.ts +++ b/src/blot/abstract/parent.ts @@ -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); });