@syncfusion/ej2-richtexteditor 20.4.44 → 20.4.49

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 (64) hide show
  1. package/CHANGELOG.md +28 -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 +89 -18
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +89 -18
  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 +12 -12
  13. package/src/editor-manager/plugin/inserthtml.js +1 -1
  14. package/src/editor-manager/plugin/ms-word-clean-up.js +29 -1
  15. package/src/editor-manager/plugin/selection-commands.js +55 -14
  16. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +1 -1
  17. package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -1
  18. package/src/rich-text-editor/models/items.js +1 -1
  19. package/src/rich-text-editor/renderer/toolbar-renderer.js +3 -1
  20. package/styles/bootstrap-dark.css +18 -18
  21. package/styles/bootstrap.css +18 -18
  22. package/styles/bootstrap4.css +18 -18
  23. package/styles/bootstrap5-dark.css +18 -18
  24. package/styles/bootstrap5.css +18 -18
  25. package/styles/fabric-dark.css +18 -18
  26. package/styles/fabric.css +18 -18
  27. package/styles/fluent-dark.css +18 -18
  28. package/styles/fluent.css +18 -18
  29. package/styles/highcontrast-light.css +18 -18
  30. package/styles/highcontrast.css +18 -18
  31. package/styles/material-dark.css +18 -18
  32. package/styles/material.css +18 -18
  33. package/styles/rich-text-editor/_layout.scss +3 -3
  34. package/styles/rich-text-editor/bootstrap-dark.css +18 -18
  35. package/styles/rich-text-editor/bootstrap.css +18 -18
  36. package/styles/rich-text-editor/bootstrap4.css +18 -18
  37. package/styles/rich-text-editor/bootstrap5-dark.css +18 -18
  38. package/styles/rich-text-editor/bootstrap5.css +18 -18
  39. package/styles/rich-text-editor/fabric-dark.css +18 -18
  40. package/styles/rich-text-editor/fabric.css +18 -18
  41. package/styles/rich-text-editor/fluent-dark.css +18 -18
  42. package/styles/rich-text-editor/fluent.css +18 -18
  43. package/styles/rich-text-editor/highcontrast-light.css +18 -18
  44. package/styles/rich-text-editor/highcontrast.css +18 -18
  45. package/styles/rich-text-editor/icons/_bootstrap-dark.scss +1 -1
  46. package/styles/rich-text-editor/icons/_bootstrap.scss +1 -1
  47. package/styles/rich-text-editor/icons/_bootstrap4.scss +1 -1
  48. package/styles/rich-text-editor/icons/_bootstrap5.scss +1 -1
  49. package/styles/rich-text-editor/icons/_fabric-dark.scss +1 -1
  50. package/styles/rich-text-editor/icons/_fabric.scss +1 -1
  51. package/styles/rich-text-editor/icons/_fluent.scss +1 -1
  52. package/styles/rich-text-editor/icons/_fusionnew.scss +1 -1
  53. package/styles/rich-text-editor/icons/_highcontrast-light.scss +1 -1
  54. package/styles/rich-text-editor/icons/_highcontrast.scss +1 -1
  55. package/styles/rich-text-editor/icons/_material-dark.scss +1 -1
  56. package/styles/rich-text-editor/icons/_material.scss +1 -1
  57. package/styles/rich-text-editor/icons/_material3.scss +1 -1
  58. package/styles/rich-text-editor/icons/_tailwind.scss +1 -1
  59. package/styles/rich-text-editor/material-dark.css +18 -18
  60. package/styles/rich-text-editor/material.css +18 -18
  61. package/styles/rich-text-editor/tailwind-dark.css +18 -18
  62. package/styles/rich-text-editor/tailwind.css +18 -18
  63. package/styles/tailwind-dark.css +18 -18
  64. package/styles/tailwind.css +18 -18
@@ -1457,7 +1457,7 @@ let tools = {
1457
1457
  },
