@syncfusion/ej2-richtexteditor 24.2.4 → 24.2.8

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 (100) hide show
  1. package/CHANGELOG.md +34 -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 +669 -272
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +662 -269
  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/common/util.js +4 -1
  14. package/src/editor-manager/plugin/dom-node.js +3 -1
  15. package/src/editor-manager/plugin/format-painter-actions.d.ts +1 -0
  16. package/src/editor-manager/plugin/format-painter-actions.js +18 -0
  17. package/src/editor-manager/plugin/formats.d.ts +1 -0
  18. package/src/editor-manager/plugin/formats.js +37 -2
  19. package/src/editor-manager/plugin/inserthtml.js +15 -2
  20. package/src/editor-manager/plugin/lists.js +85 -63
  21. package/src/editor-manager/plugin/ms-word-clean-up.js +87 -18
  22. package/src/editor-manager/plugin/nodecutter.js +1 -1
  23. package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
  24. package/src/editor-manager/plugin/selection-commands.js +56 -1
  25. package/src/editor-manager/plugin/table.js +1 -1
  26. package/src/rich-text-editor/actions/base-quick-toolbar.js +4 -4
  27. package/src/rich-text-editor/actions/color-picker.d.ts +1 -0
  28. package/src/rich-text-editor/actions/color-picker.js +10 -0
  29. package/src/rich-text-editor/actions/enter-key.js +2 -2
  30. package/src/rich-text-editor/actions/html-editor.js +25 -12
  31. package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
  32. package/src/rich-text-editor/actions/paste-clean-up.js +26 -5
  33. package/src/rich-text-editor/actions/toolbar-action.js +1 -1
  34. package/src/rich-text-editor/actions/toolbar.js +4 -1
  35. package/src/rich-text-editor/base/constant.d.ts +5 -0
  36. package/src/rich-text-editor/base/constant.js +5 -0
  37. package/src/rich-text-editor/base/interface.d.ts +0 -8
  38. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +1 -1
  39. package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -1
  40. package/src/rich-text-editor/base/rich-text-editor.js +33 -7
  41. package/src/rich-text-editor/base/util.js +3 -0
  42. package/src/rich-text-editor/models/default-locale.js +3 -2
  43. package/src/rich-text-editor/renderer/dialog-renderer.js +5 -1
  44. package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -1
  45. package/src/rich-text-editor/renderer/image-module.js +31 -10
  46. package/src/rich-text-editor/renderer/table-module.d.ts +4 -1
  47. package/src/rich-text-editor/renderer/table-module.js +200 -131
  48. package/src/rich-text-editor/renderer/toolbar-renderer.js +13 -13
  49. package/styles/bootstrap-dark.css +57 -22
  50. package/styles/bootstrap.css +61 -29
  51. package/styles/bootstrap4.css +48 -17
  52. package/styles/bootstrap5-dark.css +47 -18
  53. package/styles/bootstrap5.css +47 -18
  54. package/styles/fabric-dark.css +43 -12
  55. package/styles/fabric.css +43 -12
  56. package/styles/fluent-dark.css +51 -14
  57. package/styles/fluent.css +51 -14
  58. package/styles/highcontrast-light.css +43 -12
  59. package/styles/highcontrast.css +46 -12
  60. package/styles/material-dark.css +47 -12
  61. package/styles/material.css +47 -12
  62. package/styles/material3-dark.css +45 -14
  63. package/styles/material3.css +45 -14
  64. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +12 -10
  65. package/styles/rich-text-editor/_bootstrap-definition.scss +18 -16
  66. package/styles/rich-text-editor/_bootstrap4-definition.scss +8 -6
  67. package/styles/rich-text-editor/_bootstrap5-definition.scss +4 -2
  68. package/styles/rich-text-editor/_fabric-dark-definition.scss +4 -2
  69. package/styles/rich-text-editor/_fabric-definition.scss +4 -2
  70. package/styles/rich-text-editor/_fluent-definition.scss +5 -3
  71. package/styles/rich-text-editor/_fusionnew-definition.scss +4 -2
  72. package/styles/rich-text-editor/_highcontrast-definition.scss +4 -2
  73. package/styles/rich-text-editor/_highcontrast-light-definition.scss +4 -2
  74. package/styles/rich-text-editor/_layout.scss +46 -6
  75. package/styles/rich-text-editor/_material-dark-definition.scss +4 -2
  76. package/styles/rich-text-editor/_material-definition.scss +4 -2
  77. package/styles/rich-text-editor/_material3-definition.scss +6 -4
  78. package/styles/rich-text-editor/_tailwind-definition.scss +21 -19
  79. package/styles/rich-text-editor/_theme.scss +65 -16
  80. package/styles/rich-text-editor/bootstrap-dark.css +57 -22
  81. package/styles/rich-text-editor/bootstrap.css +61 -29
  82. package/styles/rich-text-editor/bootstrap4.css +48 -17
  83. package/styles/rich-text-editor/bootstrap5-dark.css +47 -18
  84. package/styles/rich-text-editor/bootstrap5.css +47 -18
  85. package/styles/rich-text-editor/fabric-dark.css +43 -12
  86. package/styles/rich-text-editor/fabric.css +43 -12
  87. package/styles/rich-text-editor/fluent-dark.css +51 -14
  88. package/styles/rich-text-editor/fluent.css +51 -14
  89. package/styles/rich-text-editor/highcontrast-light.css +43 -12
  90. package/styles/rich-text-editor/highcontrast.css +46 -12
  91. package/styles/rich-text-editor/material-dark.css +47 -12
  92. package/styles/rich-text-editor/material.css +47 -12
  93. package/styles/rich-text-editor/material3-dark.css +45 -14
  94. package/styles/rich-text-editor/material3.css +45 -14
  95. package/styles/rich-text-editor/tailwind-dark.css +98 -35
  96. package/styles/rich-text-editor/tailwind.css +98 -35
  97. package/styles/tailwind-dark.css +98 -35
  98. package/styles/tailwind.css +98 -35
  99. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +0 -41
  100. package/.github/PULL_REQUEST_TEMPLATE/Feature.md +0 -27
