matcha-components 20.236.0 → 20.237.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.
@@ -14746,7 +14746,7 @@ class MatchaTextEditorComponent {
14746
14746
  const v = value || '';
14747
14747
  this._isSettingValue = true;
14748
14748
  if (this._editor) {
14749
- this._editor.setContent(v);
14749
+ this._editor.$.html.set(v);
14750
14750
  }
14751
14751
  else {
14752
14752
  this._pendingValue = v;
@@ -14762,7 +14762,15 @@ class MatchaTextEditorComponent {
14762
14762
  setDisabledState(isDisabled) {
14763
14763
  this._disabled = isDisabled;
14764
14764
  if (this._editor) {
14765
- isDisabled ? this._editor.disable() : this._editor.enable();
14765
+ const wysiwyg = this._editor.$.frameContext.get('wysiwyg');
14766
+ if (isDisabled) {
14767
+ this._editor.$.toolbar.disable();
14768
+ wysiwyg?.setAttribute('contenteditable', 'false');
14769
+ }
14770
+ else {
14771
+ this._editor.$.toolbar.enable();
14772
+ wysiwyg?.setAttribute('contenteditable', 'true');
14773
+ }
14766
14774
  }
14767
14775
  }
14768
14776
  // Private
@@ -14808,7 +14816,7 @@ class MatchaTextEditorComponent {
14808
14816
  }
14809
14817
  _reloadEditor() {
14810
14818
  this._el.nativeElement.querySelectorAll('.sun-editor').forEach((el) => el.remove());
14811
- const content = this._editor?.getValue() ?? '';
14819
+ const content = this._editor?.$.html.get() ?? '';
14812
14820
  this._editor = null;
14813
14821
  this._pendingValue = content;
14814
14822
  this.isLoading = true;
@@ -14836,29 +14844,33 @@ class MatchaTextEditorComponent {
14836
14844
  imageWidth: mergedConfig.imageSize,
14837
14845
  videoWidth: mergedConfig.videoX,
14838
14846
  videoHeight: mergedConfig.videoY,
14847
+ events: {
14848
+ onChange: ({ data }) => {
14849
+ if (this._isSettingValue)
14850
+ return;
14851
+ this._ngZone.run(() => {
14852
+ this._onChange(data);
14853
+ this.contentChange.emit(data);
14854
+ });
14855
+ },
14856
+ onBlur: () => {
14857
+ this._ngZone.run(() => this._onTouched());
14858
+ },
14859
+ },
14839
14860
  });
14840
14861
  if (this._disabled) {
14841
- this._editor.disable();
14862
+ const wysiwyg = this._editor.$.frameContext.get('wysiwyg');
14863
+ this._editor.$.toolbar.disable();
14864
+ wysiwyg?.setAttribute('contenteditable', 'false');
14842
14865
  }
14843
14866
  // Hide immediately so the skeleton doesn't overlap the editor during initialization
14844
14867
  const sunEditorEl = this._el.nativeElement.querySelector('.sun-editor');
14845
14868
  if (sunEditorEl)
14846
14869
  sunEditorEl.style.display = 'none';
14847
- this._editor.on('onChange', (content) => {
14848
- if (this._isSettingValue)
14849
- return;
14850
- this._ngZone.run(() => {
14851
- this._onChange(content);
14852
- this.contentChange.emit(content);
14853
- });
14854
- });
14855
- this._editor.on('onBlur', () => {
14856
- this._ngZone.run(() => this._onTouched());
14857
- });
14858
14870
  setTimeout(() => {
14859
14871
  if (this._pendingValue) {
14860
14872
  this._isSettingValue = true;
14861
- this._editor.setContent(this._pendingValue);
14873
+ this._editor.$.html.set(this._pendingValue);
14862
14874
  this._pendingValue = '';
14863
14875
  setTimeout(() => { this._isSettingValue = false; }, 0);
14864
14876
  }