@syncfusion/ej2-richtexteditor 19.4.40 → 19.4.47

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.
@@ -10512,7 +10512,8 @@ class Lists {
10512
10512
  range.startContainer.parentElement.closest('LI');
10513
10513
  const endNode = range.endContainer.nodeName === 'LI' ? range.endContainer :
10514
10514
  range.endContainer.parentElement.closest('LI');
10515
- if (!isNullOrUndefined(startNode) && !isNullOrUndefined(endNode) && startNode === endNode && startNode.tagName === 'LI' && startNode.textContent.trim() === '') {
10515
+ if (!isNullOrUndefined(startNode) && !isNullOrUndefined(endNode) && startNode === endNode && startNode.tagName === 'LI' &&
10516
+ startNode.textContent.trim() === '' && startNode.querySelectorAll('IMG').length === 0) {
10516
10517
  if (startNode.textContent.charCodeAt(0) === 65279) {
10517
10518
  startNode.textContent = '';
10518
10519
  }
@@ -15851,8 +15852,10 @@ class MsWordPaste {
15851
15852
  this.listContents = [];
15852
15853
  this.getListContent(listNodes[i]);
15853
15854
  let type;
15855
+ let listStyleType;
15854
15856
  if (!isNullOrUndefined(this.listContents[0])) {
15855
15857
  type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
15858
+ listStyleType = this.getlistStyleType(this.listContents[0], type);
15856
15859
  const tempNode = [];
15857
15860
  for (let j = 1; j < this.listContents.length; j++) {
15858
15861
  tempNode.push(this.listContents[j]);
@@ -15869,7 +15872,7 @@ class MsWordPaste {
15869
15872
  }
15870
15873
  }
15871
15874
  collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
15872
- listStyle: currentListStyle });
15875
+ listStyle: currentListStyle, listStyleTypeName: listStyleType });
15873
15876
  }
15874
15877
  }
15875
15878
  stNode = listNodes.shift();
@@ -15893,6 +15896,45 @@ class MsWordPaste {
15893
15896
  }
15894
15897
  }
15895
15898
  }
