Skip to content

Commit

Permalink
fix(block-card): replace exception when change
Browse files Browse the repository at this point in the history
  • Loading branch information
Maple13 committed Jun 28, 2021
1 parent 0cc4d1c commit 26bf07f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/src/components/descendant/descendant.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export class SlateDescendantComponent extends ViewContainerItem<SlateElementCont
NODE_TO_INDEX.set(this.descendant, this.index);
NODE_TO_PARENT.set(this.descendant, this.context.parent);
this.updateView();
this.updateBlockCard();
const rootNodes = this.rootNodes;
this.updateBlockCard(rootNodes)
}

destroyBlockCard() {
Expand All @@ -76,10 +77,10 @@ export class SlateDescendantComponent extends ViewContainerItem<SlateElementCont
this.blockCardComponentRef.instance.initializeCenter(rootNodes);
}

updateBlockCard() {
updateBlockCard(rootNodes: HTMLElement[]) {
this.createBlockCard();
if (this.blockCardComponentRef) {
const firstRootNode = this.rootNodes[0];
const firstRootNode = rootNodes[0];
firstRootNode.replaceWith(this.blockCardComponentRef.instance.nativeElement);
}
}
Expand Down

0 comments on commit 26bf07f

Please sign in to comment.