@@ -1,5 +1,5 @@
1
1
  import * as EVENTS from '../../common/constant';
2
- import { createElement, isNullOrUndefined as isNOU, detach } from '@syncfusion/ej2-base';
2
+ import { createElement, isNullOrUndefined as isNOU, detach, addClass } from '@syncfusion/ej2-base';
3
3
  import { PASTE_SOURCE } from '../base/constant';
4
4
  /**
5
5
  * PasteCleanup for MsWord content
@@ -68,7 +68,6 @@ var MsWordPaste = /** @class */ (function () {
68
68
  if (patern.test(tempHTMLContent) || patern2.test(tempHTMLContent) || patern3.test(tempHTMLContent) ||
69
69
  pattern4.test(tempHTMLContent)) {
70
70
  var source = this.findSource(elm);
71
- this.imageConversion(elm, rtfData);
72
71
  tempHTMLContent = tempHTMLContent.replace(/<img[^>]+>/i, '');
73
72
  this.addListClass(elm);
74
73
  listNodes = this.cleanUp(elm, listNodes);
@@ -76,6 +75,7 @@ var MsWordPaste = /** @class */ (function () {
76
75
  listNodes[0].parentElement.tagName !== 'OL') {
77
76
  this.listConverter(listNodes);
78
77
  }
78
+ this.imageConversion(elm, rtfData);
79
79
  this.cleanList(elm, 'UL');
80
80
  this.cleanList(elm, 'OL');
81
81
  this.styleCorrection(elm, wordPasteStyleConfig);
@@ -84,11 +84,11 @@ var MsWordPaste = /** @class */ (function () {
84
84
  this.removeEmptyElements(elm);
85
85
  this.removeEmptyAnchorTag(elm);
86
86
  this.breakLineAddition(elm);
87
+ this.processMargin(elm);
87
88
  this.removeClassName(elm);
88
89
  if (pattern4.test(tempHTMLContent)) {
89
90
  this.addTableBorderClass(elm);
90
91
  }
91
- this.processMargin(elm);
92
92
  e.callBack(elm.innerHTML, this.cropImageDimensions, source);
93
93
  }
94
94
  else {
@@ -159,8 +159,9 @@ var MsWordPaste = /** @class */ (function () {
159
159
  imgElem[i].getAttribute('v:shapes').indexOf('Graphic') < 0 &&
160
160
  imgElem[i].getAttribute('v:shapes').indexOf('_x0000_s') < 0 &&
161
161
  imgElem[i].getAttribute('v:shapes').indexOf('_x0000_i') < 0) {
162
- detach(imgElem[i]);
162
+ imgElem[i].classList.add('e-rte-image-unsupported');
163
163
  }
164
+ imgElem[i].removeAttribute('v:shapes');
164
165
  }
165
166
  imgElem = elm.querySelectorAll('img');
166
167
  var imgSrc = [];
@@ -190,6 +191,7 @@ var MsWordPaste = /** @class */ (function () {
190
191
  });
191
192
  }
192
193
  }
194
+ imgElem = elm.querySelectorAll('img:not(.e-rte-image-unsupported');
193
195
  for (var i = 0; i < imgElem.length; i++) {
194
196
  if (imgSrc[i].match(linkRegex)) {
195
197
  imgElem[i].setAttribute('src', imgSrc[i]);
@@ -200,7 +202,7 @@ var MsWordPaste = /** @class */ (function () {
200
202
  }
201
203
  else {
202
204
  imgElem[i].removeAttribute('src');
203
- imgElem[i].setAttribute('alt', 'Unsupported file format');
205
+ imgElem[i].classList.add('e-rte-image-unsupported');
204
206
  }
205
207
  if (!isNOU(base64Src[i]) && base64Src[i].isCroppedImage) {
206
208
  imgElem[i].classList.add('e-img-cropped');
@@ -208,6 +210,10 @@ var MsWordPaste = /** @class */ (function () {
208
210
  }
209
211
  imgElem[i].setAttribute('id', 'msWordImg-' + imgName[i]);
210
212
  }
213
+ imgElem = elm.querySelectorAll('.e-rte-image-unsupported');
214
+ for (var i = 0; i < imgElem.length; i++) {
215
+ imgElem[i].removeAttribute('src');
216
+ }
211
217
  }
212
218
  };
213
219
  MsWordPaste.prototype.checkVShape = function (elm) {
@@ -281,6 +287,9 @@ var MsWordPaste = /** @class */ (function () {
281
287
  var result = [];
282
288
  if (!isNOU(fullImg)) {
283
289
  for (var i = 0; i < fullImg.length; i++) {
290
+ if (fullImg[i].indexOf('fIsBullet') !== -1 && fullImg[i].indexOf('wzName') === -1) {
291
+ continue;
292
+ }
284
293
  var isCroppedImage = false;
285
294
  var goalWidth = 0;
286
295
  var goalHeight = 0;
@@ -295,7 +304,7 @@ var MsWordPaste = /** @class */ (function () {
295
304
  else if (fullImg[i].indexOf('\\jpegblip') !== -1) {
296
305
  imgType = 'image/jpeg';
297
306
  }
298
- else if (fullImg[i].indexOf('\\picprop') !== -1) {
307
+ else if (fullImg[i].indexOf('\\emfblip') !== -1) {
299
308
  imgType = null;
300
309
  }
301
310
  else {
@@ -335,7 +344,7 @@ var MsWordPaste = /** @class */ (function () {
335
344
  return parseInt(result, 10);
336
345
  };
337
346
  MsWordPaste.prototype.removeClassName = function (elm) {
338
- var elmWithClass = elm.querySelectorAll('*[class]:not(.e-img-cropped)');
347
+ var elmWithClass = elm.querySelectorAll('*[class]:not(.e-img-cropped):not(.e-rte-image-unsupported)');
339
348
  for (var i = 0; i < elmWithClass.length; i++) {
340
349
  elmWithClass[i].removeAttribute('class');
341
350
  }
@@ -608,6 +617,7 @@ var MsWordPaste = /** @class */ (function () {
608
617
  MsWordPaste.prototype.listConverter = function (listNodes) {
609
618
  var level;
610
619
  var data = [];
620
+ var listFormatOverride;
611
621
  var collection = [];
612
622
  var content = '';
613
623
  var stNode;
@@ -629,6 +639,17 @@ var MsWordPaste = /** @class */ (function () {
629
639
  else {
630
640
  level = 1;
631
641
  }
642
+ if (content && content.indexOf('mso-list:') !== -1) {
643
+ var msoListValue = void 0;
644
+ if (content.match(/mso-list:[^;]+;?/)) {
645
+ var changedContent = content.replace('\n', '').split(' ').join('');
646
+ msoListValue = changedContent.match(/mso-list:[^;]+;?/)[0].split(':l');
647
+ listFormatOverride = isNOU(msoListValue) ? null : parseInt(msoListValue[1].split('level')[0], 10);
648
+ }
649
+ else {
650
+ listFormatOverride = null;
651
+ }
652
+ }
632
653
  this.listContents = [];
633
654
  this.getListContent(listNodes[i]);
634
655
  var type = void 0;
@@ -664,9 +685,9 @@ var MsWordPaste = /** @class */ (function () {
664
685
  startAttr = this.lowerGreekNumber.indexOf(this.listContents[0].split('.')[0]) + 1;
665
686
  }
666
687
  }
667
- if (listNodes[i].style.marginLeft !== '') {
668
- styleMarginLeft = listNodes[i].style.marginLeft;
669
- }
688
+ }
689
+ if (listNodes[i].style.marginLeft !== '') {
690
+ styleMarginLeft = listNodes[i].style.marginLeft;
670
691
  }
671
692
  var tempNode = [];
672
693
  for (var j = 1; j < this.listContents.length; j++) {
@@ -682,7 +703,8 @@ var MsWordPaste = /** @class */ (function () {
682
703
  currentListStyle = listNodes[i].getAttribute('style');
683
704
  }
684
705
  collection.push({
685
- listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
706
+ listType: type, content: tempNode, nestedLevel: level,
707
+ listFormatOverride: listFormatOverride, class: currentClassName,
686
708
  listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft
687
709
  });
688
710
  }
@@ -755,6 +777,7 @@ var MsWordPaste = /** @class */ (function () {
755
777
  var prevList;
756
778
  var listCount = 0;
757
779
  var elem;
780
+ var lfo = collection[0].listFormatOverride;
758
781
  for (var index = 0; index < collection.length; index++) {
759
782
  var listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
760
783
  var isNormalList = false;
@@ -771,16 +794,24 @@ var MsWordPaste = /** @class */ (function () {
771
794
  }
772
795
  var pElement = createElement('p', { className: 'MsoNormal' });
773
796
  pElement.innerHTML = collection[index].content.join(' ');
774
- if ((collection[index].nestedLevel === 1) && listCount === 0 && collection[index].content) {
797
+ if ((collection[index].nestedLevel === 1) &&
798
+ (listCount === 0 || lfo !== collection[index].listFormatOverride) &&
799
+ collection[index].content) {
775
800
  root.appendChild(temp = createElement(collection[index].listType, { className: collection[index].class }));
776
801
  prevList = createElement('li');
777
802
  prevList.appendChild(pElement);
778
803
  temp.appendChild(prevList);
779
804
  temp.setAttribute('level', collection[index].nestedLevel.toString());
780
- temp.style.marginLeft = collection[index].styleMarginLeft;
805
+ if (collection[index].class !== 'msolistparagraph') {
806
+ temp.style.marginLeft = collection[index].styleMarginLeft;
807
+ }
808
+ else {
809
+ addClass([temp], 'marginLeftIgnore');
810
+ }
781
811
  temp.style.listStyleType = collection[index].listStyleTypeName;
782
812
  }
783
- else if (collection[index].nestedLevel === pLevel) {
813
+ else if (collection[index].nestedLevel === pLevel &&
814
+ lfo === collection[index].listFormatOverride) {
784
815
  if (!isNOU(prevList) && !isNOU(prevList.parentElement)
785
816
  && prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
786
817
  prevList.parentElement.appendChild(prevList = createElement('li'));
@@ -843,6 +874,12 @@ var MsWordPaste = /** @class */ (function () {
843
874
  prevList.appendChild(pElement);
844
875
  temp.appendChild(prevList);
845
876
  temp.setAttribute('level', collection[index].nestedLevel.toString());
877
+ if (collection[index].class !== 'msolistparagraph') {
878
+ temp.style.marginLeft = collection[index].styleMarginLeft;
879
+ }
880
+ else {
881
+ addClass([temp], 'marginLeftIgnore');
882
+ }
846
883
  temp.style.listStyleType = collection[index].listStyleTypeName;
847
884
  }
848
885
  }
@@ -866,14 +903,34 @@ var MsWordPaste = /** @class */ (function () {
866
903
  elem = elem.parentElement;
867
904
  if (elem.attributes.getNamedItem('level')) {
868
905
  // eslint-disable-next-line
869
- if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel) {
906
+ if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel &&
907
+ lfo === collection[index].listFormatOverride) {
870
908
  prevList = createElement('li');
871
909
  prevList.appendChild(pElement);
872
910
  elem.appendChild(prevList);
873
911
  break;
874
912
  // eslint-disable-next-line
875
913
  }
876
- else if (collection[index].nestedLevel > parseInt(elem.attributes.getNamedItem('level').textContent, null)) {
914
+ else if (parseInt(elem.attributes.getNamedItem('level').textContent, null) === collection[index].nestedLevel &&
915
+ lfo !== collection[index].listFormatOverride) {
916
+ temp = createElement(collection[index].listType);
917
+ prevList = createElement('li');
918
+ temp.appendChild(prevList);
919
+ if (collection[index].nestedLevel > 1) {
920
+ for (var k = 0; k < collection[index].nestedLevel - 1; k++) {
921
+ prevList.appendChild(temp = createElement(collection[index].listType));
922
+ prevList = createElement('li');
923
+ temp.appendChild(prevList);
924
+ temp.style.listStyleType = 'none';
925
+ }
926
+ }
927
+ prevList.appendChild(pElement);
928
+ elem.appendChild(temp);
929
+ temp.setAttribute('level', collection[index].nestedLevel.toString());
930
+ temp.style.listStyleType = collection[index].listStyleTypeName;
931
+ break;
932
+ }
933
+ else if (collection[index].nestedLevel > parseInt(elem.attributes.getNamedItem('level').textContent, 10)) {
877
934
  elem.appendChild(temp = createElement(collection[index].listType));
878
935
  prevList = createElement('li');
879
936
  prevList.appendChild(pElement);
@@ -889,8 +946,9 @@ var MsWordPaste = /** @class */ (function () {
889
946
  prevList.setAttribute('class', collection[index].class);
890
947
  prevList.setAttribute('style', (!isNOU(collection[index].listStyle) ? collection[index].listStyle : ''));
891
948
  pLevel = collection[index].nestedLevel;
949
+ lfo = collection[index].listFormatOverride;
892
950
  listCount++;
893
- if (!isNOU(collection[index].start)) {
951
+ if (!isNOU(collection[index].start && collection[index].start !== 1 && collection[index].listType === 'ol')) {
894
952
  temp.setAttribute('start', collection[index].start.toString());
895
953
  }
896
954
  }
@@ -927,7 +985,7 @@ var MsWordPaste = /** @class */ (function () {
927
985
  var liChildren = element.querySelectorAll('li');
928
986
  if (liChildren.length > 0) {
929
987
  for (var i = 0; i < liChildren.length; i++) {
930
- if (!isNOU((liChildren[i]).style.marginLeft)) {
988
+ if (!isNOU((liChildren[i]).style.marginLeft) && !liChildren[i].parentElement.classList.contains('marginLeftIgnore')) {
931
989
  (liChildren[i]).style.marginLeft = '';
932
990
  }
933
991
  }
@@ -941,6 +999,17 @@ var MsWordPaste = /** @class */ (function () {
941
999
  }
942
1000
  }
943
1001
  }
1002
+ var ignoredNode = element.querySelectorAll('.marginLeftIgnore li');
1003
+ if (ignoredNode.length > 0) {
1004
+ for (var i = 0; i < ignoredNode.length; i++) {
1005
+ if (!isNOU((ignoredNode[i]).style.marginLeft) && (ignoredNode[i]).style.marginLeft !== '') {
1006
+ var marginLeft = (ignoredNode[i]).style.marginLeft;
1007
+ var marginLeftValue = parseFloat(marginLeft.split('in')[0]);
1008
+ var result = marginLeftValue - 0.5;
1009
+ (ignoredNode[i]).style.marginLeft = result.toString() + 'in';
1010
+ }
1011
+ }
1012
+ }
944
1013
  };
945
1014
  MsWordPaste.prototype.removeEmptyAnchorTag = function (element) {
946
1015
  var removableElement = element.querySelectorAll('a:not([href])');
@@ -125,7 +125,7 @@ var NodeCutter = /** @class */ (function () {
125
125
  else if (len > -1) {
126
126
  this.spliceEmptyNode(fragment.childNodes[0], isStart);
127
127
  }
128
- else if (fragment.nodeType !== 3 && fragment.nodeType !== 11 && fragment.nodeName !== 'IMG' && !(fragment.classList.contains('e-video-wrap')) && !(fragment.classList.contains('e-audio-wrap'))) {
128
+ else if (fragment.nodeType !== 3 && fragment.nodeType !== 11 && fragment.nodeName !== 'IMG' && !(fragment.querySelectorAll('img').length > 0) && !(fragment.classList.contains('e-video-wrap')) && !(fragment.classList.contains('e-audio-wrap'))) {
129
129
  fragment.parentNode.removeChild(fragment);
130
130
  }
131
131
  return fragment;
@@ -29,4 +29,5 @@ export declare class SelectionCommands {
29
29
  private static updateStyles;
30
30
  private static insertFormatPainterElem;
31
31
  private static formatPainterCleanup;
32
+ private static concatenateTextExcludingList;
32
33
  }
@@ -38,6 +38,29 @@ var SelectionCommands = /** @class */ (function () {
38
38
  var nodeCutter = new NodeCutter();
39
39
  var isFormatted = new IsFormatted();
40
40
  var range = domSelection.getRange(docElement);
41
+ var currentAnchorNode = range.startContainer.parentElement;
42
+ if (range.collapsed && !isNOU(currentAnchorNode) &&
43
+ currentAnchorNode.tagName === 'A' &&
44
+ (range.startOffset === currentAnchorNode.textContent.length || range.startOffset === 0)) {
45
+ var emptyTextNode = document.createTextNode('');
46
+ if (range.startOffset === 0) {
47
+ currentAnchorNode.parentNode.insertBefore(emptyTextNode, currentAnchorNode);
48
+ }
49
+ else {
50
+ if (!isNOU(currentAnchorNode.nextSibling)) {
51
+ currentAnchorNode.parentElement.insertBefore(emptyTextNode, currentAnchorNode.nextSibling);
52
+ }
53
+ else {
54
+ currentAnchorNode.parentNode.appendChild(emptyTextNode);
55
+ }
56
+ }
57
+ // Set the range to the empty text node
58
+ var newRange = docElement.createRange();
59
+ range.setStart(emptyTextNode, 0);
60
+ range.setEnd(emptyTextNode, 0);
61
+ range.collapse(true);
62
+ domSelection.setRange(docElement, newRange);
63
+ }
41
64
  if (Browser.userAgent.indexOf('Firefox') !== -1 && range.startContainer === range.endContainer && !isNOU(endNode) && range.startContainer === endNode) {
42
65
  var startChildNodes = range.startContainer.childNodes;
43
66
  var startNode = ((startChildNodes[(range.startOffset > 0) ? (range.startOffset - 1) :
@@ -413,7 +436,10 @@ var SelectionCommands = /** @class */ (function () {
413
436
  }
414
437
  var num = index;
415
438
  var liChildContent = '';
416
- while (num >= 0 && !isNOU(liElement) && liElement.tagName.toLowerCase() === 'li' && liElement.textContent.replace('/\u200B/g', '').trim().includes(nodes[num].textContent.trim())) {
439
+ /* eslint-disable security/detect-object-injection */
440
+ while (num >= 0 && !isNOU(liElement) && liElement.tagName.toLowerCase() === 'li' && liElement.contains(nodes[num]) &&
441
+ liElement.textContent.replace('/\u200B/g', '').trim().includes(nodes[num].textContent.trim())) {
442
+ /* eslint-enable security/detect-object-injection */
417
443
  liChildContent = ' ' + nodes[num].textContent.trim() + liChildContent;
418
444
  num--;
419
445
  }
@@ -485,6 +511,23 @@ var SelectionCommands = /** @class */ (function () {
485
511
  parentElement = parentElement.parentElement;
486
512
  liElement = parentElement;
487
513
  }
514
+ if (format === 'fontcolor') {
515
+ var parentElem = nodes[index].parentElement;
516
+ if (!isNOU(parentElem) && parentElem.childNodes) {
517
+ for (var i = 0; i < parentElem.childNodes.length; i++) {
518
+ if (this.concatenateTextExcludingList(nodes, index) === nodes[index].textContent) {
519
+ if (parentElem.tagName === 'LI') {
520
+ parentElem.style.color = value;
521
+ }
522
+ }
523
+ // eslint-disable-next-line
524
+ var childElement = parentElem.childNodes[i];
525
+ if (childElement.tagName === 'OL' || childElement.tagName === 'UL') {
526
+ childElement.style.color = 'initial';
527
+ }
528
+ }
529
+ }
530
+ }
488
531
  if (!isNOU(liElement) && liElement.tagName.toLowerCase() === 'li' &&
489
532
  liElement.textContent.trim() === nodes[index].textContent.trim()) {
490
533
  if (format === 'fontsize') {
@@ -784,6 +827,18 @@ var SelectionCommands = /** @class */ (function () {
784
827
  }
785
828
  }
786
829
  };
830
+ SelectionCommands.concatenateTextExcludingList = function (nodes, index) {
831
+ var result = '';
832
+ var parentNode = nodes[index].parentElement;
833
+ for (var i = 0; i < parentNode.childNodes.length; i++) {
834
+ // eslint-disable-next-line
835
+ var childNode = parentNode.childNodes[i];
836
+ if ((childNode.nodeType === 3) || (childNode.nodeType === 1 && (childNode.tagName !== 'OL' && childNode.tagName !== 'UL'))) {
837
+ result += childNode.textContent;
838
+ }
839
+ }
840
+ return result;
841
+ };
787
842
  SelectionCommands.enterAction = 'P';
788
843
  return SelectionCommands;
789
844
  }());
@@ -538,7 +538,7 @@ var TableCommand = /** @class */ (function () {
538
538
  var eleArray = elements;
539
539
  //eslint-disable-next-line
540
540
  if (min < (max = Math.min(max, eleArray[0].length - 1))) {
541
- for (colIndex === min; colIndex <= max; colIndex++) {
541
+ for (colIndex = min; colIndex <= max; colIndex++) {
542
542
  // eslint-disable-next-line
543
543
  if (!(min < colIndex && eleArray[0][colIndex] === eleArray[0][colIndex - 1]) && 1 < (index =
544
544
  Math.min(parseInt(eleArray[0][colIndex].getAttribute('colspan'), 10) || 1, max - min + 1)) &&
@@ -79,7 +79,7 @@ var BaseQuickToolbar = /** @class */ (function () {
79
79
  e.target.classList.contains('e-imgbreak')) ? false : true;
80
80
  var target = !isNOU(imgWrapper) ? imgWrapper : e.target;
81
81
  addClass([this.toolbarElement], [classes.CLS_RM_WHITE_SPACE]);
82
- var targetOffsetTop = target.offsetTop;
82
+ var targetOffsetTop = (target.classList.contains("e-rte-audio")) ? target.parentElement.offsetTop : target.offsetTop;
83
83
  var parentOffsetTop = window.pageYOffset + e.parentData.top;
84
84
  if ((targetOffsetTop - e.editTop) > e.popHeight) {
85
85
  y = parentOffsetTop + e.tBarElementHeight + (targetOffsetTop - e.editTop) - e.popHeight - 5;
@@ -92,7 +92,7 @@ var BaseQuickToolbar = /** @class */ (function () {
92
92
  }
93
93
  target = isAligned ? e.target : target;
94
94
  if (target.offsetWidth > e.popWidth) {
95
- x = (target.offsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + target.offsetLeft;
95
+ x = (target.offsetWidth / 2) - (e.popWidth / 2) + e.parentData.left + ((target.classList.contains("e-rte-audio")) ? target.parentElement.offsetLeft : target.offsetLeft);
96
96
  }
97
97
  else {
98
98
  x = e.parentData.left + target.offsetLeft;
@@ -264,9 +264,9 @@ var BaseQuickToolbar = /** @class */ (function () {
264
264
  parentData: parent_1.getBoundingClientRect(),
265
265
  tBarElementHeight: tBarHeight
266
266
  };
267
- if (target.tagName === 'IMG' || target.tagName === 'AUDIO' || target.tagName === 'VIDEO' || target.tagName === 'IFRAME' || (target.classList &&
267
+ if ((target.tagName === 'IMG' || target.tagName === 'AUDIO' || target.tagName === 'VIDEO' || target.tagName === 'IFRAME' || (target.classList &&
268
268
  (target.classList.contains(classes.CLS_AUDIOWRAP) || target.classList.contains(classes.CLS_CLICKELEM) ||
269
- target.classList.contains(classes.CLS_VID_CLICK_ELEM)))) {
269
+ target.classList.contains(classes.CLS_VID_CLICK_ELEM)))) && (x == beforeQuickToolbarArgs.positionX || y == beforeQuickToolbarArgs.positionY)) {
270
270
  _this.setPosition(showPopupData);
271
271
  }
272
272
  if (!_this.parent.inlineMode.enable) {
@@ -39,6 +39,7 @@ export declare class ColorPickerInput {
39
39
  private setCssClass;
40
40
  private updateCss;
41
41
  protected addEventListener(): void;
42
+ private showColorPicker;
42
43
  private onPropertyChanged;
43
44
  protected removeEventListener(): void;
44
45
  }
@@ -170,6 +170,15 @@ var ColorPickerInput = /** @class */ (function () {
170
170
  this.parent.on(events.destroyColorPicker, this.destroyColorPicker, this);
171
171
  this.parent.on(events.modelChanged, this.onPropertyChanged, this);
172
172
  this.parent.on(events.bindCssClass, this.setCssClass, this);
173
+ this.parent.on(events.showColorPicker, this.showColorPicker, this);
174
+ };
175
+ ColorPickerInput.prototype.showColorPicker = function (e) {
176
+ if (!isNullOrUndefined(this.fontColorPicker) && (e.toolbarClick === "fontcolor")) {
177
+ this.fontColorDropDown.toggle();
178
+ }
179
+ else if (!isNullOrUndefined(this.backgroundColorPicker) && (e.toolbarClick === "backgroundcolor")) {
180
+ this.backgroundColorDropDown.toggle();
181
+ }
173
182
  };
174
183
  ColorPickerInput.prototype.onPropertyChanged = function (model) {
175
184
  var newProp = model.newProp;
@@ -243,6 +252,7 @@ var ColorPickerInput = /** @class */ (function () {
243
252
  this.parent.off(events.destroyColorPicker, this.destroyColorPicker);
244
253
  this.parent.off(events.modelChanged, this.onPropertyChanged);
245
254
  this.parent.off(events.bindCssClass, this.setCssClass);
255
+ this.parent.off(events.showColorPicker, this.showColorPicker);
246
256
  };
247
257
  return ColorPickerInput;
248
258
  }());
@@ -485,10 +485,10 @@ var EnterKeyAction = /** @class */ (function () {
485
485
  }
486
486
  var previousBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].previousSibling;
487
487
  var nextBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].nextSibling;
488
- if (!isNOU(previousBlockNode) && previousBlockNode.hasAttribute('style')) {
488
+ if (!isNOU(previousBlockNode) && previousBlockNode.hasAttribute('style') && previousBlockNode.nodeName !== 'TABLE') {
489
489
  insertElem.setAttribute('style', previousBlockNode.getAttribute('style'));
490
490
  }
491
- if (isNOU(previousBlockNode) && !isNOU(nextBlockNode) && nextBlockNode.hasAttribute('style')) {
491
+ if (isNOU(previousBlockNode) && !isNOU(nextBlockNode) && nextBlockNode.hasAttribute('style') && nextBlockNode.nodeName !== 'TABLE') {
492
492
  insertElem.setAttribute('style', nextBlockNode.getAttribute('style'));
493
493
  }
494
494
  return insertElem;
@@ -192,9 +192,12 @@ var HtmlEditor = /** @class */ (function () {
192
192
  var range = this.parent.getRange();
193
193
  // eslint-disable-next-line
194
194
  var regEx = new RegExp(String.fromCharCode(8203), 'g');
195
+ var isEmptyNode = range.startContainer === range.endContainer && range.startOffset === range.endOffset &&
196
+ range.startOffset === 1 && range.startContainer.textContent.length === 1 && range.startContainer.textContent.charCodeAt(0) == 8203 &&
197
+ range.startContainer.textContent.replace(regEx, '').length === 0;
195
198
  var pointer;
196
199
  var isRootParent = false;
197
- if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey) {
200
+ if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode) {
198
201
  pointer = range.startOffset;
199
202
  // eslint-disable-next-line @typescript-eslint/no-unused-expressions
200
203
  range.startContainer.nodeName === '#text' ? range.startContainer.parentElement !== this.parent.inputElement ? range.startContainer.parentElement.classList.add('currentStartMark')
@@ -317,8 +320,13 @@ var HtmlEditor = /** @class */ (function () {
317
320
  else {
318
321
  this.parent.notify(events.enterHandler, { args: e.args });
319
322
  var newRange = this.parent.getRange();
320
- if (!isNOU(newRange.startContainer) && newRange.startContainer === this.parent.inputElement.lastChild && newRange.startContainer.nodeName !== '#text' && this.parent.height !== 'auto') {
321
- newRange.startContainer.scrollIntoView({ block: "end", inline: "nearest" });
323
+ if (!isNullOrUndefined(newRange.startContainer) && this.parent.height !== 'auto' && newRange.startContainer.nodeName !== '#text'
324
+ && !this.parent.iframeSettings.enable && newRange.startContainer.getBoundingClientRect().bottom > this.parent.element.getBoundingClientRect().bottom) {
325
+ this.parent.element.querySelector('.e-rte-content').scrollTop += newRange.startContainer.getBoundingClientRect().bottom - this.parent.element.getBoundingClientRect().bottom;
326
+ }
327
+ else if (!isNullOrUndefined(newRange.startContainer) && this.parent.height === 'auto' && newRange.startContainer.nodeName !== '#text'
328
+ && !this.parent.iframeSettings.enable && window.innerHeight < newRange.startContainer.getBoundingClientRect().top) {
329
+ newRange.startContainer.scrollIntoView({ block: 'end', inline: 'nearest' });
322
330
  }
323
331
  }
324
332
  }
@@ -400,11 +408,13 @@ var HtmlEditor = /** @class */ (function () {
400
408
  currentRange.startContainer.previousSibling.nodeName === 'SPAN') {
401
409
  isPreviousNotContentEditable = currentRange.startContainer.previousSibling.contentEditable === 'false' ? false : true;
402
410
  }
411
+ var checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
412
+ var isSelectedPositionNotStart = closest(currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer, 'li') ?
413
+ checkNode.nodeName !== 'li' && isNOU(checkNode.previousSibling) : true;
403
414
  if (e.args.code === 'Backspace' && e.args.keyCode === 8 && currentRange.startOffset === 0 &&
404
415
  currentRange.endOffset === 0 && this.parent.getSelection().length === 0 && currentRange.startContainer.textContent.length > 0 &&
405
416
  currentRange.startContainer.parentElement.tagName !== 'TD' && currentRange.startContainer.parentElement.tagName !== 'TH' &&
406
- isPreviousNotContentEditable) {
407
- var checkNode = currentRange.startContainer.nodeName === '#text' ? currentRange.startContainer.parentElement : currentRange.startContainer;
417
+ isPreviousNotContentEditable && isSelectedPositionNotStart) {
408
418
  if ((!this.parent.formatter.editorManager.domNode.isBlockNode(checkNode) &&
409
419
  !isNOU(checkNode.previousSibling) && checkNode.previousSibling.nodeName === 'BR') ||
410
420
  (!isNOU(currentRange.startContainer.previousSibling) && currentRange.startContainer.previousSibling.nodeName === 'BR')) {
@@ -416,7 +426,8 @@ var HtmlEditor = /** @class */ (function () {
416
426
  if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
417
427
  this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
418
428
  liElement.previousElementSibling : liElement.previousElementSibling.lastElementChild;
419
- if (!isNullOrUndefined(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR') {
429
+ if (!isNOU(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR' &&
430
+ isNOU(liElement.lastElementChild.previousSibling)) {
420
431
  this.rangeElement = liElement.lastElementChild;
421
432
  isLiElement = true;
422
433
  }
@@ -426,13 +437,13 @@ var HtmlEditor = /** @class */ (function () {
426
437
  }
427
438
  }
428
439
  else if (this.rangeElement === this.parent.inputElement || this.rangeElement.tagName === 'TABLE' ||
429
- (!isNullOrUndefined(this.rangeElement.previousElementSibling) && this.rangeElement.previousElementSibling.tagName === 'TABLE')) {
440
+ (!isNOU(this.rangeElement.previousElementSibling) && this.rangeElement.previousElementSibling.tagName === 'TABLE')) {
430
441
  return;
431
442
  }
432
443
  else {
433
444
  this.oldRangeElement = this.rangeElement.previousElementSibling;
434
445
  }
435
- if (isNullOrUndefined(this.oldRangeElement)) {
446
+ if (isNOU(this.oldRangeElement)) {
436
447
  return;
437
448
  }
438
449
  else {
@@ -452,7 +463,7 @@ var HtmlEditor = /** @class */ (function () {
452
463
  if (this.oldRangeElement.querySelectorAll('BR').length === 1) {
453
464
  detach(this.oldRangeElement.querySelector('BR'));
454
465
  }
455
- if (!isNullOrUndefined(this.rangeElement) && this.oldRangeElement !== this.rangeElement) {
466
+ if (!isNOU(this.rangeElement) && this.oldRangeElement !== this.rangeElement) {
456
467
  while (this.rangeElement.firstChild) {
457
468
  this.oldRangeElement.appendChild(this.rangeElement.childNodes[0]);
458
469
  }
@@ -708,9 +719,11 @@ var HtmlEditor = /** @class */ (function () {
708
719
  this.tooltipTargetEle = closest(args.originalEvent.target, '[data-tooltip-id]');
709
720
  if (!isNOU(this.tooltipTargetEle) && this.parent.showTooltip && !isNOU(currentDocument.querySelector('.e-tooltip-wrap'))) {
710
721
  this.parent.notify(events.destroyTooltip, { args: event });
711
- this.tooltipTargetEle.setAttribute('data-title', this.tooltipTargetEle.getAttribute('title'));
712
- this.tooltipTargetEle.removeAttribute('title');
713
- EventHandler.add(this.tooltipTargetEle, 'mouseout', this.mouseOutHandler, this);
722
+ if (!this.tooltipTargetEle.closest('.e-rte-quick-popup')) {
723
+ this.tooltipTargetEle.setAttribute('data-title', this.tooltipTargetEle.getAttribute('title'));
724
+ this.tooltipTargetEle.removeAttribute('title');
725
+ EventHandler.add(this.tooltipTargetEle, 'mouseout', this.mouseOutHandler, this);
726
+ }
714
727
  }
715
728
  if (item.command !== 'FormatPainter') {
716
729
  if (closestElement && !closestElement.classList.contains('e-rte-inline-popup') && !closestElement.classList.contains('e-rte-text-popup')) {
@@ -55,6 +55,7 @@ export declare class PasteCleanup {
55
55
  private updateCss;
56
56
  private setCssClass;
57
57
  private destroyDialog;
58
+ private docClick;
58
59
  private cleanAppleClass;
59
60
  private formatting;
60
61
  private cropImageHandler;