@syncfusion/ej2-richtexteditor 26.1.42 → 26.2.5

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.
@@ -8475,6 +8475,7 @@ class Image$1 {
8475
8475
  let altText;
8476
8476
  let selectArgs;
8477
8477
  let filesData;
8478
+ let previousURL = null;
8478
8479
  this.uploadObj = new Uploader({
8479
8480
  asyncSettings: { saveUrl: this.parent.insertImageSettings.saveUrl, removeUrl: this.parent.insertImageSettings.removeUrl },
8480
8481
  dropArea: span, multiple: false, enableRtl: this.parent.enableRtl, cssClass: this.parent.getCssClass(),
@@ -8530,6 +8531,10 @@ class Image$1 {
8530
8531
  this.parent.trigger(imageUploadSuccess, e, (e) => {
8531
8532
  if (!isNullOrUndefined(this.parent.insertImageSettings.path)) {
8532
8533
  const url = this.parent.insertImageSettings.path + e.file.name;
8534
+ // Update the URL of the previously uploaded image
8535
+ if (!isNullOrUndefined(previousURL) && e.operation === 'upload') {
8536
+ proxy.imageRemovePost(previousURL);
8537
+ }
8533
8538
  proxy.uploadUrl = {
8534
8539
  url: url, selection: save, altText: altText, selectParent: selectParent,
8535
8540
  width: {
@@ -8541,6 +8546,7 @@ class Image$1 {
8541
8546
  }
8542
8547
  };
8543
8548
  proxy.inputUrl.setAttribute('disabled', 'true');
8549
+ previousURL = url;
8544
8550
  }
8545
8551
  if (e.operation === 'upload' && !isNullOrUndefined(this.dialogObj)) {
8546
8552
  this.dialogObj.getButtons(0).element.removeAttribute('disabled');
@@ -23761,6 +23767,17 @@ class InsertHtml {
23761
23767
  else {
23762
23768
  this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
23763
23769
  }
23770
+ const spanAligns = editNode.querySelectorAll('span[style*="text-align"]');
23771
+ if (spanAligns.length > 0) {
23772
+ spanAligns.forEach((spanAlign) => {
23773
+ if (!isNullOrUndefined(spanAlign)) {
23774
+ const blockAlign = this.getImmediateBlockNode(spanAlign, null);
23775
+ if (blockAlign && blockAlign.textContent.trim() === spanAlign.textContent.trim()) {
23776
+ blockAlign.style.textAlign = spanAlign.style.textAlign;
23777
+ }
23778
+ }
23779
+ });
23780
+ }
23764
23781
  }
23765
23782
  static placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode) {
23766
23783
  lastSelectionNode = lastSelectionNode.nodeName === 'BR' ? (isNullOrUndefined(lastSelectionNode.previousSibling) ? lastSelectionNode.parentNode
@@ -31806,13 +31823,6 @@ class PasteCleanup {
31806
31823
  e.args.preventDefault();
31807
31824
  this.pasteDialog(value, args, isClipboardHTMLDataNull);
31808
31825
  }
31809
- else if (Browser.userAgent.indexOf('Firefox') !== -1 && isNullOrUndefined(file)) {
31810
- this.fireFoxImageUpload();
31811
- }
31812
- }
31813
- else if (!isValueNotEmpty && !this.parent.pasteCleanupSettings.plainText &&
31814
- Browser.userAgent.indexOf('Firefox') !== -1) {
31815
- this.fireFoxImageUpload();
31816
31826
  }
31817
31827
  else if (this.parent.pasteCleanupSettings.plainText) {
31818
31828
  e.args.preventDefault();
@@ -31828,32 +31838,6 @@ class PasteCleanup {
31828
31838
  }
31829
31839
  }
31830
31840
  }
31831
- fireFoxImageUpload() {
31832
- this.fireFoxUploadTime = setTimeout(() => {
31833
- if (Browser.userAgent.indexOf('Firefox') !== -1) {
31834
- let currentFocusNode = this.nodeSelectionObj.getRange(this.contentRenderer.getDocument()).startContainer;
31835
- if (currentFocusNode.nodeName !== '#text') {
31836
- // eslint-disable-next-line
31837
- currentFocusNode = currentFocusNode.childNodes[this.nodeSelectionObj.getRange(this.contentRenderer.getDocument()).startOffset];
31838
- }
31839
- if (currentFocusNode.previousSibling.nodeName === 'IMG') {
31840
- if (!isNullOrUndefined(currentFocusNode.previousSibling.getAttribute('src'))) {
31841
- currentFocusNode.previousSibling.classList.add('pasteContent_Img');
31842
- }
31843
- currentFocusNode.previousSibling.classList.add(CLS_RTE_IMAGE);
31844
- if (this.parent.insertImageSettings.display === 'inline') {
31845
- currentFocusNode.previousSibling.classList.add(CLS_IMGINLINE);
31846
- }
31847
- else {
31848
- currentFocusNode.previousSibling.classList.add(CLS_IMGBREAK);
31849
- }
31850
- currentFocusNode.previousSibling.classList.add();
31851
- this.setImageProperties(currentFocusNode.previousSibling);
31852
- }
31853
- }
31854
- this.imgUploading(this.parent.inputElement);
31855
- }, 500);
31856
- }
31857
31841
  splitBreakLine(value) {
31858
31842
  const enterSplitText = value.split('\n');
31859
31843
  let contentInnerElem = '';
@@ -32065,11 +32049,22 @@ class PasteCleanup {
32065
32049
  this.parent.inputElement.contentEditable = 'true';
32066
32050
  e.element = imgElem;
32067
32051
  e.detectImageSource = ImageInputSource.Pasted;
32068
- this.parent.trigger(imageUploadSuccess, e, (e) => {
32069
- if (!isNullOrUndefined(this.parent.insertImageSettings.path)) {
32070
- const url = this.parent.insertImageSettings.path + e.file.name;
32071
- imgElem.src = url;
32072
- imgElem.setAttribute('alt', e.file.name);
32052
+ uploadObj.filesData.forEach((element) => {
32053
+ if (element.statusCode === '2') {
32054
+ this.parent.trigger(imageUploadSuccess, e, (e) => {
32055
+ if (!isNullOrUndefined(this.parent.insertImageSettings.path)) {
32056
+ const url = this.parent.insertImageSettings.path + e.file.name;
32057
+ imgElem.src = url;
32058
+ imgElem.setAttribute('alt', e.file.name);
32059
+ }
32060
+ });
32061
+ }
32062
+ else if (element.statusCode === '5') {
32063
+ this.parent.trigger(imageRemoving, e, (e) => {
32064
+ if (!isNullOrUndefined(e.element.src)) {
32065
+ e.element.src = '';
32066
+ }
32067
+ });
32073
32068
  }
32074
32069
  });
32075
32070
  popupObj.close();
@@ -36543,7 +36538,7 @@ let RichTextEditor = class RichTextEditor extends Component {
36543
36538
  let preventingMention = false;
36544
36539
  if (this.editorMode === 'HTML') {
36545
36540
  const range = this.getRange();
36546
- 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");
36541
+ 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");
36547
36542
  }
36548
36543
  const keyboardEventAction = ['insert-link', 'format-copy', 'format-paste', 'insert-image', 'insert-table', 'insert-audio', 'insert-video'];
36549
36544
  if (keyboardEventAction.indexOf(e.action) === -1 &&