@syncfusion/ej2-richtexteditor 20.4.48 → 20.4.50

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.
@@ -15742,6 +15742,7 @@ class SelectionCommands {
15742
15742
  const startText = range.startContainer.nodeName === '#text' ?
15743
15743
  range.startContainer.textContent.substring(range.startOffset, range.startContainer.textContent.length) :
15744
15744
  range.startContainer.textContent;
15745
+ const nodeText = nodes[index].textContent;
15745
15746
  if (!(range.startContainer === range.endContainer && range.startOffset === 0
15746
15747
  && range.endOffset === range.startContainer.length)) {
15747
15748
  const nodeIndex = [];
@@ -15880,8 +15881,25 @@ class SelectionCommands {
15880
15881
  parentElement = parentElement.parentElement;
15881
15882
  liElement = parentElement;
15882
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
+ }
15883
15901
  if (!isNullOrUndefined(liElement) && liElement.tagName.toLowerCase() === 'li' &&
15884
- liElement.textContent.trim() === nodes[index].textContent.trim()) {
15902
+ liElement.textContent.split('\u200B').join('').trim() === liChildContent.split('\u200B').join('').trim()) {
15885
15903
  if (format === 'fontsize') {
15886
15904
  liElement.style.fontSize = value;
15887
15905
  }
@@ -15890,6 +15908,29 @@ class SelectionCommands {
15890
15908
  liElement.style.textDecoration = 'inherit';
15891
15909
  }
15892
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
+ }
15893
15934
  }
15894
15935
  }
15895
15936
  return nodes[index];
@@ -16757,6 +16798,15 @@ class MsWordPaste {
16757
16798
  if (pattern4.test(tempHTMLContent)) {
16758
16799
  this.addTableBorderClass(elm);
16759
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
+ }
16760
16810
  e.callBack(elm.innerHTML);
16761
16811
  }
16762
16812
  else {
@@ -17162,9 +17212,25 @@ class MsWordPaste {
17162
17212
  this.getListContent(listNodes[i]);
17163
17213
  let type;
17164
17214
  let listStyleType;
17215
+ let startAttr;
17165
17216
  if (!isNullOrUndefined(this.listContents[0])) {
17166
17217
  type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
17167
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
+ }
17168
17234
  const tempNode = [];
17169
17235
  for (let j = 1; j < this.listContents.length; j++) {
17170
17236
  tempNode.push(this.listContents[j]);
@@ -17181,7 +17247,7 @@ class MsWordPaste {
17181
17247
  }
17182
17248
  }
17183
17249
  collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
17184
- listStyle: currentListStyle, listStyleTypeName: listStyleType });
17250
+ listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr });
17185
17251
  }
17186
17252
  }
17187
17253
  stNode = listNodes.shift();
@@ -17345,6 +17411,9 @@ class MsWordPaste {
17345
17411
  prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : ''));
17346
17412
  pLevel = collection[index].nestedLevel;
17347
17413
  listCount++;
17414
+ if (!isNullOrUndefined(collection[index].start)) {
17415
+ temp.setAttribute('start', collection[index].start.toString());
17416
+ }
17348
17417
  }
17349
17418
  return root;
17350
17419
  }
@@ -27107,7 +27176,7 @@ class Table {
27107
27176
  const width = parseFloat(this.columnEle.offsetWidth.toString());
27108
27177
  const cellRow = this.curTable.rows[0].cells[0].nodeName === 'TH' ? 1 : 0;
27109
27178
  const currentTableWidth = parseFloat(this.curTable.style.width.split('%')[0]);
27110
- const currentColumnCellWidth = parseFloat(this.curTable.rows[cellRow].cells[this.colIndex].style.width.split('%')[0]);
27179
+ const currentColumnCellWidth = parseFloat(this.curTable.rows[cellRow].cells[this.colIndex >= this.curTable.rows[cellRow].cells.length ? this.curTable.rows[cellRow].cells.length - 1 : this.colIndex].style.width.split('%')[0]);
27111
27180
  if (this.currentColumnResize === 'first') {
27112
27181
  mouseX = mouseX - 0.75; //This was done for to make the gripper and the table first/last column will be close.
27113
27182
  this.removeResizeElement();