@syncfusion/ej2-richtexteditor 21.2.5 → 21.2.6

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 : 21.2.5
3
+ * version : 21.2.6
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. 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@21.2.4",
3
+ "_id": "@syncfusion/ej2-richtexteditor@21.2.5",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-eBrzNjkFqdoMunZ81qFy5/qOvaIzi171X1xZxVnpx0oYxYT/5NstDoiwthzG6AEg/JCcfxcvwj8jn8Xb17t3/w==",
5
+ "_integrity": "sha512-iVaRF/cRXXIePc2utfTH3f23LmO7GgH+S749SsNpr1RdfRCAw9VL6Sb2F+aGbNdyd+fGlfjmJqxvtOJss8NYNw==",
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-21.2.4.tgz",
30
- "_shasum": "011f6ac6194b8e0b752dbff698a42a8e84e69886",
29
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-21.2.5.tgz",
30
+ "_shasum": "43d27462cefa86acb98ad194685d1fd7c0ad31b6",
31
31
  "_spec": "@syncfusion/ej2-richtexteditor@*",
32
32
  "_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included",
33
33
  "author": {
@@ -39,10 +39,10 @@
39
39
  "bundleDependencies": false,
40
40
  "dependencies": {
41
41
  "@syncfusion/ej2-base": "~21.2.3",
42
- "@syncfusion/ej2-buttons": "~21.2.5",
42
+ "@syncfusion/ej2-buttons": "~21.2.6",
43
43
  "@syncfusion/ej2-filemanager": "~21.2.5",
44
- "@syncfusion/ej2-inputs": "~21.2.4",
45
- "@syncfusion/ej2-navigations": "~21.2.5",
44
+ "@syncfusion/ej2-inputs": "~21.2.6",
45
+ "@syncfusion/ej2-navigations": "~21.2.6",
46
46
  "@syncfusion/ej2-popups": "~21.2.4",
47
47
  "@syncfusion/ej2-splitbuttons": "~21.2.5"
48
48
  },
@@ -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": "21.2.5",
73
+ "version": "21.2.6",
74
74
  "sideEffects": false
75
75
  }
