From fb8098c1c06440dd69f4e93881fd36f7e6de2a56 Mon Sep 17 00:00:00 2001 From: vector Date: Sat, 24 Dec 2022 21:54:09 +0800 Subject: [PATCH] fix: add defense for view in transform plugin (#3092) --- packages/x6-plugin-transform/src/transform.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/x6-plugin-transform/src/transform.ts b/packages/x6-plugin-transform/src/transform.ts index 38588657a39..39df90b9d7a 100644 --- a/packages/x6-plugin-transform/src/transform.ts +++ b/packages/x6-plugin-transform/src/transform.ts @@ -107,7 +107,11 @@ export class TransformImpl extends View { render() { this.renderHandles() - this.view.addClass(Private.NODE_CLS) + + if (this.view) { + this.view.addClass(Private.NODE_CLS) + } + Dom.addClass(this.container, this.containerClassName) Dom.toggleClass( this.container, @@ -153,7 +157,9 @@ export class TransformImpl extends View { } remove() { - this.view.removeClass(Private.NODE_CLS) + if (this.view) { + this.view.removeClass(Private.NODE_CLS) + } return super.remove() }