matcha-components 20.243.0 → 20.244.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;
|
|
@@ -14777,12 +14778,13 @@ class MatchaTextEditorComponent {
|
|
|
14777
14778
|
ngOnDestroy() {
|
|
14778
14779
|
this._editor?.destroy();
|
|
14779
14780
|
this._editor = null;
|
|
14781
|
+
this._editorReady = false;
|
|
14780
14782
|
}
|
|
14781
14783
|
// ControlValueAccessor
|
|
14782
14784
|
writeValue(value) {
|
|
14783
14785
|
const v = value || '';
|
|
14784
14786
|
this._isSettingValue = true;
|
|
14785
|
-
if (this._editor) {
|
|
14787
|
+
if (this._editor && this._editorReady) {
|
|
14786
14788
|
this._editor.html.set(v);
|
|
14787
14789
|
}
|
|
14788
14790
|
else {
|
|
@@ -14861,6 +14863,7 @@ class MatchaTextEditorComponent {
|
|
|
14861
14863
|
const content = this._editor?.html.get() ?? '';
|
|
14862
14864
|
this._editor?.destroy();
|
|
14863
14865
|
this._editor = null;
|
|
14866
|
+
this._editorReady = false;
|
|
14864
14867
|
this._pendingValue = content;
|
|
14865
14868
|
this.isLoading = true;
|
|
14866
14869
|
this._cdr.detectChanges();
|
|
@@ -14886,6 +14889,28 @@ class MatchaTextEditorComponent {
|
|
|
14886
14889
|
toolbar_sticky: 0,
|
|
14887
14890
|
...buildSunEditorConfig(this._config),
|
|
14888
14891
|
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
|
+
},
|
|
14889
14914
|
onChange: ({ data }) => {
|
|
14890
14915
|
if (this._isSettingValue)
|
|
14891
14916
|
return;
|
|
@@ -14903,20 +14928,6 @@ class MatchaTextEditorComponent {
|
|
|
14903
14928
|
const sunEditorEl = this._el.nativeElement.querySelector('.sun-editor');
|
|
14904
14929
|
if (sunEditorEl)
|
|
14905
14930
|
sunEditorEl.style.display = 'none';
|
|
14906
|
-
setTimeout(() => {
|
|
14907
|
-
if (sunEditorEl)
|
|
14908
|
-
sunEditorEl.style.display = '';
|
|
14909
|
-
if (this._pendingValue) {
|
|
14910
|
-
this._isSettingValue = true;
|
|
14911
|
-
this._editor.html.set(this._pendingValue);
|
|
14912
|
-
this._pendingValue = '';
|
|
14913
|
-
setTimeout(() => { this._isSettingValue = false; }, 0);
|
|
14914
|
-
}
|
|
14915
|
-
this._ngZone.run(() => {
|
|
14916
|
-
this.isLoading = false;
|
|
14917
|
-
this._cdr.detectChanges();
|
|
14918
|
-
});
|
|
14919
|
-
}, 100);
|
|
14920
14931
|
}
|
|
14921
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 }); }
|
|
14922
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: [
|