@syncfusion/ej2-richtexteditor 24.2.4 → 24.2.7

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 (89) hide show
  1. package/CHANGELOG.md +22 -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 +400 -150
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +393 -149
  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 +11 -11
  13. package/src/common/util.js +4 -1
  14. package/src/editor-manager/plugin/formats.d.ts +1 -0
  15. package/src/editor-manager/plugin/formats.js +37 -2
  16. package/src/editor-manager/plugin/inserthtml.js +15 -2
  17. package/src/editor-manager/plugin/lists.js +14 -1
  18. package/src/editor-manager/plugin/ms-word-clean-up.js +87 -18
  19. package/src/editor-manager/plugin/nodecutter.js +1 -1
  20. package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
  21. package/src/editor-manager/plugin/selection-commands.js +56 -1
  22. package/src/editor-manager/plugin/table.js +1 -1
  23. package/src/rich-text-editor/actions/base-quick-toolbar.js +2 -2
  24. package/src/rich-text-editor/actions/enter-key.js +2 -2
  25. package/src/rich-text-editor/actions/html-editor.js +25 -12
  26. package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
  27. package/src/rich-text-editor/actions/paste-clean-up.js +26 -5
  28. package/src/rich-text-editor/actions/toolbar-action.js +1 -1
  29. package/src/rich-text-editor/actions/toolbar.js +1 -1
  30. package/src/rich-text-editor/base/interface.d.ts +0 -8
  31. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +1 -1
  32. package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -1
  33. package/src/rich-text-editor/base/rich-text-editor.js +12 -2
  34. package/src/rich-text-editor/base/util.js +3 -0
  35. package/src/rich-text-editor/models/default-locale.js +2 -1
  36. package/src/rich-text-editor/renderer/iframe-content-renderer.js +1 -1
  37. package/src/rich-text-editor/renderer/image-module.js +3 -3
  38. package/src/rich-text-editor/renderer/table-module.d.ts +1 -0
  39. package/src/rich-text-editor/renderer/table-module.js +106 -98
  40. package/styles/bootstrap-dark.css +25 -9
  41. package/styles/bootstrap.css +25 -9
  42. package/styles/bootstrap4.css +30 -14
  43. package/styles/bootstrap5-dark.css +25 -9
  44. package/styles/bootstrap5.css +25 -9
  45. package/styles/fabric-dark.css +25 -9
  46. package/styles/fabric.css +25 -9
  47. package/styles/fluent-dark.css +27 -11
  48. package/styles/fluent.css +27 -11
  49. package/styles/highcontrast-light.css +25 -9
  50. package/styles/highcontrast.css +25 -9
  51. package/styles/material-dark.css +25 -9
  52. package/styles/material.css +25 -9
  53. package/styles/material3-dark.css +26 -10
  54. package/styles/material3.css +26 -10
  55. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +4 -2
  56. package/styles/rich-text-editor/_bootstrap-definition.scss +4 -2
  57. package/styles/rich-text-editor/_bootstrap4-definition.scss +8 -6
  58. package/styles/rich-text-editor/_bootstrap5-definition.scss +4 -2
  59. package/styles/rich-text-editor/_fabric-dark-definition.scss +4 -2
  60. package/styles/rich-text-editor/_fabric-definition.scss +4 -2
  61. package/styles/rich-text-editor/_fluent-definition.scss +5 -3
  62. package/styles/rich-text-editor/_fusionnew-definition.scss +4 -2
  63. package/styles/rich-text-editor/_highcontrast-definition.scss +4 -2
  64. package/styles/rich-text-editor/_highcontrast-light-definition.scss +4 -2
  65. package/styles/rich-text-editor/_layout.scss +35 -6
  66. package/styles/rich-text-editor/_material-dark-definition.scss +4 -2
  67. package/styles/rich-text-editor/_material-definition.scss +4 -2
  68. package/styles/rich-text-editor/_material3-definition.scss +5 -3
  69. package/styles/rich-text-editor/_tailwind-definition.scss +21 -19
  70. package/styles/rich-text-editor/_theme.scss +18 -3
  71. package/styles/rich-text-editor/bootstrap-dark.css +25 -9
  72. package/styles/rich-text-editor/bootstrap.css +25 -9
  73. package/styles/rich-text-editor/bootstrap4.css +30 -14
  74. package/styles/rich-text-editor/bootstrap5-dark.css +25 -9
  75. package/styles/rich-text-editor/bootstrap5.css +25 -9
  76. package/styles/rich-text-editor/fabric-dark.css +25 -9
  77. package/styles/rich-text-editor/fabric.css +25 -9
  78. package/styles/rich-text-editor/fluent-dark.css +27 -11
  79. package/styles/rich-text-editor/fluent.css +27 -11
  80. package/styles/rich-text-editor/highcontrast-light.css +25 -9
  81. package/styles/rich-text-editor/highcontrast.css +25 -9
  82. package/styles/rich-text-editor/material-dark.css +25 -9
  83. package/styles/rich-text-editor/material.css +25 -9
  84. package/styles/rich-text-editor/material3-dark.css +26 -10
  85. package/styles/rich-text-editor/material3.css +26 -10
  86. package/styles/rich-text-editor/tailwind-dark.css +68 -32
  87. package/styles/rich-text-editor/tailwind.css +68 -32
  88. package/styles/tailwind-dark.css +68 -32
  89. package/styles/tailwind.css +68 -32
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 24.2.4
3
+ * version : 24.2.7
4
4
  * Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-richtexteditor@*",
