matcha-components 20.243.0 → 20.245.0

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.
@@ -14757,6 +14757,7 @@ class MatchaTextEditorComponent {
14757
14757
  this._config = {};
14758
14758
  this.contentChange = new EventEmitter();
14759
14759
  this._editor = null;
14760
+ this._editorReady = false;
14760
14761
  this._pendingValue = '';
14761
14762
  this._isSettingValue = false;
14762
14763
  this._disabled = false;
@@ -14775,14 +14776,20 @@ class MatchaTextEditorComponent {
14775
14776
  });
14776
14777
  }
14777
14778
  ngOnDestroy() {
14778
- this._editor?.destroy();
14779
+ try {
14780
+ this._editor?.destroy();
14781
+ }
14782
+ catch {
14783
+ // DOM may already be detached during Angular route navigation
14784
+ }
14779
14785
  this._editor = null;
14786
+ this._editorReady = false;
14780
14787
  }
14781
14788
  // ControlValueAccessor
14782
14789
  writeValue(value) {
14783
14790
  const v = value || '';
14784
14791
  this._isSettingValue = true;
14785
- if (this._editor) {
14792
+ if (this._editor && this._editorReady) {
14786
14793
  this._editor.html.set(v);
14787
14794
  }
14788
14795
  else {
@@ -14861,6 +14868,7 @@ class MatchaTextEditorComponent {
14861
14868
  const content = this._editor?.html.get() ?? '';
14862
14869
  this._editor?.destroy();
14863
14870
  this._editor = null;
14871
+ this._editorReady = false;
14864
14872
  this._pendingValue = content;
14865
14873
  this.isLoading = true;
14866
14874
  this._cdr.detectChanges();
@@ -14904,14 +14912,17 @@ class MatchaTextEditorComponent {
14904
14912
  if (sunEditorEl)
14905
14913
  sunEditorEl.style.display = 'none';
14906
14914
  setTimeout(() => {
14907
- if (sunEditorEl)
14908
- sunEditorEl.style.display = '';
14915
+ if (!this._editor)
14916
+ return;
14917
+ this._editorReady = true;
14909
14918
  if (this._pendingValue) {
14910
14919
  this._isSettingValue = true;
14911
14920
  this._editor.html.set(this._pendingValue);
14912
14921
  this._pendingValue = '';
14913
14922
  setTimeout(() => { this._isSettingValue = false; }, 0);
14914
14923
  }
14924
+ if (sunEditorEl)
14925
+ sunEditorEl.style.display = '';
14915
14926
  this._ngZone.run(() => {
14916
14927
  this.isLoading = false;
14917
14928
  this._cdr.detectChanges();