@syncfusion/ej2-richtexteditor 20.4.48 → 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.
@@ -15859,6 +15859,7 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
15859
15859
  var startText = range.startContainer.nodeName === '#text' ?
15860
15860
  range.startContainer.textContent.substring(range.startOffset, range.startContainer.textContent.length) :
15861
15861
  range.startContainer.textContent;
15862
+ var nodeText = nodes[index].textContent;
15862
15863
  if (!(range.startContainer === range.endContainer && range.startOffset === 0
15863
15864
  && range.endOffset === range.startContainer.length)) {
15864
15865
  var nodeIndex = [];
@@ -15997,8 +15998,25 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
15997
15998
  parentElement = parentElement.parentElement;
15998
15999
  liElement = parentElement;
15999
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
+ }
16000
16018
  if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' &&
16001
- liElement.textContent.trim() === nodes[index].textContent.trim()) {
16019
+ liElement.textContent.split('\u200B').join('').trim() === liChildContent.split('\u200B').join('').trim()) {
16002
16020
  if (format === 'fontsize') {
16003
16021
  liElement.style.fontSize = value;
16004
16022
  }
@@ -16007,6 +16025,29 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
16007
16025
  liElement.style.textDecoration = 'inherit';
16008
16026
  }
16009
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
+ }
16010
16051
  }
16011
16052
  }
16012
16053
  return nodes[index];
@@ -16883,6 +16924,15 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
16883
16924
  if (pattern4.test(tempHTMLContent)) {
16884
16925
  this.addTableBorderClass(elm);
16885
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
+ }
16886
16936
  e.callBack(elm.innerHTML);
16887
16937
  }
16888
16938
  else {
@@ -17288,9 +17338,25 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
17288
17338
  this.getListContent(listNodes[i]);
17289
17339
  var type = void 0;
17290
17340
  var listStyleType = void 0;
17341
+ var startAttr = void 0;
17291
17342
  if (!isNullOrUndefined(this.listContents[0])) {
17292
17343
  type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
17293
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
+ }
17294
17360
  var tempNode = [];
17295
17361
  for (var j = 1; j < this.listContents.length; j++) {
17296
17362
  tempNode.push(this.listContents[j]);
@@ -17307,7 +17373,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
17307
17373
  }
17308
17374
  }
17309
17375
  collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
17310
- listStyle: currentListStyle, listStyleTypeName: listStyleType });
17376
+ listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr });
17311
17377
  }
17312
17378
  }
17313
17379
  stNode = listNodes.shift();
@@ -17471,6 +17537,9 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
17471
17537
  prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : ''));
17472
17538
  pLevel = collection[index].nestedLevel;
17473
17539
  listCount++;
17540
+ if (!isNullOrUndefined(collection[index].start)) {
17541
+ temp.setAttribute('start', collection[index].start.toString());
17542
+ }
17474
17543
  }
17475
17544
  return root;
17476
17545
  };