3
- "_id": "@syncfusion/ej2-richtexteditor@24.2.3",
3
+ "_id": "@syncfusion/ej2-richtexteditor@24.2.4",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-qjy4z7YGj17wCO4I5dW2kqGyRSaUxHXprYekBaF78kmtSAbFQjy8QFO9+15bOUEcNTPaTaPWHNvZ61Vm3+qOEw==",
5
+ "_integrity": "sha512-gxGUXVmOFE1abnbYaLzzX3FEGyT+H3uIhWIt0jS7DALyg61NbYz8XViClAoYz62KxDenDXYzu+HyP5bjpMc7gg==",
6
6
  "_location": "/@syncfusion/ej2-richtexteditor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -25,8 +25,8 @@
25
25
  "/@syncfusion/ej2-react-richtexteditor",
26
26
  "/@syncfusion/ej2-vue-richtexteditor"
27
27
  ],
28
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-24.2.3.tgz",
29
- "_shasum": "c6180082b7903ea03940e96f5911e093ee6fab92",
28
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-24.2.4.tgz",
29
+ "_shasum": "c1a662b91702ceddbdb9a858bae8cdccb2635ea7",
30
30
  "_spec": "@syncfusion/ej2-richtexteditor@*",
31
31
  "_where": "/jenkins/workspace/elease-automation_release_24.1.1/packages/included",
32
32
  "author": {
@@ -37,13 +37,13 @@
37
37
  },
38
38
  "bundleDependencies": false,
39
39
  "dependencies": {
40
- "@syncfusion/ej2-base": "~24.2.3",
41
- "@syncfusion/ej2-buttons": "~24.2.3",
42
- "@syncfusion/ej2-filemanager": "~24.2.3",
43
- "@syncfusion/ej2-inputs": "~24.2.4",
40
+ "@syncfusion/ej2-base": "~24.2.7",
41
+ "@syncfusion/ej2-buttons": "~24.2.7",
42
+ "@syncfusion/ej2-filemanager": "~24.2.7",
43
+ "@syncfusion/ej2-inputs": "~24.2.7",
44
44
  "@syncfusion/ej2-navigations": "~24.2.4",
45
- "@syncfusion/ej2-popups": "~24.2.3",
46
- "@syncfusion/ej2-splitbuttons": "~24.2.3"
45
+ "@syncfusion/ej2-popups": "~24.2.5",
46
+ "@syncfusion/ej2-splitbuttons": "~24.2.7"
47
47
  },
48
48
  "deprecated": false,
49
49
  "description": "Essential JS 2 RichTextEditor component",
@@ -69,6 +69,6 @@
69
69
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
70
70
  },
71
71
  "typings": "index.d.ts",
72
- "version": "24.2.4",
72
+ "version": "24.2.7",
73
73
  "sideEffects": false
74
74
  }
@@ -86,7 +86,7 @@ export function updateTextNode(value, enterAction) {
86
86
  tableElm[i].classList.add('e-rte-paste-table');
87
87
  if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
88
88
  tableElm[i].classList.remove('e-rte-paste-word-table');
89
- continue; // Sking the removal of the border if the source is from word.
89
+ continue; // Skiping the removal of the border if the source is from word.
90
90
  }
91
91
  else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
92
92
  tableElm[i].classList.remove('e-rte-paste-excel-table');
@@ -120,6 +120,9 @@ export function updateTextNode(value, enterAction) {
120
120
  }
121
121
  var imageElm = resultElm.querySelectorAll('img');
122
122
  for (var i = 0; i < imageElm.length; i++) {
123
+ if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
124
+ continue; // Should not add the class if the image is Broken.
125
+ }
123
126
  if (!imageElm[i].classList.contains('e-rte-image')) {
124
127
  imageElm[i].classList.add('e-rte-image');
125
128
  }
