@syncfusion/ej2-richtexteditor 26.1.41 → 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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 26.1.41
3
+ * version : 26.2.4
4
4
  * Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
@@ -0,0 +1 @@
1
+ hotfix/26.1.35_Vol2
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-richtexteditor@*",
3
- "_id": "@syncfusion/ej2-richtexteditor@26.1.40",
3
+ "_id": "@syncfusion/ej2-richtexteditor@26.1.42",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-10UBCSoQeiA1YL3IT1yK/H7GmbYKJDky7ng9kQAkd/AfE4YjALz6jamP51WU+4C0fEij9oHESoQOX6TEd5g0gg==",
5
+ "_integrity": "sha512-+J5Gcfx+Iy1jkGYJSc91pqv+Gk9ZGDhmyIanP++dUVEI5yXAEUTetX7LTTe0C9PNu51rauOHW57z2NdKnx1dmg==",
6
6
  "_location": "/@syncfusion/ej2-richtexteditor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -25,8 +25,8 @@
25
25
  "/@syncfusion/ej2-react-richtexteditor",
26
26
  "/@syncfusion/ej2-vue-richtexteditor"
27
27
  ],
28
- "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-26.1.40.tgz",
29
- "_shasum": "4619abae890a0acc65b2ccd3d8f1b61c723c6695",
28
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-26.1.42.tgz",
29
+ "_shasum": "b6e37c254d3fa473264c42e80c6b919f5d1ddad5",
30
30
  "_spec": "@syncfusion/ej2-richtexteditor@*",
31
31
  "_where": "/jenkins/workspace/elease-automation_release_26.1.1/packages/included",
32
32
  "author": {
@@ -37,13 +37,13 @@
37
37
  },
38
38
  "bundleDependencies": false,
39
39
  "dependencies": {
40
- "@syncfusion/ej2-base": "~26.1.37",
41
- "@syncfusion/ej2-buttons": "~26.1.40",
42
- "@syncfusion/ej2-filemanager": "~26.1.41",
43
- "@syncfusion/ej2-inputs": "~26.1.41",
44
- "@syncfusion/ej2-navigations": "~26.1.41",
45
- "@syncfusion/ej2-popups": "~26.1.41",
46
- "@syncfusion/ej2-splitbuttons": "~26.1.35"
40
+ "@syncfusion/ej2-base": "~26.2.4",
41
+ "@syncfusion/ej2-buttons": "~26.2.4",
42
+ "@syncfusion/ej2-filemanager": "~26.2.4",
43
+ "@syncfusion/ej2-inputs": "~26.2.4",
44
+ "@syncfusion/ej2-navigations": "~26.2.4",
45
+ "@syncfusion/ej2-popups": "~26.2.4",
46
+ "@syncfusion/ej2-splitbuttons": "~26.2.4"
47
47
  },
48
48
  "deprecated": false,
49
49
  "description": "Essential JS 2 RichTextEditor component",
@@ -79,6 +79,6 @@
79
79
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
80
80
  },
81
81
  "typings": "index.d.ts",
82
- "version": "26.1.41",
82
+ "version": "26.2.4",
83
83
  "sideEffects": false
84
84
  }