1458
1458
  'fontcolor': {
1459
1459
  'id': 'FontColor',
1460
- 'icon': 'e-font-color',
1460
+ 'icon': 'e-rte-font-color',
1461
1461
  'tooltip': 'Font Color',
1462
1462
  'command': 'Font',
1463
1463
  'subCommand': 'FontColor',
@@ -3330,6 +3330,8 @@ class ToolbarRenderer {
3330
3330
  target: colorPicker.element.parentElement, cssClass: css,
3331
3331
  enablePersistence: this.parent.enablePersistence, enableRtl: this.parent.enableRtl,
3332
3332
  beforeOpen: (dropDownArgs) => {
3333
+ colorPicker.inline = true;
3334
+ colorPicker.dataBind();
3333
3335
  if (proxy.parent.readonly || !proxy.parent.enabled) {
3334
3336
  dropDownArgs.cancel = true;
3335
3337
  return;
@@ -3496,7 +3498,7 @@ class ToolbarRenderer {
3496
3498
  const colorPicker = new ColorPicker({
3497
3499
  enablePersistence: this.parent.enablePersistence,
3498
3500
  enableRtl: this.parent.enableRtl,
3499
- inline: true,
3501
+ inline: false,
3500
3502
  value: '#fff',
3501
3503
  created: () => {
3502
3504
  const value = (item === 'backgroundcolor') ? proxy.parent.backgroundColor.default : proxy.parent.fontColor.default;
@@ -13007,7 +13009,7 @@ class InsertHtml {
13007
13009
  detach(currentNode.nextSibling);
13008
13010
  }
13009
13011
  }
13010
- else if (currentNode.nodeName === '#text' && !isNullOrUndefined(currentNode.parentElement) &&
13012
+ else if ((currentNode.nodeName === '#text' || currentNode.nodeName === "BR") && !isNullOrUndefined(currentNode.parentElement) &&
13011
13013
  (currentNode.parentElement.nodeName === 'LI' || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
13012
13014
  currentNode.parentElement.textContent.trim().length > 0) {
13013
13015
  splitedElm = currentNode;
@@ -15627,7 +15629,7 @@ class SelectionCommands {
15627
15629
  isSubSup = formatNode === null ? false : true;
15628
15630
  }
15629
15631
  }
15630
- else if ((format === 'fontsize' || format === 'fontname' || format === 'fontcolor') && range.startContainer.parentElement === endNode) {
15632
+ else if ((format === 'fontsize' || format === 'fontname' || format === 'fontcolor' || format === 'backgroundcolor') && range.startContainer.parentElement === endNode) {
15631
15633
  formatNode = null;
15632
15634
  }
15633
15635
  if (index === 0 && formatNode === null) {
@@ -15740,6 +15742,7 @@ class SelectionCommands {
15740
15742
  const startText = range.startContainer.nodeName === '#text' ?
15741
15743
  range.startContainer.textContent.substring(range.startOffset, range.startContainer.textContent.length) :
15742
15744
  range.startContainer.textContent;
15745
+ const nodeText = nodes[index].textContent;
15743
15746
  if (!(range.startContainer === range.endContainer && range.startOffset === 0
15744
15747
  && range.endOffset === range.startContainer.length)) {
15745
15748
  const nodeIndex = [];
@@ -15878,8 +15881,25 @@ class SelectionCommands {
15878
15881
  parentElement = parentElement.parentElement;
15879
15882
  liElement = parentElement;
15880
15883
  }
15884
+ let num = index;
15885
+ let liChildContent = '';
15886
+ while (num >= 0 && !isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' && liElement.textContent.replace('/\u200B/g', '').trim().includes(nodes[num].textContent.trim())) {
15887
+ liChildContent = ' ' + nodes[num].textContent.trim() + liChildContent;
15888
+ num--;
15889
+ }
15890
+ let isNestedList = false;
15891
+ let nestedListCount = 0;
15892
+ let isNestedListItem = false;
15893
+ if (!isNullOrUndefined(liElement) && liElement.childNodes) {
15894
+ for (let num = 0; num < liElement.childNodes.length; num++) {
15895
+ if (liElement.childNodes[num].nodeName === ('OL' || 'UL')) {
15896
+ nestedListCount++;
15897
+ isNestedList = true;
15898
+ }
15899
+ }
15900
+ }
15881
15901
  if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' &&
15882
- liElement.textContent.trim() === nodes[index].textContent.trim()) {
15902
+ liElement.textContent.split('\u200B').join('').trim() === liChildContent.split('\u200B').join('').trim()) {
15883
15903
  if (format === 'fontsize') {
15884
15904
  liElement.style.fontSize = value;
15885
15905
  }
@@ -15888,26 +15908,49 @@ class SelectionCommands {
15888
15908
  liElement.style.textDecoration = 'inherit';
15889
15909
  }
15890
15910
  }
15911
+ else if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' && isNestedList) {
15912
+ if (isNestedList && nestedListCount > 0) {
15913
+ for (let num = 0; num < liElement.childNodes.length; num++) {
15914
+ if (nodes[index].textContent === liElement.childNodes[num].textContent && nodes[index].textContent === nodeText && liElement.textContent.replace('/\u200B/g', '').trim().includes(liChildContent.split('\u200B').join('').trim())) {
15915
+ isNestedListItem = true;
15916
+ }
15917
+ }
15918
+ }
15919
+ if (isNestedListItem) {
15920
+ for (let num = 0; num < liElement.childNodes.length; num++) {
15921
+ if (liElement.childNodes[num].nodeName === ('OL' || 'UL')) {
15922
+ liElement.childNodes[num].style.fontSize = 'initial';
15923
+ }
15924
+ }
15925
+ if (format === 'fontsize') {
15926
+ liElement.style.fontSize = value;
15927
+ }
15928
+ else {
15929
+ liElement.style.color = value;
15930
+ liElement.style.textDecoration = 'inherit';
15931
+ }
15932
+ }
15933
+ }
15891
15934
  }
15892
15935
  }
15893
15936
  return nodes[index];
15894
15937
  }
15895
15938
  static insertFormat(docElement, nodes, index, formatNode, isCursor, isFormat, isFontStyle, range, nodeCutter, format, value, domNode, endNode) {
15896
- let rootBlockNode;
15939
+ let rootElementNode;
15897
15940
  if (!isCursor) {
15898
15941
  if ((formatNode === null && isFormat) || isFontStyle) {
15899
15942
  if (nodes[index].nodeName !== 'BR') {
15900
- if (format === 'fontsize' || format === 'fontname' || format === 'fontcolor') {
15943
+ if (format === 'fontsize' || format === 'fontname' || format === 'fontcolor' || format === 'backgroundcolor') {
15901
15944
  let rangeNode = nodes[index];
15902
15945
  while (rangeNode && !domNode.isBlockNode(rangeNode) && rangeNode !== endNode) {
15903
15946
  if (domNode.isBlockNode(rangeNode.parentElement)) {
15904
- rootBlockNode = rangeNode;
15947
+ rootElementNode = rangeNode;
15905
15948
  }
15906
15949
  rangeNode = rangeNode.parentElement;
15907
15950
  }
15908
- if (rootBlockNode && rootBlockNode.nodeType !== 3) {
15909
- nodeCutter.SplitNode(range, rootBlockNode, true).cloneNode(true);
15910
- nodeCutter.SplitNode(range, rootBlockNode, false).cloneNode(false);
15951
+ if (rootElementNode && rootElementNode.nodeType !== 3) {
15952
+ nodeCutter.SplitNode(range, rootElementNode, true).cloneNode(true);
15953
+ nodeCutter.SplitNode(range, rootElementNode, false).cloneNode(false);
15911
15954
  }
15912
15955
  }
15913
15956
  nodes[index] = nodeCutter.GetSpliceNode(range, nodes[index]);
@@ -15919,11 +15962,11 @@ class SelectionCommands {
15919
15962
  }
15920
15963
  else if (!(isFontStyle === true && value === '')) {
15921
15964
  const element = this.GetFormatNode(format, value);
15922
- if (format === 'fontsize' || format === 'fontcolor' || format === 'fontname') {
15923
- if (format !== 'fontname') {
15965
+ if (format === 'fontsize' || format === 'fontcolor' || format === 'fontname' || format === 'backgroundcolor') {
15966
+ if (format !== 'fontname' && format !== 'backgroundcolor') {
15924
15967
  let liElement = nodes[index].parentElement;
15925
15968
  let parentElement = nodes[index].parentElement;
15926
- while (!isNullOrUndefined(parentElement) && parentElement.tagName.toLowerCase() !== 'li') {
15969
+ while (!isNullOrUndefined(parentElement) && parentElement.tagName.toLowerCase() !== 'li' && parentElement !== endNode) {
15927
15970
  parentElement = parentElement.parentElement;
15928
15971
  liElement = parentElement;
15929
15972
  }
@@ -15938,13 +15981,13 @@ class SelectionCommands {
15938
15981
  }
15939
15982
  }
15940
15983
  }
15941
- if (rootBlockNode && rootBlockNode.nodeType !== 3) {
15984
+ if (rootElementNode && rootElementNode.nodeType !== 3) {
15942
15985
  const save = new NodeSelection();
15943
15986
  save.save(range, docElement);
15944
15987
  domNode.setMarker(save);
15945
- var cloneNode = rootBlockNode.cloneNode(true);
15988
+ var cloneNode = rootElementNode.cloneNode(true);
15946
15989
  element.appendChild(cloneNode);
15947
- domNode.replaceWith(rootBlockNode, element.outerHTML);
15990
+ domNode.replaceWith(rootElementNode, element.outerHTML);
15948
15991
  const currentStartNode = endNode.querySelector('.e-editor-select-start');
15949
15992
  const currrentEndNode = endNode.querySelector('.e-editor-select-end');
15950
15993
  if (index === 0) {
@@ -16755,6 +16798,15 @@ class MsWordPaste {
16755
16798
  if (pattern4.test(tempHTMLContent)) {
16756
16799
  this.addTableBorderClass(elm);
16757
16800
  }
16801
+ // Removing the margin for list items
16802
+ const liChildren = elm.querySelectorAll('li');
16803
+ if (liChildren.length > 0) {
16804
+ for (let i = 0; i < liChildren.length; i++) {
16805
+ if (!isNullOrUndefined(liChildren[i].style.marginLeft)) {
16806
+ liChildren[i].style.marginLeft = '';
16807
+ }
16808
+ }
16809
+ }
16758
16810
  e.callBack(elm.innerHTML);
16759
16811
  }
16760
16812
  else {
@@ -17160,9 +17212,25 @@ class MsWordPaste {
17160
17212
  this.getListContent(listNodes[i]);
17161
17213
  let type;
17162
17214
  let listStyleType;
17215
+ let startAttr;
17163
17216
  if (!isNullOrUndefined(this.listContents[0])) {
17164
17217
  type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
17165
17218
  listStyleType = this.getlistStyleType(this.listContents[0], type);
17219
+ if (type === 'ol' && listNodes[i - 1] === null) {
17220
+ const startString = this.listContents[0].split('.')[0];
17221
+ const listTypes = ['A', 'a', 'I', 'i', 'α', '1'];
17222
+ if (listTypes.indexOf(startString) === -1) {
17223
+ if (listStyleType === 'decimal') {
17224
+ // Bug in getlistStyleType() list style stype is returned as decimal for nested list with start attribute
17225
+ if (!isNaN(parseInt(startString))) {
17226
+ startAttr = parseInt(startString);
17227
+ }
17228
+ }
17229
+ else if (listStyleType === 'upper-alpha' || listStyleType === 'lower-alpha') {
17230
+ startAttr = parseInt(startString.toLowerCase()) - 96;
17231
+ }
17232
+ }
17233
+ }
17166
17234
  const tempNode = [];
17167
17235
  for (let j = 1; j < this.listContents.length; j++) {
17168
17236
  tempNode.push(this.listContents[j]);
@@ -17179,7 +17247,7 @@ class MsWordPaste {
17179
17247
  }
17180
17248
  }
17181
17249
  collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
17182
- listStyle: currentListStyle, listStyleTypeName: listStyleType });
17250
+ listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr });
17183
17251
  }
17184
17252
  }
17185
17253
  stNode = listNodes.shift();
@@ -17343,6 +17411,9 @@ class MsWordPaste {
17343
17411
  prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : ''));
17344
17412
  pLevel = collection[index].nestedLevel;
17345
17413
  listCount++;
17414
+ if (!isNullOrUndefined(collection[index].start)) {
17415
+ temp.setAttribute('start', collection[index].start.toString());
17416
+ }
17346
17417
  }
17347
17418
  return root;
17348
17419
  }