matcha-components 20.244.0 → 20.247.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.
@@ -14776,7 +14776,12 @@ class MatchaTextEditorComponent {
14776
14776
  });
14777
14777
  }
14778
14778
  ngOnDestroy() {
14779
- this._editor?.destroy();
14779
+ try {
14780
+ this._editor?.destroy();
14781
+ }
14782
+ catch {
14783
+ // DOM may already be detached during Angular route navigation
14784
+ }
14780
14785
  this._editor = null;
14781
14786
  this._editorReady = false;
14782
14787
  }
@@ -14785,7 +14790,7 @@ class MatchaTextEditorComponent {
14785
14790
  const v = value || '';
14786
14791
  this._isSettingValue = true;
14787
14792
  if (this._editor && this._editorReady) {
14788
- this._editor.html.set(v);
14793
+ this._editor.setContents(v);
14789
14794
  }
14790
14795
  else {
14791
14796
  this._pendingValue = v;
@@ -14805,7 +14810,7 @@ class MatchaTextEditorComponent {
14805
14810
  isDisabled ? this._editor.toolbar.disable() : this._editor.toolbar.enable();
14806
14811
  }
14807
14812
  insertHtml(html) {
14808
- this._editor?.html.insert(html);
14813
+ this._editor?.insertHTML(html);
14809
14814
  }
14810
14815
  // Private
14811
14816
  _injectScript(id, url) {
@@ -14860,7 +14865,7 @@ class MatchaTextEditorComponent {
14860
14865
  await this._injectScript('suneditor-lang-ptbr', `${CDN_BASE}/langs/pt-br.js`);
14861
14866
  }
14862
14867
  _reloadEditor() {
14863
- const content = this._editor?.html.get() ?? '';
14868
+ const content = this._editor?.getContents() ?? '';
14864
14869
  this._editor?.destroy();
14865
14870
  this._editor = null;
14866
14871
  this._editorReady = false;
@@ -14889,28 +14894,6 @@ class MatchaTextEditorComponent {
14889
14894
  toolbar_sticky: 0,
14890
14895
  ...buildSunEditorConfig(this._config),
14891
14896
  events: {
14892
- onload: () => {
14893
- // Defer to next tick so this._editor is guaranteed assigned
14894
- // (onload can fire synchronously inside SUNEDITOR.create())
14895
- setTimeout(() => {
14896
- if (!this._editor)
14897
- return;
14898
- this._editorReady = true;
14899
- if (this._pendingValue) {
14900
- this._isSettingValue = true;
14901
- this._editor.html.set(this._pendingValue);
14902
- this._pendingValue = '';
14903
- setTimeout(() => { this._isSettingValue = false; }, 0);
14904
- }
14905
- const el = this._el.nativeElement.querySelector('.sun-editor');
14906
- if (el)
14907
- el.style.display = '';
14908
- this._ngZone.run(() => {
14909
- this.isLoading = false;
14910
- this._cdr.detectChanges();
14911
- });
14912
- }, 0);
14913
- },
14914
14897
  onChange: ({ data }) => {
14915
14898
  if (this._isSettingValue)
14916
14899
  return;
@@ -14928,6 +14911,23 @@ class MatchaTextEditorComponent {
14928
14911
  const sunEditorEl = this._el.nativeElement.querySelector('.sun-editor');
14929
14912
  if (sunEditorEl)
14930
14913
  sunEditorEl.style.display = 'none';
14914
+ setTimeout(() => {
14915
+ if (!this._editor)
14916
+ return;
14917
+ this._editorReady = true;
14918
+ if (this._pendingValue) {
14919
+ this._isSettingValue = true;
14920
+ this._editor.setContents(this._pendingValue);
14921
+ this._pendingValue = '';
14922
+ setTimeout(() => { this._isSettingValue = false; }, 0);
14923
+ }
14924
+ if (sunEditorEl)
14925
+ sunEditorEl.style.display = '';
14926
+ this._ngZone.run(() => {
14927
+ this.isLoading = false;
14928
+ this._cdr.detectChanges();
14929
+ });
14930
+ }, 100);
14931
14931
  }
14932
14932
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.19", ngImport: i0, type: MatchaTextEditorComponent, deps: [{ token: i0.NgZone }, { token: i0.ChangeDetectorRef }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); }
14933
14933
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.19", type: MatchaTextEditorComponent, isStandalone: false, selector: "matcha-text-editor", inputs: { value: "value", config: "config" }, outputs: { contentChange: "contentChange" }, host: { properties: { "attr.disabled": "this.disabledAttr" } }, providers: [