@syncfusion/ej2-richtexteditor 23.1.41 → 23.1.43

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 : 23.1.41
3
+ * version : 23.1.43
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
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-richtexteditor@*",
3
- "_id": "@syncfusion/ej2-richtexteditor@23.1.40",
3
+ "_id": "@syncfusion/ej2-richtexteditor@23.1.41",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-/ZUQYuQqnKEUFRxihm0PFXec5aVT6cccy74I7/wdhkxvGfPzCpCYw6zD/RycIvtW7gzXqqmbshuW99aJqqmVMg==",
5
+ "_integrity": "sha512-CIPlpeV1ZJSthFtQHaNVAdANuI0M5aDYUT/Ar7obSF9TC4jwgwVIY0UdZ6KZC/dXzsAqRq1q7+QE8F5OzjvG7A==",
6
6
  "_location": "/@syncfusion/ej2-richtexteditor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -26,8 +26,8 @@
26
26
  "/@syncfusion/ej2-react-richtexteditor",
27
27
  "/@syncfusion/ej2-vue-richtexteditor"
28
28
  ],
29
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-23.1.40.tgz",
30
- "_shasum": "f71428956e7033350edecc5a22e64e2fa0fa5527",
29
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-23.1.41.tgz",
30
+ "_shasum": "a9c6e53775552699f2528d6f4cf619a806d4660e",
31
31
  "_spec": "@syncfusion/ej2-richtexteditor@*",
32
32
  "_where": "/jenkins/workspace/elease-automation_release_23.1.1/packages/included",
33
33
  "author": {
@@ -39,12 +39,12 @@
39
39
  "bundleDependencies": false,
40
40
  "dependencies": {
41
41
  "@syncfusion/ej2-base": "~23.1.41",
42
- "@syncfusion/ej2-buttons": "~23.1.41",
43
- "@syncfusion/ej2-filemanager": "~23.1.40",
44
- "@syncfusion/ej2-inputs": "~23.1.40",
45
- "@syncfusion/ej2-navigations": "~23.1.41",
46
- "@syncfusion/ej2-popups": "~23.1.38",
47
- "@syncfusion/ej2-splitbuttons": "~23.1.41"
42
+ "@syncfusion/ej2-buttons": "~23.1.43",
43
+ "@syncfusion/ej2-filemanager": "~23.1.43",
44
+ "@syncfusion/ej2-inputs": "~23.1.43",
45
+ "@syncfusion/ej2-navigations": "~23.1.43",
46
+ "@syncfusion/ej2-popups": "~23.1.43",
47
+ "@syncfusion/ej2-splitbuttons": "~23.1.43"
48
48
  },
49
49
  "deprecated": false,
50
50
  "description": "Essential JS 2 RichTextEditor component",
@@ -70,6 +70,6 @@
70
70
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
71
71
  },
72
72
  "typings": "index.d.ts",
73
- "version": "23.1.41",
73
+ "version": "23.1.43",
74
74
  "sideEffects": false
75
75
  }