@@ -33,6 +33,7 @@ export declare class MsWordPaste {
33
33
  private findDetachElem;
34
34
  private removeUnwantedElements;
35
35
  private findDetachEmptyElem;
36
+ private hasParentWithClass;
36
37
  private removeEmptyElements;
37
38
  private styleCorrection;
38
39
  private filterStyles;
@@ -44,4 +45,5 @@ export declare class MsWordPaste {
44
45
  private getlistStyleType;
45
46
  private makeConversion;
46
47
  private getListContent;
48
+ private removeEmptyAnchorTag;
47
49
  }
@@ -77,6 +77,7 @@ var MsWordPaste = /** @class */ (function () {
77
77
  this.removingComments(elm);
78
78
  this.removeUnwantedElements(elm);
79
79
  this.removeEmptyElements(elm);
80
+ this.removeEmptyAnchorTag(elm);
80
81
  this.breakLineAddition(elm);
81
82
  this.removeClassName(elm);
82
83
  if (pattern4.test(tempHTMLContent)) {
@@ -130,7 +131,8 @@ var MsWordPaste = /** @class */ (function () {
130
131
  imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0 &&
131
132
  imgElem[i].getAttribute('v:shapes').indexOf('圖片') < 0 &&
132
133
  imgElem[i].getAttribute('v:shapes').indexOf('Grafik') < 0 &&
133
- imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0) {
134
+ imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0 &&
135
+ imgElem[i].getAttribute('v:shapes').indexOf('Graphic') < 0) {
134
136
  detach(imgElem[i]);
135
137
  }
136
138
  }
@@ -303,6 +305,7 @@ var MsWordPaste = /** @class */ (function () {
303
305
  if (!isNOU(element.parentElement)) {
304
306
  if (element.parentElement.textContent.trim() === '' &&
305
307
  element.parentElement.getAttribute('id') !== 'MSWord-Content' &&
308
+ !(this.hasParentWithClass(element, 'MsoListParagraph')) &&
306
309
  isNOU(element.parentElement.querySelector('img'))) {
307
310
  removableElement = this.findDetachEmptyElem(element.parentElement);
308
311
  }
@@ -315,6 +318,16 @@ var MsWordPaste = /** @class */ (function () {
315
318
  }
316
319
  return removableElement;
317
320
  };
321
+ MsWordPaste.prototype.hasParentWithClass = function (element, className) {
322
+ var currentParentElem = element.parentElement;
323
+ while (!isNOU(currentParentElem)) {
324
+ if (currentParentElem.classList.contains(className)) {
325
+ return true;
326
+ }
327
+ currentParentElem = currentParentElem.parentElement;
328
+ }
329
+ return false;
330
+ };
318
331
  MsWordPaste.prototype.removeEmptyElements = function (element) {
319
332
  var emptyElements = element.querySelectorAll(':empty');
320
333
  for (var i = 0; i < emptyElements.length; i++) {
@@ -454,7 +467,6 @@ var MsWordPaste = /** @class */ (function () {
454
467
  };
455
468
  MsWordPaste.prototype.cleanUp = function (node, listNodes) {
456
469
  // eslint-disable-next-line
457
- var temp = '';
458
470
  var tempCleaner = [];
459
471
  var prevflagState;
460
472
  var allNodes = node.querySelectorAll('*');
@@ -466,7 +478,7 @@ var MsWordPaste = /** @class */ (function () {
466
478
  }
467
479
  else if (allNodes[index].className &&
468
480
  allNodes[index].className.toLowerCase().indexOf('msolistparagraph') !== -1 &&
469
- allNodes[index].childElementCount !== 1 && !isNOU(allNodes[index].getAttribute('style')) &&
481
+ !isNOU(allNodes[index].getAttribute('style')) &&
470
482
  allNodes[index].getAttribute('style').indexOf('mso-list:') >= 0) {
471
483
  if (allNodes[index].className.indexOf('MsoListParagraphCxSpFirst') >= 0 && listNodes.length > 0 &&
472
484
  listNodes[listNodes.length - 1] !== null) {
@@ -647,6 +659,19 @@ var MsWordPaste = /** @class */ (function () {
647
659
  var listCount = 0;
648
660
  var elem;
649
661
  for (var index = 0; index < collection.length; index++) {
662
+ var listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
663
+ var isNormalList = false;
664
+ for (var i = 0; i < listClass.length; i++) {
665
+ if (listClass[i].indexOf(collection[index].class) >= 0) {
666
+ isNormalList = true;
667
+ break;
668
+ }
669
+ }
670
+ if (!isNOU(prevList) && index != 0 &&
671
+ collection[index - 1].listType !== collection[index].listType &&
672
+ !isNormalList) {
673
+ prevList = null;
674
+ }
650
675
  var pElement = createElement('p');
651
676
  pElement.innerHTML = collection[index].content.join(' ');
652
677
  if ((collection[index].nestedLevel === 1) && listCount === 0 && collection[index].content) {
@@ -757,28 +782,29 @@ var MsWordPaste = /** @class */ (function () {
757
782
  this.listContents.push(pushContent);
758
783
  }
759
784
  else {
760
- var styleNodes = ['b', 'em'];
761
- if (firstChild.childNodes.length > 0 && (firstChild.querySelectorAll('b').length > 0
762
- || firstChild.querySelectorAll('em').length > 0)) {
763
- for (var i = 0; i < firstChild.childNodes.length; i++) {
764
- var nodeName = firstChild.childNodes[i].nodeName.toLowerCase();
765
- if (firstChild.childNodes[i].textContent.trim().length > 1 && styleNodes.indexOf(nodeName) !== -1) {
766
- pushContent = '<' + nodeName + '>' + firstChild.childNodes[i].textContent + '</' + nodeName + '>';
767
- this.listContents.push(pushContent);
768
- }
769
- else if (firstChild.childNodes[i].textContent.trim().length === 1) {
770
- this.listContents.push(firstChild.childNodes[i].textContent.trim());
771
- }
785
+ //Add to support separate list which looks like same list and also to add all tags as it is inside list
786
+ if (firstChild.childNodes.length > 0) {
787
+ var listOrder = firstChild.querySelector('span[style="mso-list:Ignore"]');
788
+ if (!isNOU(listOrder)) {
789
+ this.listContents.push(listOrder.textContent.trim());
790
+ detach(listOrder);
791
+ this.removingComments(elem);
792
+ this.removeUnwantedElements(elem);
772
793
  }
773
794
  }
774
- else {
775
- pushContent = firstChild.textContent.trim();
776
- this.listContents.push(pushContent);
777
- }
778
795
  }
779
- detach(firstChild);
780
796
  this.listContents.push(elem.innerHTML);
781
797
  };
798
+ MsWordPaste.prototype.removeEmptyAnchorTag = function (element) {
799
+ var removableElement = element.querySelectorAll('a:not([href])');
800
+ for (var j = removableElement.length - 1; j >= 0; j--) {
801
+ var parentElem = removableElement[j].parentNode;
802
+ while (removableElement[j].firstChild) {
803
+ parentElem.insertBefore(removableElement[j].firstChild, removableElement[j]);
804
+ }
805
+ parentElem.removeChild(removableElement[j]);
806
+ }
807
+ };
782
808
  return MsWordPaste;
783
809
  }());
784
810
  export { MsWordPaste };
@@ -27,6 +27,7 @@ export declare class TableCommand {
27
27
  private insertColumn;
28
28
  private deleteColumn;
29
29
  private deleteRow;
30
+ private getMergedRow;
30
31
  private removeTable;
31
32
  private tableHeader;
32
33
  private tableVerticalAlign;
@@ -351,10 +351,13 @@ var TableCommand = /** @class */ (function () {
351
351
  /* eslint-disable */
352
352
  if (1 === rowSpanVal) {
353
353
  allCells[maxI][j].removeAttribute('rowspan');
354
- var cell = allCells[maxI][j].cloneNode(true);
355
- allCells = this.getCorrespondingColumns();
356
- if (allCells[rowSpanVal][j] && allCells[rowSpanVal][j].parentElement) {
357
- allCells[rowSpanVal][j].parentElement.insertBefore(cell, allCells[rowSpanVal][j]);
354
+ var cell = this.getMergedRow(this.getCorrespondingColumns())[j];
355
+ if (cell) {
356
+ var cloneNode = cell.cloneNode(true);
357
+ cloneNode.innerHTML = '<br>';
358
+ if (cell.parentElement) {
359
+ cell.parentElement.insertBefore(cloneNode, cell);
360
+ }
358
361
  }
359
362
  }
360
363
  else {
@@ -404,6 +407,15 @@ var TableCommand = /** @class */ (function () {
404
407
  });
405
408
  }
406
409
  };
410
+ TableCommand.prototype.getMergedRow = function (cells) {
411
+ var mergedRow;
412
+ for (var i = 0; i < cells.length; i++) {
413
+ if (cells[i].length !== this.curTable.rows[0].childNodes.length) {
414
+ mergedRow = cells[i];
415
+ }
416
+ }
417
+ return mergedRow;
418
+ };
407
419
  TableCommand.prototype.removeTable = function (e) {
408
420
  var selectedCell = e.item.selection.range.startContainer;
409
421
  selectedCell = (selectedCell.nodeType === 3) ? selectedCell.parentNode : selectedCell;
@@ -116,7 +116,8 @@ var HtmlEditor = /** @class */ (function () {
116
116
  range.startContainer.nodeName === '#text' ? range.startContainer.parentElement !== this.parent.inputElement ? range.startContainer.parentElement.classList.add('currentStartMark')
117
117
  : isRootParent = true : range.startContainer.classList.add('currentStartMark');
118
118
  if (range.startContainer.textContent.charCodeAt(0) === 8203) {
119
- pointer = range.startOffset === 0 ? range.startOffset : range.startOffset - 1;
119
+ pointer = range.startOffset === 0 ? range.startOffset :
120
+ range.startContainer.textContent.replace(regEx, '').trim().length !== 0 ? range.startOffset - 1 : 0;
120
121
  range.startContainer.textContent = range.startContainer.textContent.replace(regEx, '');
121
122
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), range.startContainer, pointer);
122
123
  }
@@ -331,7 +332,7 @@ var HtmlEditor = /** @class */ (function () {
331
332
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
332
333
  // eslint-disable-next-line
333
334
  this.oldRangeElement, this.oldRangeElement.childNodes.length);
334
- if (this.oldRangeElement.querySelector('BR')) {
335
+ if (this.oldRangeElement.querySelectorAll('BR').length === 1) {
335
336
  detach(this.oldRangeElement.querySelector('BR'));
336
337
  }
337
338
  if (!isNullOrUndefined(this.rangeElement) && this.oldRangeElement !== this.rangeElement) {
@@ -387,7 +387,6 @@ var PasteCleanup = /** @class */ (function () {
387
387
  statusCode: '1'
388
388
  }];
389
389
  this.uploadObj.createFileList(fileData);
390
- this.uploadObj.filesData.push(fileData[0]);
391
390
  /* eslint-enable */
392
391
  rawFile = fileData;
393
392
  this.uploadObj.upload(fileData);
@@ -464,6 +463,7 @@ var PasteCleanup = /** @class */ (function () {
464
463
 
465
464
  */
466
465
  PasteCleanup.prototype.imageFormatting = function (pasteArgs, imgElement) {
466
+ imgElement.elements[0].classList.add('pasteContent_Img');
467
467
  var imageElement = this.parent.createElement('span');
468
468
  imageElement.appendChild(imgElement.elements[0]);
469
469
  var imageValue = imageElement.innerHTML;
@@ -729,6 +729,7 @@ var RichTextEditor = /** @class */ (function (_super) {
729
729
  }
730
730
  if (e.action !== 'insert-link' &&
731
731
  e.action !== 'format-copy' && e.action !== 'format-paste' &&
732
+ (!e.target || !e.target.classList.contains('e-mention')) &&
732
733
  (e.action && e.action !== 'paste' && e.action !== 'space'
733
734
  || e.which === 9 || (e.code === 'Backspace' && e.which === 8))) {
734
735
  var FormatPainterEscapeAction = false;