@syncfusion/ej2-richtexteditor 21.2.4 → 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.
Files changed (63) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/ej2-richtexteditor.min.js +2 -2
  3. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  4. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-richtexteditor.es2015.js +68 -28
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +67 -27
  8. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  9. package/dist/global/ej2-richtexteditor.min.js +2 -2
  10. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  11. package/dist/global/index.d.ts +1 -1
  12. package/package.json +10 -10
  13. package/src/editor-manager/plugin/ms-word-clean-up.d.ts +2 -0
  14. package/src/editor-manager/plugin/ms-word-clean-up.js +46 -20
  15. package/src/editor-manager/plugin/table.d.ts +1 -0
  16. package/src/editor-manager/plugin/table.js +16 -4
  17. package/src/rich-text-editor/actions/html-editor.js +3 -2
  18. package/src/rich-text-editor/actions/paste-clean-up.js +1 -1
  19. package/src/rich-text-editor/base/rich-text-editor.js +1 -1
  20. package/styles/bootstrap-dark.css +17 -0
  21. package/styles/bootstrap.css +17 -0
  22. package/styles/bootstrap4.css +17 -0
  23. package/styles/bootstrap5-dark.css +17 -0
  24. package/styles/bootstrap5.css +17 -0
  25. package/styles/fabric-dark.css +17 -0
  26. package/styles/fabric.css +17 -0
  27. package/styles/fluent-dark.css +17 -0
  28. package/styles/fluent.css +17 -0
  29. package/styles/highcontrast-light.css +17 -0
  30. package/styles/highcontrast.css +17 -0
  31. package/styles/material-dark.css +17 -0
  32. package/styles/material.css +17 -0
  33. package/styles/rich-text-editor/bootstrap-dark.css +17 -0
  34. package/styles/rich-text-editor/bootstrap.css +17 -0
  35. package/styles/rich-text-editor/bootstrap4.css +17 -0
  36. package/styles/rich-text-editor/bootstrap5-dark.css +17 -0
  37. package/styles/rich-text-editor/bootstrap5.css +17 -0
  38. package/styles/rich-text-editor/fabric-dark.css +17 -0
  39. package/styles/rich-text-editor/fabric.css +17 -0
  40. package/styles/rich-text-editor/fluent-dark.css +17 -0
  41. package/styles/rich-text-editor/fluent.css +17 -0
  42. package/styles/rich-text-editor/highcontrast-light.css +17 -0
  43. package/styles/rich-text-editor/highcontrast.css +17 -0
  44. package/styles/rich-text-editor/icons/_bootstrap-dark.scss +21 -0
  45. package/styles/rich-text-editor/icons/_bootstrap.scss +21 -0
  46. package/styles/rich-text-editor/icons/_bootstrap4.scss +21 -0
  47. package/styles/rich-text-editor/icons/_bootstrap5.scss +21 -0
  48. package/styles/rich-text-editor/icons/_fabric-dark.scss +21 -0
  49. package/styles/rich-text-editor/icons/_fabric.scss +21 -0
  50. package/styles/rich-text-editor/icons/_fluent.scss +21 -0
  51. package/styles/rich-text-editor/icons/_fusionnew.scss +21 -0
  52. package/styles/rich-text-editor/icons/_highcontrast-light.scss +21 -0
  53. package/styles/rich-text-editor/icons/_highcontrast.scss +21 -0
  54. package/styles/rich-text-editor/icons/_material-dark.scss +21 -0
  55. package/styles/rich-text-editor/icons/_material.scss +21 -0
  56. package/styles/rich-text-editor/icons/_material3.scss +21 -0
  57. package/styles/rich-text-editor/icons/_tailwind.scss +21 -0
  58. package/styles/rich-text-editor/material-dark.css +17 -0
  59. package/styles/rich-text-editor/material.css +17 -0
  60. package/styles/rich-text-editor/tailwind-dark.css +17 -0
  61. package/styles/rich-text-editor/tailwind.css +17 -0
  62. package/styles/tailwind-dark.css +17 -0
  63. package/styles/tailwind.css +17 -0
