@plait/mind 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2608,11 +2608,12 @@ class MindNodeComponent extends PlaitPluginElementComponent {
2608
2608
  get handActive() {
2609
2609
  return this.board.pointer === PlaitPointerType.hand;
2610
2610
  }
2611
- constructor(viewContainerRef, cdr, render2) {
2611
+ constructor(viewContainerRef, cdr, render2, ngZone) {
2612
2612
  super(cdr);
2613
2613
  this.viewContainerRef = viewContainerRef;
2614
2614
  this.cdr = cdr;
2615
2615
  this.render2 = render2;
2616
+ this.ngZone = ngZone;
2616
2617
  this.isEditable = false;
2617
2618
  this.activeG = [];
2618
2619
  this.shapeG = null;
@@ -2661,17 +2662,14 @@ class MindNodeComponent extends PlaitPluginElementComponent {
2661
2662
  this.drawEmojis();
2662
2663
  }
2663
2664
  else {
2664
- if (value.selected !== previous.selected) {
2665
+ const hasSameSelected = value.selected === previous.selected;
2666
+ const hasSameParent = value.parent === previous.parent;
2667
+ if (!hasSameSelected) {
2665
2668
  this.drawActiveG();
2666
2669
  this.updateActiveClass();
2667
2670
  }
2668
- if (!PlaitMind.isMind(value.element)) {
2669
- const parent = MindElement.getParent(previous.element);
2670
- const newParent = MindElement.getParent(value.element);
2671
- const hasSameChildren = parent.children.length === newParent.children.length;
2672
- if (!hasSameChildren) {
2673
- this.drawLink();
2674
- }
2671
+ if (!hasSameParent) {
2672
+ this.drawLink();
2675
2673
  }
2676
2674
  }
2677
2675
  }
@@ -3097,18 +3095,20 @@ class MindNodeComponent extends PlaitPluginElementComponent {
3097
3095
  }
3098
3096
  };
3099
3097
  const exitHandle = () => {
3100
- // unsubscribe
3101
- valueChange$.unsubscribe();
3102
- composition$.unsubscribe();
3103
- mousedown$.unsubscribe();
3104
- editor.keydown = keydown; // reset keydown
3105
- // editable status
3106
- MERGING.set(this.board, false);
3107
- richtextInstance.plaitReadonly = true;
3108
- this.richtextComponentRef?.changeDetectorRef.markForCheck();
3109
- this.isEditable = false;
3110
- updateMindNodeTopicSize(this.board, this.node, this.richtextG, this.isEditable);
3111
- IS_TEXT_EDITABLE.set(this.board, false);
3098
+ this.ngZone.run(() => {
3099
+ // unsubscribe
3100
+ valueChange$.unsubscribe();
3101
+ composition$.unsubscribe();
3102
+ mousedown$.unsubscribe();
3103
+ editor.keydown = keydown; // reset keydown
3104
+ // editable status
3105
+ MERGING.set(this.board, false);
3106
+ richtextInstance.plaitReadonly = true;
3107
+ this.richtextComponentRef?.changeDetectorRef.markForCheck();
3108
+ this.isEditable = false;
3109
+ updateMindNodeTopicSize(this.board, this.node, this.richtextG, this.isEditable);
3110
+ IS_TEXT_EDITABLE.set(this.board, false);
3111
+ });
3112
3112
  };
3113
3113
  }
3114
3114
  ngOnDestroy() {
@@ -3122,7 +3122,7 @@ class MindNodeComponent extends PlaitPluginElementComponent {
3122
3122
  }
3123
3123
  }
3124
3124
  }
3125
- MindNodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: MindNodeComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }], target: i0.ɵɵFactoryTarget.Component });
3125
+ MindNodeComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: MindNodeComponent, deps: [{ token: i0.ViewContainerRef }, { token: i0.ChangeDetectorRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
3126
3126
  MindNodeComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: MindNodeComponent, selector: "plait-mind-node", usesInheritance: true, ngImport: i0, template: `
3127
3127
  <plait-children
3128
3128
  *ngIf="!element.isCollapsed"
@@ -3147,7 +3147,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImpor
3147
3147
  `,
3148
3148
  changeDetection: ChangeDetectionStrategy.OnPush
3149
3149
  }]
3150
- }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }]; } });
3150
+ }], ctorParameters: function () { return [{ type: i0.ViewContainerRef }, { type: i0.ChangeDetectorRef }, { type: i0.Renderer2 }, { type: i0.NgZone }]; } });
3151
3151
 
3152
3152
  const getLayoutOptions = (board) => {
3153
3153
  function getMainAxle(element, parent) {