15899
+ getlistStyleType(listContent, type) {
15900
+ let currentListClass;
15901
+ if (type === 'ol') {
15902
+ switch (listContent.split('.')[0]) {
15903
+ case "A":
15904
+ currentListClass = "upper-alpha";
15905
+ break;
15906
+ case "a":
15907
+ currentListClass = "lower-alpha";
15908
+ break;
15909
+ case "I":
15910
+ currentListClass = "upper-roman";
15911
+ break;
15912
+ case "i":
15913
+ currentListClass = "lower-roman";
15914
+ break;
15915
+ case "α":
15916
+ currentListClass = "lower-greek";
15917
+ break;
15918
+ default:
15919
+ currentListClass = "decimal";
15920
+ break;
15921
+ }
15922
+ }
15923
+ else {
15924
+ switch (listContent.split('.')[0]) {
15925
+ case "o":
15926
+ currentListClass = "circle";
15927
+ break;
15928
+ case "§":
15929
+ currentListClass = "square";
15930
+ break;
15931
+ default:
15932
+ currentListClass = "disc";
15933
+ break;
15934
+ }
15935
+ }
15936
+ return currentListClass;
15937
+ }
15896
15938
  makeConversion(collection) {
15897
15939
  const root = createElement('div');
15898
15940
  let temp;
@@ -15909,7 +15951,7 @@ class MsWordPaste {
15909
15951
  prevList.appendChild(pElement);
15910
15952
  temp.appendChild(prevList);
15911
15953
  temp.setAttribute('level', collection[index].nestedLevel.toString());
15912
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
15954
+ temp.style.listStyleType = collection[index].listStyleTypeName;
15913
15955
  }
15914
15956
  else if (collection[index].nestedLevel === pLevel) {
15915
15957
  if (prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
@@ -15918,6 +15960,7 @@ class MsWordPaste {
15918
15960
  }
15919
15961
  else {
15920
15962
  temp = createElement(collection[index].listType);
15963
+ temp.style.listStyleType = collection[index].listStyleTypeName;
15921
15964
  prevList.parentElement.parentElement.appendChild(temp);
15922
15965
  prevList = createElement('li');
15923
15966
  prevList.appendChild(pElement);
@@ -15929,14 +15972,15 @@ class MsWordPaste {
15929
15972
  if (!isNullOrUndefined(prevList)) {
15930
15973
  for (let j = 0; j < collection[index].nestedLevel - pLevel; j++) {
15931
15974
  prevList.appendChild(temp = createElement(collection[index].listType));
15932
- prevList = createElement('li', { styles: 'list-style-type: none;' });
15975
+ prevList = createElement('li');
15976
+ if (j != collection[index].nestedLevel - pLevel - 1 && collection[index].nestedLevel - pLevel > 1) {
15977
+ prevList.style.listStyleType = "none";
15978
+ }
15933
15979
  temp.appendChild(prevList);
15934
15980
  }
15935
15981
  prevList.appendChild(pElement);
15936
15982
  temp.setAttribute('level', collection[index].nestedLevel.toString());
15937
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
15938
- temp.childNodes[0].style.listStyle =
15939
- this.getListStyle(collection[index].listType, collection[index].nestedLevel);
15983
+ temp.style.listStyleType = collection[index].listStyleTypeName;
15940
15984
  }
15941
15985
  else {
15942
15986
  root.appendChild(temp = createElement(collection[index].listType));
@@ -15944,7 +15988,7 @@ class MsWordPaste {
15944
15988
  prevList.appendChild(pElement);
15945
15989
  temp.appendChild(prevList);
15946
15990
  temp.setAttribute('level', collection[index].nestedLevel.toString());
15947
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
15991
+ temp.style.listStyleType = collection[index].listStyleTypeName;
15948
15992
  }
15949
15993
  }
15950
15994
  else if (collection[index].nestedLevel === 1) {
@@ -15953,12 +15997,12 @@ class MsWordPaste {
15953
15997
  }
15954
15998
  else {
15955
15999
  root.appendChild(temp = createElement(collection[index].listType));
16000
+ temp.style.listStyleType = collection[index].listStyleTypeName;
15956
16001
  }
15957
16002
  prevList = createElement('li');
15958
16003
  prevList.appendChild(pElement);
15959
16004
  temp.appendChild(prevList);
15960
16005
  temp.setAttribute('level', collection[index].nestedLevel.toString());
15961
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
15962
16006
  }
15963
16007
  else {
15964
16008
  elem = prevList;
@@ -15979,7 +16023,7 @@ class MsWordPaste {
15979
16023
  prevList.appendChild(pElement);
15980
16024
  temp.appendChild(prevList);
15981
16025
  temp.setAttribute('level', collection[index].nestedLevel.toString());
15982
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
16026
+ temp.style.listStyleType = collection[index].listStyleTypeName;
15983
16027
  break;
15984
16028
  }
15985
16029
  }
@@ -15988,21 +16032,12 @@ class MsWordPaste {
15988
16032
  }
15989
16033
  prevList.setAttribute('class', collection[index].class);
15990
16034
  const currentStyle = prevList.getAttribute('style');
15991
- prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : '') + collection[index].listStyle);
16035
+ prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : ''));
15992
16036
  pLevel = collection[index].nestedLevel;
15993
16037
  listCount++;
15994
16038
  }
15995
16039
  return root;
15996
16040
  }