@@ -14858,7 +14858,7 @@ class TableCommand {
14858
14858
  const colIndex = Array.prototype.indexOf.call(selectedCell.parentNode.childNodes, selectedCell);
14859
14859
  this.curTable = closest(selectedCell, 'table');
14860
14860
  let currentRow;
14861
- let allCells = this.getCorrespondingColumns();
14861
+ const allCells = this.getCorrespondingColumns();
14862
14862
  const minMaxIndex = this.getSelectedCellMinMaxIndex(allCells);
14863
14863
  let maxI;
14864
14864
  let j;
@@ -14876,10 +14876,13 @@ class TableCommand {
14876
14876
  /* eslint-disable */
14877
14877
  if (1 === rowSpanVal) {
14878
14878
  allCells[maxI][j].removeAttribute('rowspan');
14879
- const cell = allCells[maxI][j].cloneNode(true);
14880
- allCells = this.getCorrespondingColumns();
14881
- if (allCells[rowSpanVal][j] && allCells[rowSpanVal][j].parentElement) {
14882
- allCells[rowSpanVal][j].parentElement.insertBefore(cell, allCells[rowSpanVal][j]);
14879
+ const cell = this.getMergedRow(this.getCorrespondingColumns())[j];
14880
+ if (cell) {
14881
+ const cloneNode = cell.cloneNode(true);
14882
+ cloneNode.innerHTML = '<br>';
14883
+ if (cell.parentElement) {
14884
+ cell.parentElement.insertBefore(cloneNode, cell);
14885
+ }
14883
14886
  }
14884
14887
  }
14885
14888
  else {
@@ -14929,6 +14932,15 @@ class TableCommand {
14929
14932
  });
14930
14933
  }
14931
14934
  }
14935
+ getMergedRow(cells) {
14936
+ let mergedRow;
14937
+ for (let i = 0; i < cells.length; i++) {
14938
+ if (cells[i].length !== this.curTable.rows[0].childNodes.length) {
14939
+ mergedRow = cells[i];
14940
+ }
14941
+ }
14942
+ return mergedRow;
14943
+ }
14932
14944
  removeTable(e) {
14933
14945
  let selectedCell = e.item.selection.range.startContainer;
14934
14946
  selectedCell = (selectedCell.nodeType === 3) ? selectedCell.parentNode : selectedCell;
@@ -17071,6 +17083,7 @@ class MsWordPaste {
17071
17083
  this.removingComments(elm);
17072
17084
  this.removeUnwantedElements(elm);
17073
17085
  this.removeEmptyElements(elm);
17086
+ this.removeEmptyAnchorTag(elm);
17074
17087
  this.breakLineAddition(elm);
17075
17088
  this.removeClassName(elm);
17076
17089
  if (pattern4.test(tempHTMLContent)) {
@@ -17124,7 +17137,8 @@ class MsWordPaste {
17124
17137
  imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0 &&
17125
17138
  imgElem[i].getAttribute('v:shapes').indexOf('圖片') < 0 &&
17126
17139
  imgElem[i].getAttribute('v:shapes').indexOf('Grafik') < 0 &&
17127
- imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0) {
17140
+ imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0 &&
17141
+ imgElem[i].getAttribute('v:shapes').indexOf('Graphic') < 0) {
17128
17142
  detach(imgElem[i]);
17129
17143
  }
17130
17144
  }
@@ -17297,6 +17311,7 @@ class MsWordPaste {
17297
17311
  if (!isNullOrUndefined(element.parentElement)) {
17298
17312
  if (element.parentElement.textContent.trim() === '' &&
17299
17313
  element.parentElement.getAttribute('id') !== 'MSWord-Content' &&
17314
+ !(this.hasParentWithClass(element, 'MsoListParagraph')) &&
17300
17315
  isNullOrUndefined(element.parentElement.querySelector('img'))) {
17301
17316
  removableElement = this.findDetachEmptyElem(element.parentElement);
17302
17317
  }
@@ -17309,6 +17324,16 @@ class MsWordPaste {
17309
17324
  }
17310
17325
  return removableElement;
17311
17326
  }
17327
+ hasParentWithClass(element, className) {
17328
+ let currentParentElem = element.parentElement;
17329
+ while (!isNullOrUndefined(currentParentElem)) {
17330
+ if (currentParentElem.classList.contains(className)) {
17331
+ return true;
17332
+ }
17333
+ currentParentElem = currentParentElem.parentElement;
17334
+ }
17335
+ return false;
17336
+ }
17312
17337
  removeEmptyElements(element) {
17313
17338
  const emptyElements = element.querySelectorAll(':empty');
17314
17339
  for (let i = 0; i < emptyElements.length; i++) {
@@ -17459,7 +17484,7 @@ class MsWordPaste {
17459
17484
  }
17460
17485
  else if (allNodes[index].className &&
17461
17486
  allNodes[index].className.toLowerCase().indexOf('msolistparagraph') !== -1 &&
17462
- allNodes[index].childElementCount !== 1 && !isNullOrUndefined(allNodes[index].getAttribute('style')) &&
17487
+ !isNullOrUndefined(allNodes[index].getAttribute('style')) &&
17463
17488
  allNodes[index].getAttribute('style').indexOf('mso-list:') >= 0) {
17464
17489
  if (allNodes[index].className.indexOf('MsoListParagraphCxSpFirst') >= 0 && listNodes.length > 0 &&
17465
17490
  listNodes[listNodes.length - 1] !== null) {
@@ -17640,6 +17665,19 @@ class MsWordPaste {
17640
17665
  let listCount = 0;
17641
17666
  let elem;
17642
17667
  for (let index = 0; index < collection.length; index++) {
17668
+ const listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
17669
+ let isNormalList = false;
17670
+ for (let i = 0; i < listClass.length; i++) {
17671
+ if (listClass[i].indexOf(collection[index].class) >= 0) {
17672
+ isNormalList = true;
17673
+ break;
17674
+ }
17675
+ }
17676
+ if (!isNullOrUndefined(prevList) && index != 0 &&
17677
+ collection[index - 1].listType !== collection[index].listType &&
17678
+ !isNormalList) {
17679
+ prevList = null;
17680
+ }
17643
17681
  const pElement = createElement('p');
17644
17682
  pElement.innerHTML = collection[index].content.join(' ');
17645
17683
  if ((collection[index].nestedLevel === 1) && listCount === 0 && collection[index].content) {
@@ -17750,28 +17788,29 @@ class MsWordPaste {
17750
17788
  this.listContents.push(pushContent);
17751
17789
  }
17752
17790
  else {
17753
- const styleNodes = ['b', 'em'];
17754
- if (firstChild.childNodes.length > 0 && (firstChild.querySelectorAll('b').length > 0
17755
- || firstChild.querySelectorAll('em').length > 0)) {
17756
- for (let i = 0; i < firstChild.childNodes.length; i++) {
17757
- const nodeName = firstChild.childNodes[i].nodeName.toLowerCase();
17758
- if (firstChild.childNodes[i].textContent.trim().length > 1 && styleNodes.indexOf(nodeName) !== -1) {
17759
- pushContent = '<' + nodeName + '>' + firstChild.childNodes[i].textContent + '</' + nodeName + '>';
17760
- this.listContents.push(pushContent);
17761
- }
17762
- else if (firstChild.childNodes[i].textContent.trim().length === 1) {
17763
- this.listContents.push(firstChild.childNodes[i].textContent.trim());
17764
- }
17791
+ //Add to support separate list which looks like same list and also to add all tags as it is inside list
17792
+ if (firstChild.childNodes.length > 0) {
17793
+ let listOrder = firstChild.querySelector('span[style="mso-list:Ignore"]');
17794
+ if (!isNullOrUndefined(listOrder)) {
17795
+ this.listContents.push(listOrder.textContent.trim());
17796
+ detach(listOrder);
17797
+ this.removingComments(elem);
17798
+ this.removeUnwantedElements(elem);
17765
17799
  }
17766
17800
  }
17767
- else {
17768
- pushContent = firstChild.textContent.trim();
17769
- this.listContents.push(pushContent);
17770
- }
17771
17801
  }
17772
- detach(firstChild);
17773
17802
  this.listContents.push(elem.innerHTML);
17774
17803
  }
17804
+ removeEmptyAnchorTag(element) {
17805
+ const removableElement = element.querySelectorAll('a:not([href])');
17806
+ for (let j = removableElement.length - 1; j >= 0; j--) {
17807
+ const parentElem = removableElement[j].parentNode;
17808
+ while (removableElement[j].firstChild) {
17809
+ parentElem.insertBefore(removableElement[j].firstChild, removableElement[j]);
17810
+ }
17811
+ parentElem.removeChild(removableElement[j]);
17812
+ }
17813
+ }
17775
17814
  }
17776
17815
 
17777
17816
  /**
@@ -19432,7 +19471,8 @@ class HtmlEditor {
19432
19471
  range.startContainer.nodeName === '#text' ? range.startContainer.parentElement !== this.parent.inputElement ? range.startContainer.parentElement.classList.add('currentStartMark')
19433
19472
  : isRootParent = true : range.startContainer.classList.add('currentStartMark');
19434
19473
  if (range.startContainer.textContent.charCodeAt(0) === 8203) {
19435
- pointer = range.startOffset === 0 ? range.startOffset : range.startOffset - 1;
19474
+ pointer = range.startOffset === 0 ? range.startOffset :
19475
+ range.startContainer.textContent.replace(regEx, '').trim().length !== 0 ? range.startOffset - 1 : 0;
19436
19476
  range.startContainer.textContent = range.startContainer.textContent.replace(regEx, '');
19437
19477
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), range.startContainer, pointer);
19438
19478
  }
@@ -19646,7 +19686,7 @@ class HtmlEditor {
19646
19686
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
19647
19687
  // eslint-disable-next-line
19648
19688
  this.oldRangeElement, this.oldRangeElement.childNodes.length);
19649
- if (this.oldRangeElement.querySelector('BR')) {
19689
+ if (this.oldRangeElement.querySelectorAll('BR').length === 1) {
19650
19690
  detach(this.oldRangeElement.querySelector('BR'));
19651
19691
  }
19652
19692
  if (!isNullOrUndefined(this.rangeElement) && this.oldRangeElement !== this.rangeElement) {
@@ -20504,7 +20544,6 @@ class PasteCleanup {
20504
20544
  statusCode: '1'
20505
20545
  }];
20506
20546
  this.uploadObj.createFileList(fileData);
20507
- this.uploadObj.filesData.push(fileData[0]);
20508
20547
  /* eslint-enable */
20509
20548
  rawFile = fileData;
20510
20549
  this.uploadObj.upload(fileData);
@@ -20580,6 +20619,7 @@ class PasteCleanup {
20580
20619
  * @deprecated
20581
20620
  */
20582
20621
  imageFormatting(pasteArgs, imgElement) {
20622
+ imgElement.elements[0].classList.add('pasteContent_Img');
20583
20623
  const imageElement = this.parent.createElement('span');
20584
20624
  imageElement.appendChild(imgElement.elements[0]);
20585
20625
  const imageValue = imageElement.innerHTML;
@@ -30642,6 +30682,7 @@ let RichTextEditor = class RichTextEditor extends Component {
30642
30682
  }
30643
30683
  if (e.action !== 'insert-link' &&
30644
30684
  e.action !== 'format-copy' && e.action !== 'format-paste' &&
30685
+ (!e.target || !e.target.classList.contains('e-mention')) &&
30645
30686
  (e.action && e.action !== 'paste' && e.action !== 'space'
30646
30687
  || e.which === 9 || (e.code === 'Backspace' && e.which === 8))) {
30647
30688
  let FormatPainterEscapeAction = false;
@@ -32237,7 +32278,6 @@ let RichTextEditor = class RichTextEditor extends Component {
32237
32278
  }
32238
32279
  setAutoHeight(element) {
32239
32280
  if (!isNullOrUndefined(element)) {
32240
- element.style.height = '';
32241
32281
  element.style.height = this.inputElement.scrollHeight + 'px';
32242
32282
  element.style.overflow = 'hidden';
32243
32283
  }