@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.
@@ -12348,7 +12348,7 @@ var DOMNode = /** @__PURE__ @class */ (function () {
12348
12348
  DOMNode.prototype.unWrap = function (element) {
12349
12349
  var parent = element.parentNode;
12350
12350
  var unWrapNode = [];
12351
- while (element.firstChild) {
12351
+ while (element.firstChild && (element.previousSibling !== this.parent.querySelector('.e-mention-chip') || element.textContent !== ' ')) {
12352
12352
  unWrapNode.push(element.firstChild);
12353
12353
  parent.insertBefore(element.firstChild, element);
12354
12354
  }
@@ -23387,11 +23387,36 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
23387
23387
  this.cropImageHandler(this.parent.inputElement);
23388
23388
  }
23389
23389
  };
23390
+ PasteCleanup.prototype.convertBlobToBase64 = function (element) {
23391
+ var imgElem = element.querySelectorAll('img');
23392
+ var _loop_1 = function (i) {
23393
+ if (imgElem[i].getAttribute('src') &&
23394
+ imgElem[i].getAttribute('src').startsWith("blob")) {
23395
+ var blobImageUrl = imgElem[i].getAttribute('src');
23396
+ var img_1 = new Image();
23397
+ var onImageLoadEvent_1 = function () {
23398
+ var canvas = document.createElement('canvas');
23399
+ var ctx = canvas.getContext('2d');
23400
+ canvas.width = img_1.width;
23401
+ canvas.height = img_1.height;
23402
+ ctx.drawImage(img_1, 0, 0);
23403
+ var base64String = canvas.toDataURL('image/png');
23404
+ imgElem[i].src = base64String;
23405
+ img_1.removeEventListener('load', onImageLoadEvent_1);
23406
+ };
23407
+ img_1.src = blobImageUrl;
23408
+ img_1.addEventListener('load', onImageLoadEvent_1);
23409
+ }
23410
+ };
23411
+ for (var i = 0; i < imgElem.length; i++) {
23412
+ _loop_1(i);
23413
+ }
23414
+ };
23390
23415
  PasteCleanup.prototype.cropImageHandler = function (element) {
23391
23416
  var _this = this;
23392
23417
  var allImgElm = element.querySelectorAll('.e-img-cropped');
23393
23418
  if (allImgElm.length > 0) {
23394
- var _loop_1 = function (i) {
23419
+ var _loop_2 = function (i) {
23395
23420
  if (allImgElm[i].getAttribute('src').split(',')[0].indexOf('base64') >= 0) {
23396
23421
  var image_1 = new Image();
23397
23422
  image_1.src = allImgElm[i].getAttribute('src');
@@ -23425,13 +23450,24 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
23425
23450
  }
23426
23451
  };
23427
23452
  for (var i = 0; i < allImgElm.length; i++) {
23428
- _loop_1(i);
23453
+ _loop_2(i);
23429
23454
  }
23430
23455
  }
23431
23456
  else {
23432
- this.imgUploading(this.parent.inputElement);
23433
- if (this.parent.iframeSettings.enable) {
23434
- this.parent.updateValue();
23457
+ 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")) {
23458
+ this.convertBlobToBase64(this.parent.inputElement);
23459
+ setTimeout(function () {
23460
+ _this.imgUploading(_this.parent.inputElement);
23461
+ if (_this.parent.iframeSettings.enable) {
23462
+ _this.parent.updateValue();
23463
+ }
23464
+ }, 20);
23465
+ }
23466
+ else {
23467
+ this.imgUploading(this.parent.inputElement);
23468
+ if (this.parent.iframeSettings.enable) {
23469
+ this.parent.updateValue();
23470
+ }
23435
23471
  }
23436
23472
  }
23437
23473
  };
@@ -34338,6 +34374,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
34338
34374
  this.persistData();
34339
34375
  setStyleAttribute(this.element, { 'width': formatUnit(this.width) });
34340
34376
  attributes(this.element, { role: 'application', 'aria-label': 'Rich Text Editor' });
34377
+ this.beforeRenderClassValue = this.element.getAttribute('class');
34341
34378
  };
34342
34379
  RichTextEditor.prototype.persistData = function () {
34343
34380
  if (this.enablePersistence && this.originalElement.tagName === 'TEXTAREA') {
@@ -35210,6 +35247,10 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
35210
35247
  if (this.isDestroyed || !this.isRendered) {
35211
35248
  return;
35212
35249
  }
35250
+ this.element.className = this.beforeRenderClassValue;
35251
+ this.removeHtmlAttributes();
35252
+ this.removeAttributes();
35253
+ this.beforeRenderClassValue = null;
35213
35254
  if (!isNullOrUndefined(this.timeInterval)) {
35214
35255
  clearInterval(this.timeInterval);
35215
35256
  this.timeInterval = null;
@@ -35277,8 +35318,6 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
35277
35318
  }
35278
35319
  }
35279
35320
  }
35280
- this.removeHtmlAttributes();
35281
- this.removeAttributes();
35282
35321
  _super.prototype.destroy.call(this);
35283
35322
  this.isRendered = false;
35284
35323
  };
@@ -35309,6 +35348,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
35309
35348
  this.element.removeAttribute('aria-disabled');
35310
35349
  this.element.removeAttribute('role');
35311
35350
  this.element.removeAttribute('tabindex');
35351
+ this.element.removeAttribute('aria-label');
35312
35352
  };
35313
35353
  RichTextEditor.prototype.destroyDependentModules = function () {
35314
35354
  /* destroy dependent modules */