15997
- getListStyle(listType, nestedLevel) {
15998
- nestedLevel = (nestedLevel > 0) ? nestedLevel - 1 : nestedLevel;
15999
- if (listType === 'ol') {
16000
- return (nestedLevel < this.olData.length ? this.olData[nestedLevel] : this.olData[0]);
16001
- }
16002
- else {
16003
- return (nestedLevel < this.ulData.length ? this.ulData[nestedLevel] : this.ulData[0]);
16004
- }
16005
- }
16006
16041
  getListContent(elem) {
16007
16042
  let pushContent = '';
16008
16043
  const firstChild = elem.firstElementChild;
@@ -17310,7 +17345,8 @@ class HtmlEditor {
17310
17345
  if (this.rangeElement.tagName === 'OL' || this.rangeElement.tagName === 'UL') {
17311
17346
  const liElement = this.getRangeLiNode(currentRange.startContainer);
17312
17347
  if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
17313
- this.oldRangeElement = liElement.previousElementSibling.lastElementChild;
17348
+ this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
17349
+ liElement.previousElementSibling : liElement.previousElementSibling.lastElementChild;
17314
17350
  if (!isNullOrUndefined(liElement.lastElementChild)) {
17315
17351
  this.rangeElement = liElement.lastElementChild;
17316
17352
  isLiElement = true;
@@ -20246,7 +20282,8 @@ class Image {
20246
20282
  }
20247
20283
  resizeImgDupPos(e) {
20248
20284
  this.imgDupPos = {
20249
- width: (e.style.width !== '') ? this.imgEle.style.width : e.width + 'px',
20285
+ width: (e.style.width !== '' && (this.parent.insertImageSettings &&
20286
+ !this.parent.insertImageSettings.resizeByPercent)) ? this.imgEle.style.width : e.width + 'px',
20250
20287
  height: (e.style.height !== '') ? this.imgEle.style.height : e.height + 'px'
20251
20288
  };
20252
20289
  }
@@ -23915,7 +23952,7 @@ __decorate$2([
23915
23952
  Property(null)
23916
23953
  ], PasteCleanupSettings.prototype, "deniedAttrs", void 0);
23917
23954
  __decorate$2([
23918
- Property(['background', 'background-color', 'border', 'border-bottom', 'border-left', 'border-radius', 'border-right', 'border-style', 'border-top', 'border-width', 'clear', 'color', 'cursor', 'direction', 'display', 'float', 'font', 'font-family', 'font-size', 'font-weight', 'font-style', 'height', 'left', 'line-height', 'margin', 'margin-top', 'margin-left', 'margin-right', 'margin-bottom', 'max-height', 'max-width', 'min-height', 'min-width', 'overflow', 'overflow-x', 'overflow-y', 'padding', 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 'position', 'right', 'table-layout', 'text-align', 'text-decoration', 'text-indent', 'top', 'vertical-align', 'visibility', 'white-space', 'width'])
23955
+ Property(['background', 'background-color', 'border', 'border-bottom', 'border-left', 'border-radius', 'border-right', 'border-style', 'border-top', 'border-width', 'clear', 'color', 'cursor', 'direction', 'display', 'float', 'font', 'font-family', 'font-size', 'font-weight', 'font-style', 'height', 'left', 'line-height', 'list-style-type', 'margin', 'margin-top', 'margin-left', 'margin-right', 'margin-bottom', 'max-height', 'max-width', 'min-height', 'min-width', 'overflow', 'overflow-x', 'overflow-y', 'padding', 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 'position', 'right', 'table-layout', 'text-align', 'text-decoration', 'text-indent', 'top', 'vertical-align', 'visibility', 'white-space', 'width'])
23919
23956
  ], PasteCleanupSettings.prototype, "allowedStyleProps", void 0);
23920
23957
  __decorate$2([
23921
23958
  Property(null)
@@ -24310,9 +24347,11 @@ class EnterKeyAction {
24310
24347
  this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
24311
24348
  this.range.startOffset === this.range.endOffset &&
24312
24349
  this.range.startOffset === isLastNodeLength) {
24313
- const outerBRElem = this.parent.createElement('br');
24314
- this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
24315
- this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), outerBRElem, 0);
24350
+ const focusBRElem = this.parent.createElement('br');
24351
+ const lineBreakBRElem = this.parent.createElement('br');
24352
+ this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, this.range.startContainer);
24353
+ this.parent.formatter.editorManager.domNode.insertAfter(lineBreakBRElem, this.range.startContainer);
24354
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), focusBRElem, 0);
24316
24355
  }
24317
24356
  else if (!isNullOrUndefined(currentParent) && currentParent !== this.parent.inputElement && currentParent.nodeName !== 'BR') {
24318
24357
  if (currentParent.textContent.trim().length === 0 || (currentParent.textContent.trim().length === 1 &&
@@ -26170,7 +26209,7 @@ let RichTextEditor = class RichTextEditor extends Component {
26170
26209
  this.isRTE = false;
26171
26210
  }
26172
26211
  this.notify(docClick, { args: e });
26173
- if (e.detail > 3) {
26212
+ if (Browser.info.name !== 'msie' && e.detail > 3) {
26174
26213
  e.preventDefault();
26175
26214
  }
26176
26215
  }