matcha-components 20.250.0 → 20.252.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.
@@ -14790,7 +14790,7 @@ class MatchaTextEditorComponent {
14790
14790
  const v = value || '';
14791
14791
  this._isSettingValue = true;
14792
14792
  if (this._editor && this._editorReady) {
14793
- this._editor.$.html.set(v);
14793
+ this._setEditorHtml(v);
14794
14794
  }
14795
14795
  else {
14796
14796
  this._pendingValue = v;
@@ -14812,6 +14812,18 @@ class MatchaTextEditorComponent {
14812
14812
  insertHtml(html) {
14813
14813
  this._editor?.$.html.insert(html);
14814
14814
  }
14815
+ _setEditorHtml(value) {
14816
+ try {
14817
+ this._editor.$.html.set(value);
14818
+ }
14819
+ catch {
14820
+ // SunEditor's html.clean() crashes on certain figure structures (v3.1.2 bug).
14821
+ // Fall back to directly setting the wysiwyg innerHTML.
14822
+ const wysiwyg = this._editor.$.frameContext?.get('wysiwyg');
14823
+ if (wysiwyg)
14824
+ wysiwyg.innerHTML = value;
14825
+ }
14826
+ }
14815
14827
  // Private
14816
14828
  _injectScript(id, url) {
14817
14829
  return new Promise((resolve) => {
@@ -14917,7 +14929,7 @@ class MatchaTextEditorComponent {
14917
14929
  this._editorReady = true;
14918
14930
  if (this._pendingValue) {
14919
14931
  this._isSettingValue = true;
14920
- this._editor.$.html.set(this._pendingValue);
14932
+ this._setEditorHtml(this._pendingValue);
14921
14933
  this._pendingValue = '';
14922
14934
  setTimeout(() => { this._isSettingValue = false; }, 0);
14923
14935
  }