@syncfusion/ej2-richtexteditor 26.1.42 → 26.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.
@@ -8499,6 +8499,7 @@ var Image$1 = /** @__PURE__ @class */ (function () {
8499
8499
  var altText;
8500
8500
  var selectArgs;
8501
8501
  var filesData;
8502
+ var previousURL = null;
8502
8503
  this.uploadObj = new Uploader({
8503
8504
  asyncSettings: { saveUrl: this.parent.insertImageSettings.saveUrl, removeUrl: this.parent.insertImageSettings.removeUrl },
8504
8505
  dropArea: span, multiple: false, enableRtl: this.parent.enableRtl, cssClass: this.parent.getCssClass(),
@@ -8554,6 +8555,10 @@ var Image$1 = /** @__PURE__ @class */ (function () {
8554
8555
  _this.parent.trigger(imageUploadSuccess, e, function (e) {
8555
8556
  if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
8556
8557
  var url = _this.parent.insertImageSettings.path + e.file.name;
8558
+ // Update the URL of the previously uploaded image
8559
+ if (!isNullOrUndefined(previousURL) && e.operation === 'upload') {
8560
+ proxy.imageRemovePost(previousURL);
8561
+ }
8557
8562
  proxy.uploadUrl = {
8558
8563
  url: url, selection: save, altText: altText, selectParent: selectParent,
8559
8564
  width: {
@@ -8565,6 +8570,7 @@ var Image$1 = /** @__PURE__ @class */ (function () {
8565
8570
  }
8566
8571
  };
8567
8572
  proxy.inputUrl.setAttribute('disabled', 'true');
8573
+ previousURL = url;
8568
8574
  }
8569
8575
  if (e.operation === 'upload' && !isNullOrUndefined(_this.dialogObj)) {
8570
8576
  _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
@@ -23651,6 +23657,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
23651
23657
  return null;
23652
23658
  };
23653
23659
  InsertHtml.pasteInsertHTML = function (nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction) {
23660
+ var _this = this;
23654
23661
  var isCursor = range.startOffset === range.endOffset &&
23655
23662
  range.startContainer === range.endContainer;
23656
23663
  if (isCursor && range.startContainer === editNode && editNode.textContent === '') {
@@ -23817,6 +23824,17 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
23817
23824
  else {
23818
23825
  this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
23819
23826
  }
23827
+ var spanAligns = editNode.querySelectorAll('span[style*="text-align"]');
23828
+ if (spanAligns.length > 0) {
23829
+ spanAligns.forEach(function (spanAlign) {
23830
+ if (!isNullOrUndefined(spanAlign)) {
23831
+ var blockAlign = _this.getImmediateBlockNode(spanAlign, null);
23832
+ if (blockAlign && blockAlign.textContent.trim() === spanAlign.textContent.trim()) {
23833
+ blockAlign.style.textAlign = spanAlign.style.textAlign;
23834
+ }
23835
+ }
23836
+ });
23837
+ }
23820
23838
  };
23821
23839
  InsertHtml.placeCursorEnd = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
23822
23840
  lastSelectionNode = lastSelectionNode.nodeName === 'BR' ? (isNullOrUndefined(lastSelectionNode.previousSibling) ? lastSelectionNode.parentNode
@@ -31920,13 +31938,6 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
31920
31938
  e.args.preventDefault();
31921
31939
  this.pasteDialog(value, args, isClipboardHTMLDataNull);
31922
31940
  }
31923
- else if (Browser.userAgent.indexOf('Firefox') !== -1 && isNullOrUndefined(file)) {
31924
- this.fireFoxImageUpload();
31925
- }
31926
- }
31927
- else if (!isValueNotEmpty && !this.parent.pasteCleanupSettings.plainText &&
31928
- Browser.userAgent.indexOf('Firefox') !== -1) {
31929
- this.fireFoxImageUpload();
31930
31941
  }
31931
31942
  else if (this.parent.pasteCleanupSettings.plainText) {
31932
31943
  e.args.preventDefault();
@@ -31942,33 +31953,6 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
31942
31953
  }
31943
31954
  }
31944
31955
  };
31945
- PasteCleanup.prototype.fireFoxImageUpload = function () {
31946
- var _this = this;
31947
- this.fireFoxUploadTime = setTimeout(function () {
31948
- if (Browser.userAgent.indexOf('Firefox') !== -1) {
31949
- var currentFocusNode = _this.nodeSelectionObj.getRange(_this.contentRenderer.getDocument()).startContainer;
31950
- if (currentFocusNode.nodeName !== '#text') {
31951
- // eslint-disable-next-line
31952
- currentFocusNode = currentFocusNode.childNodes[_this.nodeSelectionObj.getRange(_this.contentRenderer.getDocument()).startOffset];
31953
- }
31954
- if (currentFocusNode.previousSibling.nodeName === 'IMG') {
31955
- if (!isNullOrUndefined(currentFocusNode.previousSibling.getAttribute('src'))) {
31956
- currentFocusNode.previousSibling.classList.add('pasteContent_Img');
31957
- }
31958
- currentFocusNode.previousSibling.classList.add(CLS_RTE_IMAGE);
31959
- if (_this.parent.insertImageSettings.display === 'inline') {
31960
- currentFocusNode.previousSibling.classList.add(CLS_IMGINLINE);
31961
- }
31962
- else {
31963
- currentFocusNode.previousSibling.classList.add(CLS_IMGBREAK);
31964
- }
31965
- currentFocusNode.previousSibling.classList.add();
31966
- _this.setImageProperties(currentFocusNode.previousSibling);
31967
- }
31968
- }
31969
- _this.imgUploading(_this.parent.inputElement);
31970
- }, 500);
31971
- };
31972
31956
  PasteCleanup.prototype.splitBreakLine = function (value) {
31973
31957
  var enterSplitText = value.split('\n');
31974
31958
  var contentInnerElem = '';
@@ -32182,11 +32166,22 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
32182
32166
  this.parent.inputElement.contentEditable = 'true';
32183
32167
  e.element = imgElem;
32184
32168
  e.detectImageSource = ImageInputSource.Pasted;
32185
- this.parent.trigger(imageUploadSuccess, e, function (e) {
32186
- if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
32187
- var url = _this.parent.insertImageSettings.path + e.file.name;
32188
- imgElem.src = url;
32189
- imgElem.setAttribute('alt', e.file.name);
32169
+ uploadObj.filesData.forEach(function (element) {
32170
+ if (element.statusCode === '2') {
32171
+ _this.parent.trigger(imageUploadSuccess, e, function (e) {
32172
+ if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
32173
+ var url = _this.parent.insertImageSettings.path + e.file.name;
32174
+ imgElem.src = url;
32175
+ imgElem.setAttribute('alt', e.file.name);
32176
+ }
32177
+ });
32178
+ }
32179
+ else if (element.statusCode === '5') {
32180
+ _this.parent.trigger(imageRemoving, e, function (e) {
32181
+ if (!isNullOrUndefined(e.element.src)) {
32182
+ e.element.src = '';
32183
+ }
32184
+ });
32190
32185
  }
32191
32186
  });
32192
32187
  popupObj.close();
@@ -36854,7 +36849,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
36854
36849
  var preventingMention = false;
36855
36850
  if (this.editorMode === 'HTML') {
36856
36851
  var range = this.getRange();
36857
- preventingMention = !isNullOrUndefined(range.startContainer) && range.startContainer === range.endContainer && range.endContainer.childNodes.length > 1 && !isNullOrUndefined(range.startContainer.childNodes[range.startOffset - 1]) && range.startContainer.childNodes[range.startOffset - 1].nodeName === '#text' && !isNullOrUndefined(range.startContainer.childNodes[range.startOffset - 1].previousSibling) && range.startContainer.childNodes[range.startOffset - 1].textContent.charCodeAt(0) === 32 && range.startContainer.childNodes[1].previousSibling.classList.contains("e-mention-chip");
36852
+ preventingMention = !isNullOrUndefined(range.startContainer) && range.startContainer === range.endContainer && range.endContainer.childNodes.length > 1 && !isNullOrUndefined(range.startContainer.childNodes[range.startOffset - 1]) && range.startContainer.childNodes[range.startOffset - 1].nodeName === '#text' && !isNullOrUndefined(range.startContainer.childNodes[range.startOffset - 1].previousSibling) && range.startContainer.childNodes[range.startOffset - 1].textContent.charCodeAt(0) === 32 && range.startContainer.childNodes[range.startOffset - 1].previousSibling.classList.contains("e-mention-chip");
36858
36853
  }
36859
36854
  var keyboardEventAction = ['insert-link', 'format-copy', 'format-paste', 'insert-image', 'insert-table', 'insert-audio', 'insert-video'];
36860
36855
  if (keyboardEventAction.indexOf(e.action) === -1 &&