@syncfusion/ej2-richtexteditor 19.4.40 → 19.4.52

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
  }
@@ -12132,8 +12133,9 @@ class InsertHtml {
12132
12133
  }
12133
12134
  static getNodeCollection(range, nodeSelection, node) {
12134
12135
  let nodes = [];
12135
- if (range.startOffset === range.endOffset && range.startContainer === range.endContainer
12136
- && (range.startContainer.nodeName === 'TD' || (range.startContainer.nodeType !== 3 &&
12136
+ if (range.startOffset === range.endOffset && range.startContainer === range.endContainer &&
12137
+ range.startContainer.nodeName != 'BR' &&
12138
+ (range.startContainer.nodeName === 'TD' || (range.startContainer.nodeType !== 3 &&
12137
12139
  node.classList && node.classList.contains('pasteContent')))) {
12138
12140
  nodes.push(range.startContainer.childNodes[range.endOffset]);
12139
12141
  }
@@ -15851,8 +15853,10 @@ class MsWordPaste {
15851
15853
  this.listContents = [];
15852
15854
  this.getListContent(listNodes[i]);
15853
15855
  let type;
15856
+ let listStyleType;
15854
15857
  if (!isNullOrUndefined(this.listContents[0])) {
15855
15858
  type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
15859
+ listStyleType = this.getlistStyleType(this.listContents[0], type);
15856
15860
  const tempNode = [];
15857
15861
  for (let j = 1; j < this.listContents.length; j++) {
15858
15862
  tempNode.push(this.listContents[j]);
@@ -15869,7 +15873,7 @@ class MsWordPaste {
15869
15873
  }
15870
15874
  }
15871
15875
  collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
15872
- listStyle: currentListStyle });
15876
+ listStyle: currentListStyle, listStyleTypeName: listStyleType });
15873
15877
  }
15874
15878
  }
15875
15879
  stNode = listNodes.shift();
@@ -15893,6 +15897,45 @@ class MsWordPaste {
15893
15897
  }
15894
15898
  }
15895
15899
  }
15900
+ getlistStyleType(listContent, type) {
15901
+ let currentListClass;
15902
+ if (type === 'ol') {
15903
+ switch (listContent.split('.')[0]) {
15904
+ case "A":
15905
+ currentListClass = "upper-alpha";
15906
+ break;
15907
+ case "a":
15908
+ currentListClass = "lower-alpha";
15909
+ break;
15910
+ case "I":
15911
+ currentListClass = "upper-roman";
15912
+ break;
15913
+ case "i":
15914
+ currentListClass = "lower-roman";
15915
+ break;
15916
+ case "α":
15917
+ currentListClass = "lower-greek";
15918
+ break;
15919
+ default:
15920
+ currentListClass = "decimal";
15921
+ break;
15922
+ }
15923
+ }
15924
+ else {
15925
+ switch (listContent.split('.')[0]) {
15926
+ case "o":
15927
+ currentListClass = "circle";
15928
+ break;
15929
+ case "§":
15930
+ currentListClass = "square";
15931
+ break;
15932
+ default:
15933
+ currentListClass = "disc";
15934
+ break;
15935
+ }
15936
+ }
15937
+ return currentListClass;
15938
+ }
15896
15939
  makeConversion(collection) {
15897
15940
  const root = createElement('div');
15898
15941
  let temp;
@@ -15909,7 +15952,7 @@ class MsWordPaste {
15909
15952
  prevList.appendChild(pElement);
15910
15953
  temp.appendChild(prevList);
15911
15954
  temp.setAttribute('level', collection[index].nestedLevel.toString());
15912
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
15955
+ temp.style.listStyleType = collection[index].listStyleTypeName;
15913
15956
  }
15914
15957
  else if (collection[index].nestedLevel === pLevel) {
15915
15958
  if (prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
@@ -15918,6 +15961,7 @@ class MsWordPaste {
15918
15961
  }
15919
15962
  else {
15920
15963
  temp = createElement(collection[index].listType);
15964
+ temp.style.listStyleType = collection[index].listStyleTypeName;
15921
15965
  prevList.parentElement.parentElement.appendChild(temp);
15922
15966
  prevList = createElement('li');
15923
15967
  prevList.appendChild(pElement);
@@ -15929,14 +15973,15 @@ class MsWordPaste {
15929
15973
  if (!isNullOrUndefined(prevList)) {
15930
15974
  for (let j = 0; j < collection[index].nestedLevel - pLevel; j++) {
15931
15975
  prevList.appendChild(temp = createElement(collection[index].listType));
15932
- prevList = createElement('li', { styles: 'list-style-type: none;' });
15976
+ prevList = createElement('li');
15977
+ if (j != collection[index].nestedLevel - pLevel - 1 && collection[index].nestedLevel - pLevel > 1) {
15978
+ prevList.style.listStyleType = "none";
15979
+ }
15933
15980
  temp.appendChild(prevList);
15934
15981
  }
15935
15982
  prevList.appendChild(pElement);
15936
15983
  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);
15984
+ temp.style.listStyleType = collection[index].listStyleTypeName;
15940
15985
  }
15941
15986
  else {
15942
15987
  root.appendChild(temp = createElement(collection[index].listType));
@@ -15944,7 +15989,7 @@ class MsWordPaste {
15944
15989
  prevList.appendChild(pElement);
15945
15990
  temp.appendChild(prevList);
15946
15991
  temp.setAttribute('level', collection[index].nestedLevel.toString());
15947
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
15992
+ temp.style.listStyleType = collection[index].listStyleTypeName;
15948
15993
  }
15949
15994
  }
15950
15995
  else if (collection[index].nestedLevel === 1) {
@@ -15953,12 +15998,12 @@ class MsWordPaste {
15953
15998
  }
15954
15999
  else {
15955
16000
  root.appendChild(temp = createElement(collection[index].listType));
16001
+ temp.style.listStyleType = collection[index].listStyleTypeName;
15956
16002
  }
15957
16003
  prevList = createElement('li');
15958
16004
  prevList.appendChild(pElement);
15959
16005
  temp.appendChild(prevList);
15960
16006
  temp.setAttribute('level', collection[index].nestedLevel.toString());
15961
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
15962
16007
  }
15963
16008
  else {
15964
16009
  elem = prevList;
@@ -15979,7 +16024,7 @@ class MsWordPaste {
15979
16024
  prevList.appendChild(pElement);
15980
16025
  temp.appendChild(prevList);
15981
16026
  temp.setAttribute('level', collection[index].nestedLevel.toString());
15982
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
16027
+ temp.style.listStyleType = collection[index].listStyleTypeName;
15983
16028
  break;
15984
16029
  }
15985
16030
  }
@@ -15988,21 +16033,12 @@ class MsWordPaste {
15988
16033
  }
15989
16034
  prevList.setAttribute('class', collection[index].class);
15990
16035
  const currentStyle = prevList.getAttribute('style');
15991
- prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : '') + collection[index].listStyle);
16036
+ prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : ''));
15992
16037
  pLevel = collection[index].nestedLevel;
