@syncfusion/ej2-richtexteditor 25.2.3 → 25.2.4

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.
@@ -12250,7 +12250,7 @@ class DOMNode {
12250
12250
  unWrap(element) {
12251
12251
  const parent = element.parentNode;
12252
12252
  let unWrapNode = [];
12253
- while (element.firstChild) {
12253
+ while (element.firstChild && (element.previousSibling !== this.parent.querySelector('.e-mention-chip') || element.textContent !== ' ')) {
12254
12254
  unWrapNode.push(element.firstChild);
12255
12255
  parent.insertBefore(element.firstChild, element);
12256
12256
  }
@@ -23309,6 +23309,28 @@ class PasteCleanup {
23309
23309
  this.cropImageHandler(this.parent.inputElement);
23310
23310
  }
23311
23311
  }
23312
+ convertBlobToBase64(element) {
23313
+ const imgElem = element.querySelectorAll('img');
23314
+ for (let i = 0; i < imgElem.length; i++) {
23315
+ if (imgElem[i].getAttribute('src') &&
23316
+ imgElem[i].getAttribute('src').startsWith("blob")) {
23317
+ let blobImageUrl = imgElem[i].getAttribute('src');
23318
+ let img = new Image();
23319
+ const onImageLoadEvent = () => {
23320
+ let canvas = document.createElement('canvas');
23321
+ let ctx = canvas.getContext('2d');
23322
+ canvas.width = img.width;
23323
+ canvas.height = img.height;
23324
+ ctx.drawImage(img, 0, 0);
23325
+ let base64String = canvas.toDataURL('image/png');
23326
+ imgElem[i].src = base64String;
23327
+ img.removeEventListener('load', onImageLoadEvent);
23328
+ };
23329
+ img.src = blobImageUrl;
23330
+ img.addEventListener('load', onImageLoadEvent);
23331
+ }
23332
+ }
23333
+ }
23312
23334
  cropImageHandler(element) {
23313
23335
  const allImgElm = element.querySelectorAll('.e-img-cropped');
23314
23336
  if (allImgElm.length > 0) {
@@ -23347,9 +23369,20 @@ class PasteCleanup {
23347
23369
  }
23348
23370
  }
23349
23371
  else {
23350
- this.imgUploading(this.parent.inputElement);
23351
- if (this.parent.iframeSettings.enable) {
23352
- this.parent.updateValue();
23372
+ if (!isNullOrUndefined(this.parent.insertImageSettings.saveUrl) && !isNullOrUndefined(this.parent.insertImageSettings.path) && !isNullOrUndefined(this.parent.inputElement.querySelectorAll("img")) && this.parent.inputElement.querySelectorAll("img")[0].src.startsWith("blob")) {
23373
+ this.convertBlobToBase64(this.parent.inputElement);
23374
+ setTimeout(() => {
23375
+ this.imgUploading(this.parent.inputElement);
23376
+ if (this.parent.iframeSettings.enable) {
23377
+ this.parent.updateValue();
23378
+ }
23379
+ }, 20);
23380
+ }
23381
+ else {
23382
+ this.imgUploading(this.parent.inputElement);
23383
+ if (this.parent.iframeSettings.enable) {
23384
+ this.parent.updateValue();
23385
+ }
23353
23386
  }
23354
23387
  }
23355
23388
  }
@@ -34026,6 +34059,7 @@ let RichTextEditor = class RichTextEditor extends Component {
34026
34059
  this.persistData();
34027
34060
  setStyleAttribute(this.element, { 'width': formatUnit(this.width) });
34028
34061
  attributes(this.element, { role: 'application', 'aria-label': 'Rich Text Editor' });
34062
+ this.beforeRenderClassValue = this.element.getAttribute('class');
34029
34063
  }
34030
34064
  persistData() {
34031
34065
  if (this.enablePersistence && this.originalElement.tagName === 'TEXTAREA') {
@@ -34896,6 +34930,10 @@ let RichTextEditor = class RichTextEditor extends Component {
34896
34930
  if (this.isDestroyed || !this.isRendered) {
34897
34931
  return;
34898
34932
  }
34933
+ this.element.className = this.beforeRenderClassValue;
34934
+ this.removeHtmlAttributes();
34935
+ this.removeAttributes();
34936
+ this.beforeRenderClassValue = null;
34899
34937
  if (!isNullOrUndefined(this.timeInterval)) {
34900
34938
  clearInterval(this.timeInterval);
34901
34939
  this.timeInterval = null;
@@ -34963,8 +35001,6 @@ let RichTextEditor = class RichTextEditor extends Component {
34963
35001
  }
34964
35002
  }
34965
35003
  }
34966
- this.removeHtmlAttributes();
34967
- this.removeAttributes();
34968
35004
  super.destroy();
34969
35005
  this.isRendered = false;
34970
35006
  }
@@ -34995,6 +35031,7 @@ let RichTextEditor = class RichTextEditor extends Component {
34995
35031
  this.element.removeAttribute('aria-disabled');
34996
35032
  this.element.removeAttribute('role');
34997
35033
  this.element.removeAttribute('tabindex');
35034
+ this.element.removeAttribute('aria-label');
34998
35035
  }
34999
35036
  destroyDependentModules() {
35000
35037
  /* destroy dependent modules */