@@ -10,7 +10,7 @@ var EmojiPickerAction = /** @class */ (function () {
10
10
  };
11
11
  EmojiPickerAction.prototype.emojiInsert = function (args) {
12
12
  var node = document.createTextNode(args.value);
13
- var selection = window.getSelection();
13
+ var selection = this.parent.currentDocument.getSelection();
14
14
  var range = selection.getRangeAt(0);
15
15
  var cursorPos = range.startOffset;
16
16
  for (var i = cursorPos - 1; i >= cursorPos - 15; i--) {
@@ -344,7 +344,8 @@ var InsertHtml = /** @class */ (function () {
344
344
  : lastSelectionNode.previousSibling) : lastSelectionNode;
345
345
  while (!isNOU(lastSelectionNode) && lastSelectionNode.nodeName !== '#text' && lastSelectionNode.nodeName !== 'IMG' &&
346
346
  lastSelectionNode.nodeName !== 'BR' && lastSelectionNode.nodeName !== 'HR') {
347
- if (!isNOU(lastSelectionNode.lastChild) && (lastSelectionNode.lastChild.nodeName === 'P' && lastSelectionNode.lastChild.innerHTML === '')) {
347
+ if (!isNOU(lastSelectionNode.lastChild) && (lastSelectionNode.lastChild.nodeName === 'P' &&
348
+ lastSelectionNode.lastChild.innerHTML === '')) {
348
349
  var lineBreak = createElement('br');
349
350
  lastSelectionNode.lastChild.appendChild(lineBreak);
350
351
  }
@@ -275,7 +275,7 @@ var LinkCommand = /** @class */ (function () {
275
275
  for (var i = 0; i < blockNodes.length; i++) {
276
276
  var linkNode = blockNodes[i].querySelectorAll('a');
277
277
  for (var j = 0; j < linkNode.length; j++) {
278
- if (document.getSelection().containsNode(linkNode[j], true)) {
278
+ if (this.parent.currentDocument.getSelection().containsNode(linkNode[j], true)) {
279
279
  linkNode[j].outerHTML = linkNode[j].innerHTML;
280
280
  }
281
281
  }
@@ -309,8 +309,8 @@ var MsWordPaste = /** @class */ (function () {
309
309
  }
310
310
  isCroppedImage = ((this.extractCropValue('cropl', fullImg[i]) > 0 &&
311
311
  this.extractCropValue('cropt', fullImg[i]) > 0) ||
312
- (this.extractCropValue('cropr', fullImg[i]) > 0 &&
313
- this.extractCropValue('cropb', fullImg[i]))) ? true : false;
312
+ this.extractCropValue('cropr', fullImg[i]) > 0 ||
313
+ this.extractCropValue('cropb', fullImg[i])) ? true : false;
314
314
  if (isCroppedImage) {
315
315
  goalWidth = this.extractCropValue('wgoal', fullImg[i]);
316
316
  goalHeight = this.extractCropValue('hgoal', fullImg[i]);
@@ -337,7 +337,7 @@ var MsWordPaste = /** @class */ (function () {
337
337
  };
338
338
  MsWordPaste.prototype.extractCropValue = function (crop, rtfData) {
339
339
  // eslint-disable-next-line security/detect-non-literal-regexp
340
- var result = new RegExp('\\\\pic' + crop + '(\\-?\\d+)\\\\').exec(rtfData.replace(/\r\n\\/g, '\\'))[1];
340
+ var result = new RegExp('\\\\pic' + crop + '(\\-?\\d+)\\\\').exec(rtfData.replace(/\r\n\\/g, '\\').replace(/\n/g, '\\'))[1];
341
341
  return parseInt(result, 10);
342
342
  };
343
343
  MsWordPaste.prototype.removeClassName = function (elm) {
@@ -376,6 +376,10 @@ var MsWordPaste = /** @class */ (function () {
376
376
  return removableElement;
377
377
  };
378
378
  MsWordPaste.prototype.removeUnwantedElements = function (elm) {
379
+ var styleElm = elm.querySelector('style');
380
+ if (!isNOU(styleElm)) {
381
+ detach(styleElm);
382
+ }
379
383
  var innerElement = elm.innerHTML;
380
384
  for (var i = 0; i < this.removableElements.length; i++) {
381
385
  // eslint-disable-next-line security/detect-non-literal-regexp
@@ -673,10 +677,8 @@ var MsWordPaste = /** @class */ (function () {
673
677
  }
674
678
  if (!isNOU(listNodes[i].getAttribute('style'))) {
675
679
  listNodes[i].setAttribute('style', listNodes[i].getAttribute('style').replace('text-align:start;', ''));
676
- if (listNodes[i].style.textAlign !== '') {
677
- listNodes[i].setAttribute('style', 'text-align:' + listNodes[i].style.textAlign);
678
- currentListStyle = listNodes[i].getAttribute('style');
679
- }
680
+ listNodes[i].style.textIndent = '';
681
+ currentListStyle = listNodes[i].getAttribute('style');
680
682
  }
681
683
  collection.push({
682
684
  listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
@@ -884,8 +886,7 @@ var MsWordPaste = /** @class */ (function () {
884
886
  }
885
887
  }
886
888
  prevList.setAttribute('class', collection[index].class);
887
- var currentStyle = prevList.getAttribute('style');
888
- prevList.setAttribute('style', (!isNOU(currentStyle) ? currentStyle : ''));
889
+ prevList.setAttribute('style', (!isNOU(collection[index].listStyle) ? collection[index].listStyle : ''));
889
890
  pLevel = collection[index].nestedLevel;
890
891
  listCount++;
891
892
  if (!isNOU(collection[index].start)) {
@@ -86,7 +86,7 @@ var EmojiPicker = /** @class */ (function () {
86
86
  }
87
87
  else if (isNOU(args.x) && isNOU(args.y) && !this.parent.inlineMode.enable && isNOU(this.parent.quickToolbarSettings.text)) {
88
88
  target = this.parent.inputElement;
89
- if (window.getSelection().rangeCount > 0) {
89
+ if (this.parent.contentModule.getDocument().getSelection().rangeCount > 0) {
90
90
  var coordinates = this.getCoordinates();
91
91
  xValue = coordinates.left;
92
92
  yValue = coordinates.top;
@@ -94,7 +94,7 @@ var EmojiPicker = /** @class */ (function () {
94
94
  }
95
95
  else if (isNOU(args.x) && isNOU(args.y) && (this.parent.inlineMode.enable || !isNOU(this.parent.quickToolbarSettings.text))) {
96
96
  this.parent.notify(events.hidePopup, {});
97
- if (window.getSelection().rangeCount > 0) {
97
+ if (this.parent.contentModule.getDocument().getSelection().rangeCount > 0) {
98
98
  var coordinates = this.getCoordinates();
99
99
  xValue = coordinates.left;
100
100
  yValue = coordinates.top;
@@ -683,7 +683,7 @@ var EmojiPicker = /** @class */ (function () {
683
683
  };
684
684
  EmojiPicker.prototype.onkeyPress = function (e) {
685
685
  var originalEvent = e.args;
686
- var selection = window.getSelection();
686
+ var selection = this.parent.contentModule.getDocument().getSelection();
687
687
  if (selection.rangeCount <= 0) {
688
688
  return;
689
689
  }
@@ -713,7 +713,10 @@ var EmojiPicker = /** @class */ (function () {
713
713
  };
714
714
  EmojiPicker.prototype.onkeyUp = function (e) {
715
715
  var originalEvent = e.args;
716
- var selection = window.getSelection();
716
+ var selection = this.parent.contentModule.getDocument().getSelection();
717
+ if (selection.rangeCount <= 0) {
718
+ return;
719
+ }
717
720
  var range = selection.getRangeAt(0);
718
721
  var cursorPos = range.startOffset;
719
722
  // eslint-disable-next-line
@@ -736,7 +739,7 @@ var EmojiPicker = /** @class */ (function () {
736
739
  };
737
740
  EmojiPicker.prototype.getCoordinates = function () {
738
741
  var coordinates;
739
- var selection = window.getSelection();
742
+ var selection = this.parent.contentModule.getDocument().getSelection();
740
743
  var range = selection.getRangeAt(0);
741
744
  var firstChild;
742
745
  if (range.startContainer.nodeName === 'P' || range.startContainer.nodeName === 'DIV') {
@@ -16,6 +16,7 @@ import { ToolbarAction } from './toolbar-action';
16
16
  */
17
17
  var Toolbar = /** @class */ (function () {
18
18
  function Toolbar(parent, serviceLocator) {
19
+ this.tools = {};
19
20
  this.parent = parent;
20
21
  this.isToolbar = false;
21
22
  this.locator = serviceLocator;
@@ -1534,6 +1534,7 @@ export declare class RichTextEditor extends Component<HTMLElement> implements IN
1534
1534
  private getUpdatedValue;
1535
1535
  private updateValueOnIdle;
1536
1536
  private updateIntervalValue;
1537
+ private removeResizeElement;
1537
1538
  private updateStatus;
1538
1539
  private onDocumentClick;
1539
1540
  private blurHandler;
@@ -744,7 +744,8 @@ var RichTextEditor = /** @class */ (function (_super) {
744
744
  }
745
745
  }
746
746
  var notFormatPainterCopy = isNOU(e.action) ? true : (e.action !== 'format-copy' ? true : false);
747
- if (this.formatter.getUndoRedoStack().length === 0 && notFormatPainterCopy && !(e.altKey || e.shiftKey || (e.altKey && e.shiftKey && e.which == 67))) {
747
+ if (this.formatter.getUndoRedoStack().length === 0 && notFormatPainterCopy &&
748
+ !(e.altKey || e.shiftKey || (e.altKey && e.shiftKey && e.which === 67))) {
748
749
  this.formatter.saveData();
749
750
  }
750
751
  if (e.action !== 'insert-link' &&
@@ -1864,8 +1865,8 @@ var RichTextEditor = /** @class */ (function (_super) {
1864
1865
  }
1865
1866
  else {
1866
1867
  if (target === 'windowResize' && heightPercent) {
1867
- // cntEle hide the borderBottom of RichTextEditor. so removed the 2px of cntEle height.
1868
- heightValue = parseInt(heightValue) - 2 + 'px';
1868
+ //cntEle hide the borderBottom of RichTextEditor. so removed the 2px of cntEle height.
1869
+ heightValue = parseInt(heightValue, 10) - 2 + 'px';
1869
1870
  }
1870
1871
  setStyleAttribute(cntEle, { height: heightValue, marginTop: topValue + 'px' });
1871
1872
  }
@@ -1889,7 +1890,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1889
1890
  * @public
1890
1891
  */
1891
1892
  RichTextEditor.prototype.getHtml = function () {
1892
- var htmlValue = this.contentModule.getEditPanel().innerHTML;
1893
+ var htmlValue = this.removeResizeElement(this.contentModule.getEditPanel().innerHTML);
1893
1894
  return (this.enableXhtml && (htmlValue === '<p><br></p>' || htmlValue === '<div><br></div>' ||
1894
1895
  htmlValue === '<br>') ? null : this.serializeValue(htmlValue));
1895
1896
  };
@@ -1900,7 +1901,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1900
1901
  * @public
1901
1902
  */
1902
1903
  RichTextEditor.prototype.getXhtml = function () {
1903
- var currentValue = this.value;
1904
+ var currentValue = this.removeResizeElement(this.value);
1904
1905
  if (!isNOU(currentValue) && this.enableXhtml) {
1905
1906
  currentValue = this.htmlEditorModule.xhtmlValidation.selfEncloseValidation(currentValue);
1906
1907
  }
@@ -2141,14 +2142,11 @@ var RichTextEditor = /** @class */ (function (_super) {
2141
2142
  };
2142
2143
  RichTextEditor.prototype.getUpdatedValue = function () {
2143
2144
  var value;
2144
- if (!isNOU(this.tableModule)) {
2145
- this.tableModule.removeResizeElement();
2146
- }
2147
2145
  var getTextArea = this.element.querySelector('.e-rte-srctextarea');
2148
2146
  if (this.editorMode === 'HTML') {
2149
2147
  value = (this.inputElement.innerHTML === '<p><br></p>' || this.inputElement.innerHTML === '<div><br></div>' ||
2150
2148
  this.inputElement.innerHTML === '<br>') ? null : this.enableHtmlEncode ?
2151
- this.encode(decode(this.inputElement.innerHTML)) : this.inputElement.innerHTML;
2149
+ this.encode(decode(this.removeResizeElement(this.inputElement.innerHTML))) : this.inputElement.innerHTML;
2152
2150
  if (getTextArea && getTextArea.style.display === 'block') {
2153
2151
  value = getTextArea.value;
2154
2152
  }
@@ -2157,6 +2155,9 @@ var RichTextEditor = /** @class */ (function (_super) {
2157
2155
  value = this.inputElement.value === '' ? null :
2158
2156
  this.inputElement.value;
2159
2157
  }
2158
+ if (value != null && !this.enableHtmlEncode) {
2159
+ value = this.removeResizeElement(value);
2160
+ }
2160
2161
  return value;
2161
2162
  };
2162
2163
  RichTextEditor.prototype.updateValueOnIdle = function () {
@@ -2172,6 +2173,17 @@ var RichTextEditor = /** @class */ (function (_super) {
2172
2173
  clearTimeout(this.idleInterval);
2173
2174
  this.idleInterval = setTimeout(this.updateValueOnIdle.bind(this), 0);
2174
2175
  };
2176
+ RichTextEditor.prototype.removeResizeElement = function (value) {
2177
+ var valueElementWrapper = document.createElement("div");
2178
+ valueElementWrapper.innerHTML = value;
2179
+ var item = valueElementWrapper.querySelectorAll('.e-column-resize, .e-row-resize, .e-table-box, .e-table-rhelper, .e-img-resize');
2180
+ if (item.length > 0) {
2181
+ for (var i = 0; i < item.length; i++) {
2182
+ detach(item[i]);
2183
+ }
2184
+ }
2185
+ return valueElementWrapper.innerHTML;
2186
+ };
2175
2187
  RichTextEditor.prototype.updateStatus = function (e) {
2176
2188
  if (!isNOU(e.html) || !isNOU(e.markdown)) {
2177
2189
  var status_1 = this.formatter.editorManager.undoRedoManager.getUndoStatus();
@@ -2220,6 +2232,7 @@ var RichTextEditor = /** @class */ (function (_super) {
2220
2232
  this.notify(events.focusChange, {});
2221
2233
  var value = this.getUpdatedValue();
2222
2234
  this.setProperties({ value: value });
2235
+ this.valueContainer.value = this.value;
2223
2236
  this.notify(events.toolbarRefresh, { args: e, documentNode: document });
2224
2237
  this.isValueChangeBlurhandler = true;
2225
2238
  this.invokeChangeEvent();
@@ -58,10 +58,10 @@ var ToolbarRenderer = /** @class */ (function () {
58
58
  if (!this.parent.enabled) {
59
59
  return;
60
60
  }
61
+ this.parent.trigger('toolbarClick', args);
61
62
  if (!this.parent.readonly || isNullOrUndefined(args.item)) {
62
63
  this.parent.notify(events.toolbarClick, args);
63
64
  }
64
- this.parent.trigger('toolbarClick', args);
65
65
  };
66
66
  ToolbarRenderer.prototype.dropDownSelected = function (args) {
67
67
  this.parent.notify(events.dropDownSelect, args);