@syncfusion/ej2-richtexteditor 23.1.40 → 23.1.41

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.40
3
+ * version : 23.1.41
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.39",
3
+ "_id": "@syncfusion/ej2-richtexteditor@23.1.40",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-V6HvyVC8YYc6eSNz2M5jIO8qngm8IPaoMoSlPX+k2yj4b32y7X1jed6kwH+alM9z7Ze1A/AKIZTKHzhMPpMlyQ==",
5
+ "_integrity": "sha512-/ZUQYuQqnKEUFRxihm0PFXec5aVT6cccy74I7/wdhkxvGfPzCpCYw6zD/RycIvtW7gzXqqmbshuW99aJqqmVMg==",
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.39.tgz",
30
- "_shasum": "cc5669f0dd4098e1c15fe63e0cd31cded1e50be3",
29
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-23.1.40.tgz",
30
+ "_shasum": "f71428956e7033350edecc5a22e64e2fa0fa5527",
31
31
  "_spec": "@syncfusion/ej2-richtexteditor@*",
32
32
  "_where": "/jenkins/workspace/elease-automation_release_23.1.1/packages/included",
33
33
  "author": {
@@ -38,13 +38,13 @@
38
38
  },
39
39
  "bundleDependencies": false,
40
40
  "dependencies": {
41
- "@syncfusion/ej2-base": "~23.1.38",
42
- "@syncfusion/ej2-buttons": "~23.1.39",
41
+ "@syncfusion/ej2-base": "~23.1.41",
42
+ "@syncfusion/ej2-buttons": "~23.1.41",
43
43
  "@syncfusion/ej2-filemanager": "~23.1.40",
44
44
  "@syncfusion/ej2-inputs": "~23.1.40",
45
- "@syncfusion/ej2-navigations": "~23.1.40",
45
+ "@syncfusion/ej2-navigations": "~23.1.41",
46
46
  "@syncfusion/ej2-popups": "~23.1.38",
47
- "@syncfusion/ej2-splitbuttons": "~23.1.36"
47
+ "@syncfusion/ej2-splitbuttons": "~23.1.41"
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.40",
73
+ "version": "23.1.41",
74
74
  "sideEffects": false
75
75
  }