@@ -203,6 +203,7 @@ var InsertHtml = /** @class */ (function () {
203
203
  return null;
204
204
  };
205
205
  InsertHtml.pasteInsertHTML = function (nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction) {
206
+ var _this = this;
206
207
  var isCursor = range.startOffset === range.endOffset &&
207
208
  range.startContainer === range.endContainer;
208
209
  if (isCursor && range.startContainer === editNode && editNode.textContent === '') {
@@ -369,6 +370,17 @@ var InsertHtml = /** @class */ (function () {
369
370
  else {
370
371
  this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
371
372
  }
373
+ var spanAligns = editNode.querySelectorAll('span[style*="text-align"]');
374
+ if (spanAligns.length > 0) {
375
+ spanAligns.forEach(function (spanAlign) {
376
+ if (!isNOU(spanAlign)) {
377
+ var blockAlign = _this.getImmediateBlockNode(spanAlign, null);
378
+ if (blockAlign && blockAlign.textContent.trim() === spanAlign.textContent.trim()) {
379
+ blockAlign.style.textAlign = spanAlign.style.textAlign;
380
+ }
381
+ }
382
+ });
383
+ }
372
384
  };
373
385
  InsertHtml.placeCursorEnd = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
374
386
  lastSelectionNode = lastSelectionNode.nodeName === 'BR' ? (isNOU(lastSelectionNode.previousSibling) ? lastSelectionNode.parentNode
@@ -50,13 +50,11 @@ var MarkdownParser = /** @class */ (function () {
50
50
  this.observer.on(EVENTS.KEY_DOWN, this.editorKeyDown, this);
51
51
  this.observer.on(EVENTS.KEY_UP, this.editorKeyUp, this);
52
52
  this.observer.on(EVENTS.MODEL_CHANGED, this.onPropertyChanged, this);
53
- this.observer.on(EVENTS.INTERNAL_DESTROY, this.destroy, this);
54
53
  };
55
54
  MarkdownParser.prototype.unwireEvents = function () {
56
55
  this.observer.off(EVENTS.KEY_DOWN, this.editorKeyDown);
57
56
  this.observer.off(EVENTS.KEY_UP, this.editorKeyUp);
58
57
  this.observer.off(EVENTS.MODEL_CHANGED, this.onPropertyChanged);
59
- this.observer.off(EVENTS.INTERNAL_DESTROY, this.destroy);
60
58
  };
61
59
  MarkdownParser.prototype.onPropertyChanged = function (props) {
62
60
  this.observer.notify(EVENTS.MODEL_CHANGED_PLUGIN, props);
@@ -119,6 +117,7 @@ var MarkdownParser = /** @class */ (function () {
119
117
  }
120
118
  };
121
119
  MarkdownParser.prototype.destroy = function () {
120
+ this.observer.notify(EVENTS.INTERNAL_DESTROY, {});
122
121
  this.unwireEvents();
123
122
  };
124
123
  return MarkdownParser;
@@ -287,7 +287,9 @@ var HtmlEditor = /** @class */ (function () {
287
287
  focusNode = currentChildNode[0];
288
288
  }
289
289
  }
290
- this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), focusNode, pointer);
290
+ if (range.startContainer !== focusNode) {
291
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), focusNode, pointer);
292
+ }
291
293
  }
292
294
  var currentElem = this.parent.inputElement.querySelector('.currentStartMark');
293
295
  if (!isNOU(currentElem)) {
@@ -611,6 +613,7 @@ var HtmlEditor = /** @class */ (function () {
611
613
  }
612
614
  else if (brNode) {
613
615
  detach(brNode);
616
+ e.args.preventDefault();
614
617
  }
615
618
  if (!isNullOrUndefined(this.deleteRangeElement) && (this.deleteOldRangeElement.tagName !== 'OL' && this.deleteOldRangeElement.tagName !== 'UL')
616
619
  && this.deleteOldRangeElement !== this.deleteRangeElement) {
@@ -34,7 +34,6 @@ export declare class PasteCleanup {
34
34
  private destroy;
35
35
  private removeEventListener;
36
36
  private pasteClean;
37
- private fireFoxImageUpload;
38
37
  private splitBreakLine;
39
38
  private makeSpace;
40
39
  private imgUploading;
@@ -5,7 +5,6 @@ import { isNullOrUndefined as isNOU, isNullOrUndefined, detach, extend, addClass
5
5
  import { getUniqueID, Browser, closest } from '@syncfusion/ej2-base';
6
6
  import { CLS_RTE_PASTE_KEEP_FORMAT, CLS_RTE_PASTE_REMOVE_FORMAT, CLS_RTE_PASTE_PLAIN_FORMAT } from '../base/classes';
7
7
  import { CLS_RTE_PASTE_OK, CLS_RTE_PASTE_CANCEL, CLS_RTE_DIALOG_MIN_HEIGHT } from '../base/classes';
8
- import { CLS_RTE_IMAGE, CLS_IMGINLINE, CLS_IMGBREAK } from '../base/classes';
9
8
  import { pasteCleanupGroupingTags } from '../../common/config';
10
9
  import { NodeSelection } from '../../selection/selection';
11
10
  import * as EVENTS from './../../common/constant';
@@ -190,13 +189,6 @@ var PasteCleanup = /** @class */ (function () {
190
189
  e.args.preventDefault();
191
190
  this.pasteDialog(value, args, isClipboardHTMLDataNull);
192
191
  }
193
- else if (Browser.userAgent.indexOf('Firefox') !== -1 && isNOU(file)) {
194
- this.fireFoxImageUpload();
195
- }
196
- }
197
- else if (!isValueNotEmpty && !this.parent.pasteCleanupSettings.plainText &&
198
- Browser.userAgent.indexOf('Firefox') !== -1) {
199
- this.fireFoxImageUpload();
200
192
  }
201
193
  else if (this.parent.pasteCleanupSettings.plainText) {
202
194
  e.args.preventDefault();
@@ -212,33 +204,6 @@ var PasteCleanup = /** @class */ (function () {
212
204
  }
213
205
  }
214
206
  };
215
- PasteCleanup.prototype.fireFoxImageUpload = function () {
216
- var _this = this;
217
- this.fireFoxUploadTime = setTimeout(function () {
218
- if (Browser.userAgent.indexOf('Firefox') !== -1) {
219
- var currentFocusNode = _this.nodeSelectionObj.getRange(_this.contentRenderer.getDocument()).startContainer;
220
- if (currentFocusNode.nodeName !== '#text') {
221
- // eslint-disable-next-line
222
- currentFocusNode = currentFocusNode.childNodes[_this.nodeSelectionObj.getRange(_this.contentRenderer.getDocument()).startOffset];
223
- }
224
- if (currentFocusNode.previousSibling.nodeName === 'IMG') {
225
- if (!isNOU(currentFocusNode.previousSibling.getAttribute('src'))) {
226
- currentFocusNode.previousSibling.classList.add('pasteContent_Img');
227
- }
228
- currentFocusNode.previousSibling.classList.add(CLS_RTE_IMAGE);
229
- if (_this.parent.insertImageSettings.display === 'inline') {
230
- currentFocusNode.previousSibling.classList.add(CLS_IMGINLINE);
231
- }
232
- else {
233
- currentFocusNode.previousSibling.classList.add(CLS_IMGBREAK);
234
- }
235
- currentFocusNode.previousSibling.classList.add();
236
- _this.setImageProperties(currentFocusNode.previousSibling);
237
- }
238
- }
239
- _this.imgUploading(_this.parent.inputElement);
240
- }, 500);
241
- };
242
207
  PasteCleanup.prototype.splitBreakLine = function (value) {
243
208
  var enterSplitText = value.split('\n');
244
209
  var contentInnerElem = '';
@@ -452,11 +417,22 @@ var PasteCleanup = /** @class */ (function () {
452
417
  this.parent.inputElement.contentEditable = 'true';
453
418
  e.element = imgElem;
454
419
  e.detectImageSource = ImageInputSource.Pasted;
455
- this.parent.trigger(events.imageUploadSuccess, e, function (e) {
456
- if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
457
- var url = _this.parent.insertImageSettings.path + e.file.name;
458
- imgElem.src = url;
459
- imgElem.setAttribute('alt', e.file.name);
420
+ uploadObj.filesData.forEach(function (element) {
421
+ if (element.statusCode === '2') {
422
+ _this.parent.trigger(events.imageUploadSuccess, e, function (e) {
423
+ if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
424
+ var url = _this.parent.insertImageSettings.path + e.file.name;
425
+ imgElem.src = url;
426
+ imgElem.setAttribute('alt', e.file.name);
427
+ }
428
+ });
429
+ }
430
+ else if (element.statusCode === '5') {
431
+ _this.parent.trigger(events.imageRemoving, e, function (e) {
432
+ if (!isNullOrUndefined(e.element.src)) {
433
+ e.element.src = '';
434
+ }
435
+ });
460
436
  }
461
437
  });
462
438
  popupObj.close();
@@ -1080,6 +1080,7 @@ export declare class RichTextEditor extends Component<HTMLElement> implements IN
1080
1080
  private originalElement;
1081
1081
  private clickPoints;
1082
1082
  private initialValue;
1083
+ private isSelectAll;
1083
1084
  constructor(options?: RichTextEditorModel, element?: string | HTMLElement);
1084
1085
  /**
1085
1086
  * To provide the array of modules needed for component rendering
@@ -28,7 +28,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
28
28
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
29
29
  return c > 3 && r && Object.defineProperty(target, key, r), r;
30
30
  };
31
- import { Component, EventHandler, Complex, Browser, addClass, detach, remove } from '@syncfusion/ej2-base';
31
+ import { Component, EventHandler, Complex, Browser, addClass, detach } from '@syncfusion/ej2-base';
32
32
  import { Property, NotifyPropertyChanges, formatUnit, L10n, closest } from '@syncfusion/ej2-base';
33
33
  import { setStyleAttribute, Event, removeClass, print as printWindow, attributes } from '@syncfusion/ej2-base';
34
34
  import { isNullOrUndefined as isNOU, compile, append, extend, debounce } from '@syncfusion/ej2-base';
@@ -72,6 +72,7 @@ var RichTextEditor = /** @class */ (function (_super) {
72
72
  function RichTextEditor(options, element) {
73
73
  var _this = _super.call(this, options, element) || this;
74
74
  _this.needsID = true;
75
+ _this.isSelectAll = false;
75
76
  return _this;
76
77
  }
77
78
  /**
@@ -760,7 +761,7 @@ var RichTextEditor = /** @class */ (function (_super) {
760
761
  var preventingMention = false;
761
762
  if (this.editorMode === 'HTML') {
762
763
  var range = this.getRange();
763
- preventingMention = !isNOU(range.startContainer) && range.startContainer === range.endContainer && range.endContainer.childNodes.length > 1 && !isNOU(range.startContainer.childNodes[range.startOffset - 1]) && range.startContainer.childNodes[range.startOffset - 1].nodeName === '#text' && !isNOU(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");
764
+ preventingMention = !isNOU(range.startContainer) && range.startContainer === range.endContainer && range.endContainer.childNodes.length > 1 && !isNOU(range.startContainer.childNodes[range.startOffset - 1]) && range.startContainer.childNodes[range.startOffset - 1].nodeName === '#text' && !isNOU(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");
764
765
  }
765
766
  var keyboardEventAction = ['insert-link', 'format-copy', 'format-paste', 'insert-image', 'insert-table', 'insert-audio', 'insert-video'];
766
767
  if (keyboardEventAction.indexOf(e.action) === -1 &&
@@ -804,6 +805,15 @@ var RichTextEditor = /** @class */ (function (_super) {
804
805
  if (!isNOU(this.placeholder)) {
805
806
  this.setPlaceHolder();
806
807
  }
808
+ if (!isNOU(e) && !isNOU(e.code) && (e.code === 'Backspace' || e.code === 'Delete')) {
809
+ var range = this.contentModule.getDocument().getSelection().getRangeAt(0);
810
+ var div = document.createElement('div');
811
+ div.appendChild(range.cloneContents());
812
+ var selectedHTML = div.innerHTML;
813
+ if (selectedHTML === this.inputElement.innerHTML) {
814
+ this.isSelectAll = true;
815
+ }
816
+ }
807
817
  };
808
818
  RichTextEditor.prototype.keyUp = function (e) {
809
819
  if (this.editorMode === 'HTML') {
@@ -813,6 +823,10 @@ var RichTextEditor = /** @class */ (function (_super) {
813
823
  var currentRange = this.getRange();
814
824
  var selection = this.iframeSettings.enable ? this.contentModule.getPanel().ownerDocument.getSelection() :
815
825
  this.contentModule.getDocument().getSelection();
826
+ if (this.isSelectAll) {
827
+ this.inputElement.innerHTML = this.enterKey !== 'BR' ? '<' + this.enterKey + '><br></' + this.enterKey + '>' : '<br>';
828
+ this.isSelectAll = false;
829
+ }
816
830
  if (selection.rangeCount > 0) {
817
831
  selection.removeAllRanges();
818
832
  selection.addRange(currentRange);
@@ -1108,7 +1122,6 @@ var RichTextEditor = /** @class */ (function (_super) {
1108
1122
  removeClass([this.element], classes.CLS_RTE_HIDDEN);
1109
1123
  }
1110
1124
  else {
1111
- remove(this.inputElement);
1112
1125
  if (this.originalElement.innerHTML.trim() !== '') {
1113
1126
  this.element.innerHTML = this.originalElement.innerHTML.trim();
1114
1127
  this.setProperties({ value: (!isNOU(this.initialValue) ? this.initialValue : null) }, true);
@@ -1132,9 +1145,6 @@ var RichTextEditor = /** @class */ (function (_super) {
1132
1145
  }
1133
1146
  }
1134
1147
  }
1135
- if (this.inputElement) {
1136
- this.inputElement = null;
1137
- }
1138
1148
  if (this.rootContainer) {
1139
1149
  this.rootContainer = null;
1140
1150
  }
@@ -1788,6 +1788,7 @@ var Image = /** @class */ (function () {
1788
1788
  var altText;
1789
1789
  var selectArgs;
1790
1790
  var filesData;
1791
+ var previousURL = null;
1791
1792
  this.uploadObj = new Uploader({
1792
1793
  asyncSettings: { saveUrl: this.parent.insertImageSettings.saveUrl, removeUrl: this.parent.insertImageSettings.removeUrl },
1793
1794
  dropArea: span, multiple: false, enableRtl: this.parent.enableRtl, cssClass: this.parent.getCssClass(),
@@ -1843,6 +1844,10 @@ var Image = /** @class */ (function () {
1843
1844
  _this.parent.trigger(events.imageUploadSuccess, e, function (e) {
1844
1845
  if (!isNOU(_this.parent.insertImageSettings.path)) {
1845
1846
  var url = _this.parent.insertImageSettings.path + e.file.name;
1847
+ // Update the URL of the previously uploaded image
1848
+ if (!isNOU(previousURL) && e.operation === 'upload') {
1849
+ proxy.imageRemovePost(previousURL);
1850
+ }
1846
1851
  // eslint-disable-next-line
1847
1852
  var value = { url: url, selection: save };
1848
1853
  proxy.uploadUrl = {
@@ -1856,6 +1861,7 @@ var Image = /** @class */ (function () {
1856
1861
  }
1857
1862
  };
1858
1863
  proxy.inputUrl.setAttribute('disabled', 'true');
1864
+ previousURL = url;
1859
1865
  }
1860
1866
  if (e.operation === 'upload' && !isNOU(_this.dialogObj)) {
1861
1867
  _this.dialogObj.getButtons(0).element.removeAttribute('disabled');