15993
16038
  listCount++;
15994
16039
  }
15995
16040
  return root;
15996
16041
  }
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
16042
  getListContent(elem) {
16007
16043
  let pushContent = '';
16008
16044
  const firstChild = elem.firstElementChild;
@@ -17310,8 +17346,9 @@ class HtmlEditor {
17310
17346
  if (this.rangeElement.tagName === 'OL' || this.rangeElement.tagName === 'UL') {
17311
17347
  const liElement = this.getRangeLiNode(currentRange.startContainer);
17312
17348
  if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
17313
- this.oldRangeElement = liElement.previousElementSibling.lastElementChild;
17314
- if (!isNullOrUndefined(liElement.lastElementChild)) {
17349
+ this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
17350
+ liElement.previousElementSibling : liElement.previousElementSibling.lastElementChild;
17351
+ if (!isNullOrUndefined(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR') {
17315
17352
  this.rangeElement = liElement.lastElementChild;
17316
17353
  isLiElement = true;
17317
17354
  }
@@ -20246,7 +20283,8 @@ class Image {
20246
20283
  }
20247
20284
  resizeImgDupPos(e) {
20248
20285
  this.imgDupPos = {
20249
- width: (e.style.width !== '') ? this.imgEle.style.width : e.width + 'px',
20286
+ width: (e.style.width !== '' && (this.parent.insertImageSettings &&
20287
+ !this.parent.insertImageSettings.resizeByPercent)) ? this.imgEle.style.width : e.width + 'px',
20250
20288
  height: (e.style.height !== '') ? this.imgEle.style.height : e.height + 'px'
20251
20289
  };
20252
20290
  }
@@ -20414,26 +20452,28 @@ class Image {
20414
20452
  const src = this.deletedImg[i].src;
20415
20453
  this.imageRemovePost(src);
20416
20454
  }
20417
- if (range.startContainer.nodeType === 3) {
20418
- if (originalEvent.code === 'Backspace') {
20419
- if (range.startContainer.previousElementSibling && range.startOffset === 0 &&
20420
- range.startContainer.previousElementSibling.classList.contains(CLS_CAPTION) &&
20421
- range.startContainer.previousElementSibling.classList.contains(CLS_CAPINLINE)) {
20422
- detach(range.startContainer.previousElementSibling);
20455
+ if (this.parent.editorMode !== 'Markdown') {
20456
+ if (range.startContainer.nodeType === 3) {
20457
+ if (originalEvent.code === 'Backspace') {
20458
+ if (range.startContainer.previousElementSibling && range.startOffset === 0 &&
20459
+ range.startContainer.previousElementSibling.classList.contains(CLS_CAPTION) &&
20460
+ range.startContainer.previousElementSibling.classList.contains(CLS_CAPINLINE)) {
20461
+ detach(range.startContainer.previousElementSibling);
20462
+ }
20423
20463
  }
20424
- }
20425
- else {
20426
- if (range.startContainer.nextElementSibling &&
20427
- range.endContainer.textContent.length === range.endOffset &&
20428
- range.startContainer.nextElementSibling.classList.contains(CLS_CAPTION) &&
20429
- range.startContainer.nextElementSibling.classList.contains(CLS_CAPINLINE)) {
20430
- detach(range.startContainer.nextElementSibling);
20464
+ else {
20465
+ if (range.startContainer.nextElementSibling &&
20466
+ range.endContainer.textContent.length === range.endOffset &&
20467
+ range.startContainer.nextElementSibling.classList.contains(CLS_CAPTION) &&
20468
+ range.startContainer.nextElementSibling.classList.contains(CLS_CAPINLINE)) {
20469
+ detach(range.startContainer.nextElementSibling);
20470
+ }
20431
20471
  }
20432
20472
  }
20433
- }
20434
- else if ((range.startContainer.nodeType === 1 &&
20435
- range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE))) {
20436
- detach(range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE));
20473
+ else if ((range.startContainer.nodeType === 1 &&
20474
+ range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE))) {
20475
+ detach(range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE));
20476
+ }
20437
20477
  }
20438
20478
  break;
20439
20479
  case 'insert-image':
@@ -23915,7 +23955,7 @@ __decorate$2([
23915
23955
  Property(null)
23916
23956
  ], PasteCleanupSettings.prototype, "deniedAttrs", void 0);
23917
23957
  __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'])
23958
+ 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
23959
  ], PasteCleanupSettings.prototype, "allowedStyleProps", void 0);
23920
23960
  __decorate$2([
23921
23961
  Property(null)
@@ -24301,7 +24341,7 @@ class EnterKeyAction {
24301
24341
  currentParent = this.startNode;
24302
24342
  }
24303
24343
  let currentParentLastChild = currentParent.lastChild;
24304
- while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text')) {
24344
+ while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text' || currentParentLastChild.nodeName === 'BR')) {
24305
24345
  currentParentLastChild = currentParentLastChild.lastChild;
24306
24346
  }
24307
24347
  const isLastNodeLength = this.range.startContainer === currentParentLastChild ?
@@ -24310,9 +24350,16 @@ class EnterKeyAction {
24310
24350
  this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
24311
24351
  this.range.startOffset === this.range.endOffset &&
24312
24352
  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);
24353
+ const focusBRElem = this.parent.createElement('br');
24354
+ if (currentParentLastChild.nodeName === 'BR' && currentParent.textContent.length === 0) {
24355
+ this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, currentParentLastChild);
24356
+ }
24357
+ else {
24358
+ const lineBreakBRElem = this.parent.createElement('br');
24359
+ this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, this.range.startContainer);
24360
+ this.parent.formatter.editorManager.domNode.insertAfter(lineBreakBRElem, this.range.startContainer);
24361
+ }
24362
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), focusBRElem, 0);
24316
24363
  }
24317
24364
  else if (!isNullOrUndefined(currentParent) && currentParent !== this.parent.inputElement && currentParent.nodeName !== 'BR') {
24318
24365
  if (currentParent.textContent.trim().length === 0 || (currentParent.textContent.trim().length === 1 &&
@@ -25333,7 +25380,7 @@ let RichTextEditor = class RichTextEditor extends Component {
25333
25380
  break;
25334
25381
  case 'width':
25335
25382
  this.setWidth(newProp[prop]);
25336
- if (this.toolbarSettings.enable) {
25383
+ if (this.toolbarSettings.enable && !this.inlineMode.enable) {
25337
25384
  this.toolbarModule.refreshToolbarOverflow();
25338
25385
  this.resizeHandler();
25339
25386
  }
@@ -26170,7 +26217,7 @@ let RichTextEditor = class RichTextEditor extends Component {
26170
26217
  this.isRTE = false;
26171
26218
  }
26172
26219
  this.notify(docClick, { args: e });
26173
- if (e.detail > 3) {
26220
+ if (Browser.info.name !== 'msie' && e.detail > 3) {
26174
26221
  e.preventDefault();
26175
26222
  }
26176
26223
  }