@@ -319,10 +319,15 @@ var FormatPainterActions = /** @class */ (function () {
319
319
  return this.INVALID_TAGS.indexOf(node.tagName) > -1;
320
320
  };
321
321
  FormatPainterActions.prototype.findCurrentContext = function (parentElem) {
322
- if (closest(parentElem, 'p')) {
322
+ var closestParagraph = closest(parentElem, 'p');
323
+ var closestList = closest(parentElem, 'li');
324
+ if (closestParagraph && !closestList) {
323
325
  return 'Text';
324
326
  }
325
327
  else if (closest(parentElem, 'li')) {
328
+ if (!isNOU(closestParagraph) && !isNOU(closestList) && closestParagraph.textContent.trim() !== closestList.textContent.trim()) {
329
+ return 'Text';
330
+ }
326
331
  return 'List';
327
332
  }
328
333
  else if (closest(parentElem, 'td') || closest(parentElem, 'tr') || closest(parentElem, 'th')) {
@@ -380,7 +385,7 @@ var FormatPainterActions = /** @class */ (function () {
380
385
  var cloneElementNode = isNOU(cloneListParentNode) ? element : element.firstChild;
381
386
  for (var index = 0; index < nodes.length; index++) {
382
387
  if (this.INVALID_TAGS.indexOf(nodes[index].nodeName) > -1 ||
383
- nodes[index].querySelectorAll('a,img,audio,video,iframe').length > 0) {
388
+ nodes[index].querySelectorAll('img,audio,video,iframe').length > 0) {
384
389
  continue;
385
390
  }
386
391
  var cloneParentNode = cloneElementNode.cloneNode(false);
@@ -344,6 +344,10 @@ 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 === '')) {
348
+ var lineBreak = createElement('br');
349
+ lastSelectionNode.lastChild.appendChild(lineBreak);
350
+ }
347
351
  lastSelectionNode = lastSelectionNode.lastChild;
348
352
  }
349
353
  lastSelectionNode = isNOU(lastSelectionNode) ? node : lastSelectionNode;
@@ -307,8 +307,10 @@ var MsWordPaste = /** @class */ (function () {
307
307
  else {
308
308
  continue;
309
309
  }
310
- isCroppedImage = this.extractCropValue('cropl', fullImg[i]) > 0 &&
311
- this.extractCropValue('cropt', fullImg[i]) > 0 ? true : false;
310
+ isCroppedImage = ((this.extractCropValue('cropl', fullImg[i]) > 0 &&
311
+ this.extractCropValue('cropt', fullImg[i]) > 0) ||
312
+ (this.extractCropValue('cropr', fullImg[i]) > 0 &&
313
+ this.extractCropValue('cropb', fullImg[i]))) ? true : false;
312
314
  if (isCroppedImage) {
313
315
  goalWidth = this.extractCropValue('wgoal', fullImg[i]);
314
316
  goalHeight = this.extractCropValue('hgoal', fullImg[i]);
@@ -335,7 +337,7 @@ var MsWordPaste = /** @class */ (function () {
335
337
  };
336
338
  MsWordPaste.prototype.extractCropValue = function (crop, rtfData) {
337
339
  // eslint-disable-next-line security/detect-non-literal-regexp
338
- var result = new RegExp('\\\\pic' + crop + '(\\-?\\d+)\\\\').exec(rtfData.replace('\r\n\\', '\\'))[1];
340
+ var result = new RegExp('\\\\pic' + crop + '(\\-?\\d+)\\\\').exec(rtfData.replace(/\r\n\\/g, '\\'))[1];
339
341
  return parseInt(result, 10);
340
342
  };
341
343
  MsWordPaste.prototype.removeClassName = function (elm) {
@@ -49,7 +49,7 @@ var NodeCutter = /** @class */ (function () {
49
49
  node = parent_1.childNodes[index];
50
50
  fragment = this.spliceEmptyNode(fragment, false);
51
51
  if (fragment && fragment.childNodes.length > 0) {
52
- var isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG'
52
+ var isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG' && !(fragment.querySelectorAll('img').length > 0)
53
53
  && this.isRteElm(fragment) && fragment.textContent === '') ? true : false;
54
54
  if (!isEmpty) {
55
55
  if (node) {
@@ -236,7 +236,7 @@ var EnterKeyAction = /** @class */ (function () {
236
236
  }
237
237
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), insertElem.nextElementSibling, 0);
238
238
  }
239
- else if (nearBlockNode.textContent.length === 0 && !(!isNOU(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG')) {
239
+ else if (nearBlockNode.textContent.length === 0 && !(!isNOU(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG') && !(nearBlockNode.querySelectorAll('img').length > 0)) {
240
240
  if (!isNOU(nearBlockNode.children[0]) && nearBlockNode.children[0].tagName !== 'BR') {
241
241
  var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, false).cloneNode(true);
242
242
  _this.parent.formatter.editorManager.domNode.insertAfter(newElem, nearBlockNode);
@@ -151,7 +151,7 @@ var HtmlEditor = /** @class */ (function () {
151
151
  detach(currentChildNode[i]);
152
152
  i--;
153
153
  }
154
- if (focusNode.textContent.replace(regEx, '') === currentChildNode[i].textContent) {
154
+ if (!isNOU(currentChildNode[i]) && focusNode.textContent.replace(regEx, '') === currentChildNode[i].textContent) {
155
155
  pointer = focusNode.textContent.length > 1 ?
156
156
  (focusNode.textContent === currentChildNode[i].textContent ? pointer :
157
157
  pointer - (focusNode.textContent.length - focusNode.textContent.replace(regEx, '').length)) :
@@ -743,13 +743,13 @@ var RichTextEditor = /** @class */ (function (_super) {
743
743
  this.formatter.editorManager.nodeSelection.setCursorPoint(this.contentModule.getDocument(), range.startContainer, range.startOffset);
744
744
  }
745
745
  }
746
- var notFormatPainterCopy = !isNOU(e.action) && e.action !== 'format-copy';
747
- if (this.formatter.getUndoRedoStack().length === 0 && notFormatPainterCopy) {
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))) {
748
748
  this.formatter.saveData();
749
749
  }
750
750
  if (e.action !== 'insert-link' &&
751
751
  e.action !== 'format-copy' && e.action !== 'format-paste' &&
752
- (!e.target || (e.target.classList.contains('e-mention') && e.code !== 'Tab')) &&
752
+ (!e.target || !(e.target.classList.contains('e-mention') && e.code === 'Tab')) &&
753
753
  (e.action && e.action !== 'paste' && e.action !== 'space'
754
754
  || e.which === 9 || (e.code === 'Backspace' && e.which === 8))) {
755
755
  var FormatPainterEscapeAction = false;
@@ -69,20 +69,20 @@ var Formatter = /** @class */ (function () {
69
69
  }
70
70
  if (isNOU(args)) {
71
71
  var action_1 = event.action;
72
+ args = {};
73
+ var items = {
74
+ originalEvent: event, cancel: false,
75
+ requestType: action_1 || (event.key + 'Key'),
76
+ itemCollection: value
77
+ };
78
+ extend(args, args, items, true);
72
79
  if (action_1 !== 'tab' && action_1 !== 'enter' && action_1 !== 'space' && action_1 !== 'escape') {
73
- args = {};
74
80
  if (self.editorMode === 'Markdown' && action_1 === 'insert-table') {
75
81
  value = {
76
82
  'headingText': self.localeObj.getConstant('TableHeadingText'),
77
83
  'colText': self.localeObj.getConstant('TableColText')
78
84
  };
79
85
  }
80
- var items = {
81
- originalEvent: event, cancel: false,
82
- requestType: action_1 || (event.key + 'Key'),
83
- itemCollection: value
84
- };
85
- extend(args, args, items, true);
86
86
  self.trigger(CONSTANT.actionBegin, args, function (actionBeginArgs) {
87
87
  if (actionBeginArgs.cancel) {
88
88
  if (action_1 === 'paste' || action_1 === 'cut' || action_1 === 'copy') {
@@ -91,20 +91,22 @@ var Formatter = /** @class */ (function () {
91
91
  }
92
92
  });
93
93
  }
94
- var isTableModule = isNOU(self.tableModule) ? true : self.tableModule ?
95
- self.tableModule.ensureInsideTableList : false;
96
- if ((event.which === 9 && isTableModule) || event.which !== 9) {
97
- if (event.which === 13 && self.editorMode === 'HTML') {
98
- value = {
99
- 'enterAction': self.enterKey
100
- };
94
+ if (!args.cancel) {
95
+ var isTableModule = isNOU(self.tableModule) ? true : self.tableModule ?
96
+ self.tableModule.ensureInsideTableList : false;
97
+ if ((event.which === 9 && isTableModule) || event.which !== 9) {
98
+ if (event.which === 13 && self.editorMode === 'HTML') {
99
+ value = {
100
+ 'enterAction': self.enterKey
101
+ };
102
+ }
103
+ this.editorManager.observer.notify((event.type === 'keydown' ? KEY_DOWN : KEY_UP), {
104
+ event: event,
105
+ callBack: this.onSuccess.bind(this, self),
106
+ value: value,
107
+ enterAction: self.enterKey
108
+ });
101
109
  }
102
- this.editorManager.observer.notify((event.type === 'keydown' ? KEY_DOWN : KEY_UP), {
103
- event: event,
104
- callBack: this.onSuccess.bind(this, self),
105
- value: value,
106
- enterAction: self.enterKey
107
- });
108
110
  }
109
111
  }
110
112
  else if (!isNOU(args) && args.item.command && args.item.subCommand && ((args.item.command !== args.item.subCommand
@@ -250,6 +250,7 @@ var ToolbarRenderer = /** @class */ (function () {
250
250
  args.cancel = true;
251
251
  return;
252
252
  }
253
+ proxy.parent.notify(events.selectionRestore, {});
253
254
  var element = (args.event) ? args.event.target : null;
254
255
  proxy.currentElement = dropDown.element;
255
256
  proxy.currentDropdown = dropDown;
@@ -276,6 +277,12 @@ var ToolbarRenderer = /** @class */ (function () {
276
277
  }
277
278
  args.element.tabIndex = -1;
278
279
  dropDown.element.removeAttribute('type');
280
+ dropDown.element.onmousedown = function () {
281
+ proxy.parent.notify(events.selectionSave, {});
282
+ };
283
+ dropDown.element.onkeydown = function () {
284
+ proxy.parent.notify(events.selectionSave, {});
285
+ };
279
286
  return dropDown;
280
287
  };
281
288
  // eslint-disable-next-line