@@ -18,6 +18,7 @@ export declare class Formats {
18
18
  private addEventListener;
19
19
  private getParentNode;
20
20
  private onKeyUp;
21
+ private getBlockParent;
21
22
  private onKeyDown;
22
23
  private removeCodeContent;
23
24
  private deleteContent;
@@ -52,6 +52,14 @@ var Formats = /** @class */ (function () {
52
52
  }
53
53
  }
54
54
  };
55
+ Formats.prototype.getBlockParent = function (node, endNode) {
56
+ var currentParent;
57
+ while (node != endNode) {
58
+ currentParent = node;
59
+ node = node.parentElement;
60
+ }
61
+ return currentParent;
62
+ };
55
63
  Formats.prototype.onKeyDown = function (e) {
56
64
  if (e.event.which === 13) {
57
65
  var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
@@ -61,6 +69,8 @@ var Formats = /** @class */ (function () {
61
69
  ? range.endContainer : range.endContainer.parentElement;
62
70
  var preElem = closest(startCon, 'pre');
63
71
  var endPreElem = closest(endCon, 'pre');
72
+ var blockquoteEle = closest(startCon, 'blockquote');
73
+ var endBlockquoteEle = closest(endCon, 'blockquote');
64
74
  var liParent = !isNOU(preElem) && !isNOU(preElem.parentElement) && preElem.parentElement.tagName === 'LI';
65
75
  if (liParent) {
66
76
  return;
@@ -72,6 +82,17 @@ var Formats = /** @class */ (function () {
72
82
  range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
73
83
  this.parent.nodeSelection.setCursorPoint(this.parent.currentDocument, endCon, 0);
74
84
  }
85
+ if (e.event.which === 13 && ((!isNOU(blockquoteEle) && !isNOU(endBlockquoteEle)) || (!isNOU(blockquoteEle) && isNOU(endBlockquoteEle)))) {
86
+ var startParent = this.getBlockParent(range.startContainer, blockquoteEle);
87
+ if ((startParent.textContent.charCodeAt(0) === 8203 &&
88
+ startParent.textContent.length === 1) || startParent.textContent.length === 0) {
89
+ if (isNOU(startParent.nextSibling) && ((startParent.previousSibling.textContent.charCodeAt(0) === 8203 &&
90
+ startParent.previousSibling.textContent.length === 1) || startParent.previousSibling.textContent.length === 0)) {
91
+ e.event.preventDefault();
92
+ this.paraFocus(startParent.parentElement); //Revert from blockquotes while pressing enter key
93
+ }
94
+ }
95
+ }
75
96
  if (e.event.which === 13 && !isNOU(preElem) && !isNOU(endPreElem)) {
76
97
  e.event.preventDefault();
77
98
  this.deleteContent(range);
@@ -295,7 +316,7 @@ var Formats = /** @class */ (function () {
295
316
  replaceHTML = parentNode.innerHTML;
296
317
  }
297
318
  if ((e.subCommand.toLowerCase() === parentNode.tagName.toLowerCase() &&
298
- (e.subCommand.toLowerCase() !== 'pre' ||
319
+ (e.subCommand.toLowerCase() !== 'pre' && e.subCommand.toLowerCase() !== 'blockquote' ||
299
320
  (!isNOU(e.exeValue) && e.exeValue.name === 'dropDownSelect'))) ||
300
321
  isNOU(parentNode.parentNode) ||
301
322
  (parentNode.tagName === 'TABLE' && e.subCommand.toLowerCase() === 'pre')) {
@@ -304,7 +325,21 @@ var Formats = /** @class */ (function () {
304
325
  this.cleanFormats(parentNode, e.subCommand);
305
326
  var replaceNode = (e.subCommand.toLowerCase() === 'pre' && parentNode.tagName.toLowerCase() === 'pre') ?
306
327
  'p' : e.subCommand;
307
- var replaceTag = this.parent.domNode.createTagString(replaceNode, parentNode, replaceHTML.replace(/>\s+</g, '><'));
328
+ var isToggleBlockquoteList = e.subCommand.toLowerCase() === parentNode.tagName.toLowerCase() &&
329
+ e.subCommand.toLowerCase() === 'blockquote' && this.parent.domNode.isList(parentNode.firstElementChild);
330
+ var isToggleBlockquote = e.subCommand.toLowerCase() === parentNode.tagName.toLowerCase()
331
+ && e.subCommand.toLowerCase() === 'blockquote';
332
+ var replaceTag = void 0;
333
+ if (isToggleBlockquoteList) {
334
+ replaceTag = replaceHTML.replace(/>\s+</g, '><');
335
+ }
336
+ else if (isToggleBlockquote) {
337
+ var tagWrap = (e.enterAction == 'BR' || e.enterAction == 'P') ? 'P' : e.enterAction;
338
+ replaceTag = this.parent.domNode.createTagString(tagWrap, parentNode, replaceHTML.replace(/>\s+</g, '><'));
339
+ }
340
+ else {
341
+ replaceTag = this.parent.domNode.createTagString(replaceNode, parentNode, replaceHTML.replace(/>\s+</g, '><'));
342
+ }
308
343
  if (parentNode.tagName === 'LI') {
309
344
  parentNode.innerHTML = '';
310
345
  parentNode.insertAdjacentHTML('beforeend', replaceTag);
@@ -248,12 +248,17 @@ var InsertHtml = /** @class */ (function () {
248
248
  preNode.parentNode.replaceChild(fragment, preNode);
249
249
  }
250
250
  else {
251
+ var startContainerParent = range.startContainer.parentNode;
252
+ // Get the index of the start container among its siblings
253
+ var startIndex = Array.prototype.indexOf.call(startContainerParent.childNodes, range.startContainer);
251
254
  range.deleteContents();
255
+ range.setStart(startContainerParent, startIndex);
256
+ range.setEnd(startContainerParent, startIndex);
252
257
  if (!isNOU(lasNode)) {
253
258
  detach(lasNode);
254
259
  }
255
260
  // eslint-disable-next-line
256
- !isNOU(sibNode) ? sibNode.parentNode.appendChild(fragment) : editNode.appendChild(fragment);
261
+ !isNOU(sibNode) ? (sibNode.parentNode === editNode ? sibNode.appendChild(fragment) : sibNode.parentNode.appendChild(fragment)) : range.insertNode(fragment);
257
262
  }
258
263
  }
259
264
  else {
@@ -478,7 +483,15 @@ var InsertHtml = /** @class */ (function () {
478
483
  };
479
484
  InsertHtml.imageFocus = function (node, nodeSelection, docElement) {
480
485
  var focusNode = document.createTextNode(' ');
481
- node.parentNode.insertBefore(focusNode, node.nextSibling);
486
+ if (node.parentNode && node.parentNode.nodeName === 'A') {
487
+ var anchorTag = node.parentNode;
488
+ var parentNode = anchorTag.parentNode;
489
+ parentNode.insertBefore(focusNode, anchorTag.nextSibling);
490
+ parentNode.insertBefore(node, focusNode);
491
+ }
492
+ else {
493
+ node.parentNode.insertBefore(focusNode, node.nextSibling);
494
+ }
482
495
  nodeSelection.setSelectionText(docElement, node.nextSibling, node.nextSibling, 0, 0);
483
496
  };
484
497
  // eslint-disable-next-line
@@ -675,6 +675,9 @@ var Lists = /** @class */ (function () {
675
675
  isNOU(item) && nodes[i].parentNode.style.listStyleType !== '') {
676
676
  isRevert = false;
677
677
  }
678
+ if (nodes[i].parentNode.tagName === tagName && nodes[i].parentNode.style.listStyleType !== '') {
679
+ isRevert = true;
680
+ }
678
681
  }
679
682
  return isRevert;
680
683
  };
@@ -821,8 +824,18 @@ var Lists = /** @class */ (function () {
821
824
  if (CONSTANT.DEFAULT_TAG && 0 === element.querySelectorAll(CONSTANT.BLOCK_TAGS.join(', ')).length) {
822
825
  var wrapperclass = isNullOrUndefined(className) ? ' class="e-rte-wrap-inner"' :
823
826
  ' class="' + className + ' e-rte-wrap-inner"';
827
+ var parentElement = parentNode;
828
+ if (!isNOU(parentElement.style.listStyleType)) {
829
+ parentNode.style.removeProperty("list-style-type");
830
+ }
831
+ if (!isNOU(parentElement.style.listStyleImage)) {
832
+ parentNode.style.removeProperty("list-style-image");
833
+ }
834
+ if (parentElement.style.length === 0) {
835
+ parentNode.removeAttribute("style");
836
+ }
824
837
  var wrapper = '<' + CONSTANT.DEFAULT_TAG + wrapperclass +
825
- this.domNode.attributes(parentNode) + '></' + CONSTANT.DEFAULT_TAG + '>';
838
+ this.domNode.attributes(parentElement) + '></' + CONSTANT.DEFAULT_TAG + '>';
826
839
  if (e.enterAction !== 'BR') {
827
840
  this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
828
841
  }
@@ -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;
@@ -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;