@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
@@ -1450,7 +1450,7 @@ var tools = {
1450
1450
  },
1451
1451
  'fontcolor': {
1452
1452
  'id': 'FontColor',
1453
- 'icon': 'e-font-color',
1453
+ 'icon': 'e-rte-font-color',
1454
1454
  'tooltip': 'Font Color',
1455
1455
  'command': 'Font',
1456
1456
  'subCommand': 'FontColor',
@@ -3327,6 +3327,8 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
3327
3327
  target: colorPicker.element.parentElement, cssClass: css,
3328
3328
  enablePersistence: this.parent.enablePersistence, enableRtl: this.parent.enableRtl,
3329
3329
  beforeOpen: function (dropDownArgs) {
3330
+ colorPicker.inline = true;
3331
+ colorPicker.dataBind();
3330
3332
  if (proxy.parent.readonly || !proxy.parent.enabled) {
3331
3333
  dropDownArgs.cancel = true;
3332
3334
  return;
@@ -3494,7 +3496,7 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
3494
3496
  var colorPicker = new ColorPicker({
3495
3497
  enablePersistence: this.parent.enablePersistence,
3496
3498
  enableRtl: this.parent.enableRtl,
3497
- inline: true,
3499
+ inline: false,
3498
3500
  value: '#fff',
3499
3501
  created: function () {
3500
3502
  var value = (item === 'backgroundcolor') ? proxy.parent.backgroundColor.default : proxy.parent.fontColor.default;
@@ -13105,7 +13107,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
13105
13107
  detach(currentNode.nextSibling);
13106
13108
  }
13107
13109
  }
13108
- else if (currentNode.nodeName === '#text' && !isNullOrUndefined(currentNode.parentElement) &&
13110
+ else if ((currentNode.nodeName === '#text' || currentNode.nodeName === "BR") && !isNullOrUndefined(currentNode.parentElement) &&
13109
13111
  (currentNode.parentElement.nodeName === 'LI' || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
13110
13112
  currentNode.parentElement.textContent.trim().length > 0) {
13111
13113
  splitedElm = currentNode;
@@ -15744,7 +15746,7 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
15744
15746
  isSubSup = formatNode === null ? false : true;
15745
15747
  }
15746
15748
  }
15747
- else if ((format === 'fontsize' || format === 'fontname' || format === 'fontcolor') && range.startContainer.parentElement === endNode) {
15749
+ else if ((format === 'fontsize' || format === 'fontname' || format === 'fontcolor' || format === 'backgroundcolor') && range.startContainer.parentElement === endNode) {
15748
15750
  formatNode = null;
15749
15751
  }
15750
15752
  if (index === 0 && formatNode === null) {
@@ -15857,6 +15859,7 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
15857
15859
  var startText = range.startContainer.nodeName === '#text' ?
15858
15860
  range.startContainer.textContent.substring(range.startOffset, range.startContainer.textContent.length) :
15859
15861
  range.startContainer.textContent;
15862
+ var nodeText = nodes[index].textContent;
15860
15863
  if (!(range.startContainer === range.endContainer && range.startOffset === 0
15861
15864
  && range.endOffset === range.startContainer.length)) {
15862
15865
  var nodeIndex = [];
@@ -15995,8 +15998,25 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
15995
15998
  parentElement = parentElement.parentElement;
15996
15999
  liElement = parentElement;
15997
16000
  }
16001
+ var num = index;
16002
+ var liChildContent = '';
16003
+ while (num >= 0 && !isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' && liElement.textContent.replace('/\u200B/g', '').trim().includes(nodes[num].textContent.trim())) {
16004
+ liChildContent = ' ' + nodes[num].textContent.trim() + liChildContent;
16005
+ num--;
16006
+ }
16007
+ var isNestedList = false;
16008
+ var nestedListCount = 0;
16009
+ var isNestedListItem = false;
16010
+ if (!isNullOrUndefined(liElement) && liElement.childNodes) {
16011
+ for (var num_1 = 0; num_1 < liElement.childNodes.length; num_1++) {
16012
+ if (liElement.childNodes[num_1].nodeName === ('OL' || 'UL')) {
16013
+ nestedListCount++;
16014
+ isNestedList = true;
16015
+ }
16016
+ }
16017
+ }
15998
16018
  if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' &&
15999
- liElement.textContent.trim() === nodes[index].textContent.trim()) {
16019
+ liElement.textContent.split('\u200B').join('').trim() === liChildContent.split('\u200B').join('').trim()) {
16000
16020
  if (format === 'fontsize') {
16001
16021
  liElement.style.fontSize = value;
16002
16022
  }
@@ -16005,26 +16025,49 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
16005
16025
  liElement.style.textDecoration = 'inherit';
16006
16026
  }
16007
16027
  }
16028
+ else if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' && isNestedList) {
16029
+ if (isNestedList && nestedListCount > 0) {
16030
+ for (var num_2 = 0; num_2 < liElement.childNodes.length; num_2++) {
16031
+ if (nodes[index].textContent === liElement.childNodes[num_2].textContent && nodes[index].textContent === nodeText && liElement.textContent.replace('/\u200B/g', '').trim().includes(liChildContent.split('\u200B').join('').trim())) {
16032
+ isNestedListItem = true;
16033
+ }
16034
+ }
16035
+ }
16036
+ if (isNestedListItem) {
16037
+ for (var num_3 = 0; num_3 < liElement.childNodes.length; num_3++) {
16038
+ if (liElement.childNodes[num_3].nodeName === ('OL' || 'UL')) {
16039
+ liElement.childNodes[num_3].style.fontSize = 'initial';
16040
+ }
16041
+ }
16042
+ if (format === 'fontsize') {
16043
+ liElement.style.fontSize = value;
16044
+ }
16045
+ else {
16046
+ liElement.style.color = value;
16047
+ liElement.style.textDecoration = 'inherit';
16048
+ }
16049
+ }
16050
+ }
16008
16051
  }
16009
16052
  }
16010
16053
  return nodes[index];
16011
16054
  };
16012
16055
  SelectionCommands.insertFormat = function (docElement, nodes, index, formatNode, isCursor, isFormat, isFontStyle, range, nodeCutter, format, value, domNode, endNode) {
16013
- var rootBlockNode;
16056
+ var rootElementNode;
16014
16057
  if (!isCursor) {
16015
16058
  if ((formatNode === null && isFormat) || isFontStyle) {
16016
16059
  if (nodes[index].nodeName !== 'BR') {
16017
- if (format === 'fontsize' || format === 'fontname' || format === 'fontcolor') {
16060
+ if (format === 'fontsize' || format === 'fontname' || format === 'fontcolor' || format === 'backgroundcolor') {
16018
16061
  var rangeNode = nodes[index];
16019
16062
  while (rangeNode && !domNode.isBlockNode(rangeNode) && rangeNode !== endNode) {
16020
16063
  if (domNode.isBlockNode(rangeNode.parentElement)) {
16021
- rootBlockNode = rangeNode;
16064
+ rootElementNode = rangeNode;
16022
16065
  }
16023
16066
  rangeNode = rangeNode.parentElement;
16024
16067
  }
16025
- if (rootBlockNode && rootBlockNode.nodeType !== 3) {
16026
- nodeCutter.SplitNode(range, rootBlockNode, true).cloneNode(true);
16027
- nodeCutter.SplitNode(range, rootBlockNode, false).cloneNode(false);
16068
+ if (rootElementNode && rootElementNode.nodeType !== 3) {
16069
+ nodeCutter.SplitNode(range, rootElementNode, true).cloneNode(true);
16070
+ nodeCutter.SplitNode(range, rootElementNode, false).cloneNode(false);
16028
16071
  }
16029
16072
  }
16030
16073
  nodes[index] = nodeCutter.GetSpliceNode(range, nodes[index]);
@@ -16036,11 +16079,11 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
16036
16079
  }
16037
16080
  else if (!(isFontStyle === true && value === '')) {
16038
16081
  var element = this.GetFormatNode(format, value);
16039
- if (format === 'fontsize' || format === 'fontcolor' || format === 'fontname') {
16040
- if (format !== 'fontname') {
16082
+ if (format === 'fontsize' || format === 'fontcolor' || format === 'fontname' || format === 'backgroundcolor') {
16083
+ if (format !== 'fontname' && format !== 'backgroundcolor') {
16041
16084
  var liElement = nodes[index].parentElement;
16042
16085
  var parentElement = nodes[index].parentElement;
16043
- while (!isNullOrUndefined(parentElement) && parentElement.tagName.toLowerCase() !== 'li') {
16086
+ while (!isNullOrUndefined(parentElement) && parentElement.tagName.toLowerCase() !== 'li' && parentElement !== endNode) {
16044
16087
  parentElement = parentElement.parentElement;
16045
16088
  liElement = parentElement;
16046
16089
  }
@@ -16055,13 +16098,13 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
16055
16098
  }
16056
16099
  }
16057
16100
  }
16058
- if (rootBlockNode && rootBlockNode.nodeType !== 3) {
16101
+ if (rootElementNode && rootElementNode.nodeType !== 3) {
16059
16102
  var save = new NodeSelection();
16060
16103
  save.save(range, docElement);
16061
16104
  domNode.setMarker(save);
16062
- var cloneNode = rootBlockNode.cloneNode(true);
16105
+ var cloneNode = rootElementNode.cloneNode(true);
16063
16106
  element.appendChild(cloneNode);
16064
- domNode.replaceWith(rootBlockNode, element.outerHTML);
16107
+ domNode.replaceWith(rootElementNode, element.outerHTML);
16065
16108
  var currentStartNode = endNode.querySelector('.e-editor-select-start');
16066
16109
  var currrentEndNode = endNode.querySelector('.e-editor-select-end');
16067
16110
  if (index === 0) {
@@ -16881,6 +16924,15 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
16881
16924
  if (pattern4.test(tempHTMLContent)) {
16882
16925
  this.addTableBorderClass(elm);
16883
16926
  }
16927
+ // Removing the margin for list items
16928
+ var liChildren = elm.querySelectorAll('li');
16929
+ if (liChildren.length > 0) {
16930
+ for (var i = 0; i < liChildren.length; i++) {
16931
+ if (!isNullOrUndefined(liChildren[i].style.marginLeft)) {
16932
+ liChildren[i].style.marginLeft = '';
16933
+ }
16934
+ }
16935
+ }
16884
16936
  e.callBack(elm.innerHTML);
16885
16937
  }
16886
16938
  else {
@@ -17286,9 +17338,25 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
17286
17338
  this.getListContent(listNodes[i]);
17287
17339
  var type = void 0;
17288
17340
  var listStyleType = void 0;
17341
+ var startAttr = void 0;
17289
17342
  if (!isNullOrUndefined(this.listContents[0])) {
17290
17343
  type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
17291
17344
  listStyleType = this.getlistStyleType(this.listContents[0], type);
17345
+ if (type === 'ol' && listNodes[i - 1] === null) {
17346
+ var startString = this.listContents[0].split('.')[0];
17347
+ var listTypes = ['A', 'a', 'I', 'i', 'α', '1'];
17348
+ if (listTypes.indexOf(startString) === -1) {
17349
+ if (listStyleType === 'decimal') {
17350
+ // Bug in getlistStyleType() list style stype is returned as decimal for nested list with start attribute
17351
+ if (!isNaN(parseInt(startString))) {
17352
+ startAttr = parseInt(startString);
17353
+ }
17354
+ }
17355
+ else if (listStyleType === 'upper-alpha' || listStyleType === 'lower-alpha') {
17356
+ startAttr = parseInt(startString.toLowerCase()) - 96;
17357
+ }
17358
+ }
17359
+ }
17292
17360
  var tempNode = [];
17293
17361
  for (var j = 1; j < this.listContents.length; j++) {
17294
17362
  tempNode.push(this.listContents[j]);
@@ -17305,7 +17373,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
17305
17373
  }
17306
17374
  }
17307
17375
  collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
17308
- listStyle: currentListStyle, listStyleTypeName: listStyleType });
17376
+ listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr });
17309
17377
  }
17310
17378
  }
17311
17379
  stNode = listNodes.shift();
@@ -17469,6 +17537,9 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
17469
17537
  prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : ''));
17470
17538
  pLevel = collection[index].nestedLevel;
17471
17539
  listCount++;
17540
+ if (!isNullOrUndefined(collection[index].start)) {
17541
+ temp.setAttribute('start', collection[index].start.toString());
17542
+ }
17472
17543
  }
17473
17544
  return root;
17474
17545
  };