@syncfusion/ej2-richtexteditor 24.2.9 → 25.1.35

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 (133) hide show
  1. package/CHANGELOG.md +18 -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 +908 -485
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +892 -474
  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 +13 -13
  13. package/src/common/config.d.ts +7 -0
  14. package/src/common/config.js +11 -0
  15. package/src/common/interface.d.ts +12 -0
  16. package/src/common/types.d.ts +6 -0
  17. package/src/editor-manager/plugin/dom-node.d.ts +5 -1
  18. package/src/editor-manager/plugin/dom-node.js +161 -12
  19. package/src/editor-manager/plugin/formats.js +1 -1
  20. package/src/editor-manager/plugin/image.js +12 -16
  21. package/src/editor-manager/plugin/inserthtml.d.ts +1 -0
  22. package/src/editor-manager/plugin/inserthtml.js +31 -0
  23. package/src/editor-manager/plugin/link.js +1 -1
  24. package/src/editor-manager/plugin/lists.js +24 -2
  25. package/src/editor-manager/plugin/ms-word-clean-up.js +65 -57
  26. package/src/editor-manager/plugin/selection-commands.js +52 -3
  27. package/src/editor-manager/plugin/table.js +18 -3
  28. package/src/editor-manager/plugin/toolbar-status.d.ts +2 -2
  29. package/src/editor-manager/plugin/toolbar-status.js +17 -9
  30. package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +3 -3
  31. package/src/rich-text-editor/actions/base-quick-toolbar.js +41 -10
  32. package/src/rich-text-editor/actions/base-toolbar.js +24 -30
  33. package/src/rich-text-editor/actions/dropdown-buttons.js +4 -4
  34. package/src/rich-text-editor/actions/emoji-picker.js +1 -1
  35. package/src/rich-text-editor/actions/enter-key.js +2 -1
  36. package/src/rich-text-editor/actions/full-screen.js +2 -2
  37. package/src/rich-text-editor/actions/html-editor.d.ts +0 -2
  38. package/src/rich-text-editor/actions/html-editor.js +8 -26
  39. package/src/rich-text-editor/actions/markdown-editor.js +3 -1
  40. package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
  41. package/src/rich-text-editor/actions/paste-clean-up.js +23 -0
  42. package/src/rich-text-editor/actions/quick-toolbar.d.ts +7 -0
  43. package/src/rich-text-editor/actions/quick-toolbar.js +23 -8
  44. package/src/rich-text-editor/actions/resize.js +2 -1
  45. package/src/rich-text-editor/actions/toolbar.d.ts +0 -2
  46. package/src/rich-text-editor/actions/toolbar.js +13 -85
  47. package/src/rich-text-editor/base/classes.d.ts +0 -5
  48. package/src/rich-text-editor/base/classes.js +0 -5
  49. package/src/rich-text-editor/base/constant.d.ts +5 -0
  50. package/src/rich-text-editor/base/constant.js +5 -0
  51. package/src/rich-text-editor/base/interface.d.ts +36 -2
  52. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +2 -2
  53. package/src/rich-text-editor/base/rich-text-editor.d.ts +4 -3
  54. package/src/rich-text-editor/base/rich-text-editor.js +81 -58
  55. package/src/rich-text-editor/base/util.js +8 -2
  56. package/src/rich-text-editor/models/default-locale.js +15 -12
  57. package/src/rich-text-editor/models/toolbar-settings-model.d.ts +1 -1
  58. package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
  59. package/src/rich-text-editor/models/toolbar-settings.js +1 -1
  60. package/src/rich-text-editor/renderer/iframe-content-renderer.js +2 -1
  61. package/src/rich-text-editor/renderer/image-module.d.ts +8 -1
  62. package/src/rich-text-editor/renderer/image-module.js +148 -155
  63. package/src/rich-text-editor/renderer/table-module.d.ts +2 -0
  64. package/src/rich-text-editor/renderer/table-module.js +71 -8
  65. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +3 -0
  66. package/src/rich-text-editor/renderer/toolbar-renderer.js +61 -2
  67. package/src/rich-text-editor/renderer/video-module.js +7 -4
  68. package/src/rich-text-editor/renderer/view-source.js +7 -4
  69. package/styles/bootstrap-dark.css +57 -17
  70. package/styles/bootstrap.css +58 -18
  71. package/styles/bootstrap4.css +58 -18
  72. package/styles/bootstrap5-dark.css +64 -17
  73. package/styles/bootstrap5.css +64 -17
  74. package/styles/fabric-dark.css +57 -17
  75. package/styles/fabric.css +58 -18
  76. package/styles/fluent-dark.css +57 -17
  77. package/styles/fluent.css +57 -17
  78. package/styles/highcontrast-light.css +57 -17
  79. package/styles/highcontrast.css +58 -18
  80. package/styles/material-dark.css +57 -17
  81. package/styles/material.css +57 -17
  82. package/styles/material3-dark.css +59 -19
  83. package/styles/material3.css +59 -19
  84. package/styles/rich-text-editor/_bds-definition.scss +279 -0
  85. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +1 -0
  86. package/styles/rich-text-editor/_bootstrap-definition.scss +1 -1
  87. package/styles/rich-text-editor/_bootstrap4-definition.scss +3 -2
  88. package/styles/rich-text-editor/_bootstrap5-definition.scss +1 -0
  89. package/styles/rich-text-editor/_fabric-dark-definition.scss +1 -0
  90. package/styles/rich-text-editor/_fabric-definition.scss +2 -1
  91. package/styles/rich-text-editor/_fluent-definition.scss +1 -0
  92. package/styles/rich-text-editor/_fusionnew-definition.scss +1 -0
  93. package/styles/rich-text-editor/_highcontrast-definition.scss +2 -1
  94. package/styles/rich-text-editor/_highcontrast-light-definition.scss +1 -0
  95. package/styles/rich-text-editor/_layout.scss +47 -13
  96. package/styles/rich-text-editor/_material-dark-definition.scss +1 -0
  97. package/styles/rich-text-editor/_material-definition.scss +1 -0
  98. package/styles/rich-text-editor/_material3-definition.scss +1 -0
  99. package/styles/rich-text-editor/_tailwind-definition.scss +4 -3
  100. package/styles/rich-text-editor/_theme.scss +18 -5
  101. package/styles/rich-text-editor/bootstrap-dark.css +57 -17
  102. package/styles/rich-text-editor/bootstrap.css +58 -18
  103. package/styles/rich-text-editor/bootstrap4.css +58 -18
  104. package/styles/rich-text-editor/bootstrap5-dark.css +64 -17
  105. package/styles/rich-text-editor/bootstrap5.css +64 -17
  106. package/styles/rich-text-editor/fabric-dark.css +57 -17
  107. package/styles/rich-text-editor/fabric.css +58 -18
  108. package/styles/rich-text-editor/fluent-dark.css +57 -17
  109. package/styles/rich-text-editor/fluent.css +57 -17
  110. package/styles/rich-text-editor/highcontrast-light.css +57 -17
  111. package/styles/rich-text-editor/highcontrast.css +58 -18
  112. package/styles/rich-text-editor/icons/_bds.scss +351 -0
  113. package/styles/rich-text-editor/icons/_bootstrap-dark.scss +7 -4
  114. package/styles/rich-text-editor/icons/_bootstrap.scss +7 -4
  115. package/styles/rich-text-editor/icons/_bootstrap4.scss +7 -4
  116. package/styles/rich-text-editor/icons/_bootstrap5.scss +7 -4
  117. package/styles/rich-text-editor/icons/_fabric-dark.scss +7 -4
  118. package/styles/rich-text-editor/icons/_fabric.scss +7 -4
  119. package/styles/rich-text-editor/icons/_fluent.scss +7 -4
  120. package/styles/rich-text-editor/icons/_highcontrast-light.scss +7 -4
  121. package/styles/rich-text-editor/icons/_highcontrast.scss +7 -4
  122. package/styles/rich-text-editor/icons/_material-dark.scss +7 -4
  123. package/styles/rich-text-editor/icons/_material.scss +7 -4
  124. package/styles/rich-text-editor/icons/_material3.scss +7 -4
  125. package/styles/rich-text-editor/icons/_tailwind.scss +7 -4
  126. package/styles/rich-text-editor/material-dark.css +57 -17
  127. package/styles/rich-text-editor/material.css +57 -17
  128. package/styles/rich-text-editor/material3-dark.css +59 -19
  129. package/styles/rich-text-editor/material3.css +59 -19
  130. package/styles/rich-text-editor/tailwind-dark.css +61 -21
  131. package/styles/rich-text-editor/tailwind.css +61 -21
  132. package/styles/tailwind-dark.css +61 -21
  133. package/styles/tailwind.css +61 -21
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 24.2.9
3
+ * version : 25.1.35
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.8",
3
+ "_id": "@syncfusion/ej2-richtexteditor@23.1.54",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-RiTlxXAeoPOeO3I9n1A4XHgDuna06LrHQgt08fEpnjhBE38mAzyH68yRzCtrUlVnoVqTPOvJJ83rLI2VDDlC1w==",
5
+ "_integrity": "sha512-PsphjMpa/0wW711Fuq+Qd4CDUY2UbDH56WhYjnk/8Tuv01Gj42/krKh44yI6yJYJRZq+Q47NErl/5FJUNT0Ozg==",
6
6
  "_location": "/@syncfusion/ej2-richtexteditor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -25,10 +25,10 @@
25
25
  "/@syncfusion/ej2-react-richtexteditor",
26
26
  "/@syncfusion/ej2-vue-richtexteditor"
27
27
  ],
28
- "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-24.2.8.tgz",
29
- "_shasum": "f966e83e1230cc284396b8ec962f1df25c80d5a9",
28
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-release/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-23.1.54.tgz",
29
+ "_shasum": "40d45ccccd6bc1a49e83e34d5f9d850b12fefc33",
30
30
  "_spec": "@syncfusion/ej2-richtexteditor@*",
31
- "_where": "/jenkins/workspace/elease-automation_release_24.1.1/packages/included",
31
+ "_where": "/jenkins/workspace/elease-automation_release_25.1.1/packages/included",
32
32
  "author": {
33
33
  "name": "Syncfusion Inc."
34
34
  },
@@ -37,13 +37,13 @@
37
37
  },
38
38
  "bundleDependencies": false,
39
39
  "dependencies": {
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.9",
44
- "@syncfusion/ej2-navigations": "~24.2.8",
45
- "@syncfusion/ej2-popups": "~24.2.9",
46
- "@syncfusion/ej2-splitbuttons": "~24.2.7"
40
+ "@syncfusion/ej2-base": "~25.1.35",
41
+ "@syncfusion/ej2-buttons": "~25.1.35",
42
+ "@syncfusion/ej2-filemanager": "~25.1.35",
43
+ "@syncfusion/ej2-inputs": "~25.1.35",
44
+ "@syncfusion/ej2-navigations": "~25.1.35",
45
+ "@syncfusion/ej2-popups": "~25.1.35",
46
+ "@syncfusion/ej2-splitbuttons": "~25.1.35"
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.9",
72
+ "version": "25.1.35",
73
73
  "sideEffects": false
74
74
  }
@@ -1,3 +1,4 @@
1
+ import { IImageResizeFactor } from "./interface";
1
2
  /**
2
3
  * Default Markdown formats config for adapter
3
4
  */
@@ -46,3 +47,9 @@ export declare const listConversionFilters: {
46
47
  * @hidden
47
48
  */
48
49
  export declare const selfClosingTags: string[];
50
+ /**
51
+ * Resize factor for image.
52
+ * @hidden
53
+ *
54
+ */
55
+ export declare const imageResizeFactor: IImageResizeFactor;
@@ -128,3 +128,14 @@ export var selfClosingTags = [
128
128
  'BR',
129
129
  'IMG'
130
130
  ];
131
+ /**
132
+ * Resize factor for image.
133
+ * @hidden
134
+ *
135
+ */
136
+ export var imageResizeFactor = {
137
+ topLeft: [-1, -1],
138
+ topRight: [1, -1],
139
+ botRight: [1, 1],
140
+ botLeft: [-1, 1]
141
+ };
@@ -77,3 +77,15 @@ export interface IToolbarStatus {
77
77
  numberFormatList?: string | boolean;
78
78
  bulletFormatList?: string | boolean;
79
79
  }
80
+ /**
81
+
82
+ * @private
83
+ *
84
+ *
85
+ * */
86
+ export interface IImageResizeFactor {
87
+ topLeft: [number, number];
88
+ topRight: [number, number];
89
+ botLeft: [number, number];
90
+ botRight: [number, number];
91
+ }
@@ -18,3 +18,9 @@ export declare type EnterKey = 'P' | 'DIV' | 'BR';
18
18
  * Defines tag to be used when shift + enter key is pressed.
19
19
  */
20
20
  export declare type ShiftEnterKey = 'P' | 'DIV' | 'BR';
21
+ /**
22
+ * Defines the types of action to be used in the Rich Text Editor.
23
+ * @hidden
24
+ * @private
25
+ */
26
+ export declare type ContentHeightSource = 'SourceCode' | 'Init' | 'Preview' | 'Maximize' | 'Minimize' | 'WindowResize' | 'Toolbar' | 'Resize' | 'Refresh';
@@ -317,10 +317,14 @@ export declare class DOMNode {
317
317
  /**
318
318
  * blockNodes method
319
319
  *
320
+ * @param {boolean} action - Optional Boolean that specifies the action is whether performed.
320
321
  * @returns {Node[]} - returns the node array values
321
322
  * @hidden
322
323
 
323
324
  */
324
- blockNodes(): Node[];
325
+ blockNodes(action?: boolean): Node[];
325
326
  private ignoreTableTag;
327
+ private getPreBlockNodeCollection;
328
+ private getClosestInlineParent;
329
+ private wrapWithBlockNode;
326
330
  }
@@ -670,11 +670,12 @@ var DOMNode = /** @class */ (function () {
670
670
  /**
671
671
  * blockNodes method
672
672
  *
673
+ * @param {boolean} action - Optional Boolean that specifies the action is whether performed.
673
674
  * @returns {Node[]} - returns the node array values
674
675
  * @hidden
675
676
 
676
677
  */
677
- DOMNode.prototype.blockNodes = function () {
678
+ DOMNode.prototype.blockNodes = function (action) {
678
679
  var collectionNodes = [];
679
680
  var selection = this.getSelection();
680
681
  if (this.isEditorArea() && selection.rangeCount) {
@@ -688,23 +689,46 @@ var DOMNode = /** @class */ (function () {
688
689
  collectionNodes.push(startNode);
689
690
  }
690
691
  parentNode = this.blockParentNode(startNode);
692
+ var endParentNode = this.blockParentNode(endNode);
691
693
  if (parentNode && collectionNodes.indexOf(parentNode) < 0) {
692
- if (CONSTANT.IGNORE_BLOCK_TAGS.indexOf(parentNode.tagName.toLocaleLowerCase()) >= 0 && (startNode.tagName === 'BR' ||
693
- startNode.nodeType === Node.TEXT_NODE ||
694
- startNode.classList.contains(markerClassName.startSelection) ||
695
- startNode.classList.contains(markerClassName.endSelection))) {
696
- var tempNode = startNode.previousSibling &&
697
- startNode.previousSibling.nodeType === Node.TEXT_NODE ?
698
- startNode.previousSibling : startNode;
699
- if (!startNode.nextSibling && !startNode.previousSibling && startNode.tagName === 'BR') {
700
- collectionNodes.push(tempNode);
694
+ if (!isNOU(action) && action) {
695
+ if (range.commonAncestorContainer.nodeName === 'TD' || parentNode.nodeName === 'TD' || endParentNode.nodeName === 'TD') {
696
+ var processedNodes = this.getPreBlockNodeCollection(range);
697
+ if (processedNodes.length > 1) {
698
+ this.wrapWithBlockNode(processedNodes, collectionNodes);
699
+ }
700
+ else if (processedNodes.length > 0) {
701
+ if (startNode !== endNode && startNode.nodeName !== 'BR') {
702
+ collectionNodes.push(this.createTempNode(startNode));
703
+ }
704
+ else if (startNode === endNode && startNode.nodeName === 'SPAN' && (startNode.classList.contains(markerClassName.startSelection)
705
+ || startNode.classList.contains(markerClassName.endSelection))) {
706
+ collectionNodes.push(this.createTempNode(startNode));
707
+ }
708
+ }
701
709
  }
702
710
  else {
703
- collectionNodes.push(this.createTempNode(tempNode));
711
+ collectionNodes.push(parentNode);
704
712
  }
705
713
  }
706
714
  else {
707
- collectionNodes.push(parentNode);
715
+ if (CONSTANT.IGNORE_BLOCK_TAGS.indexOf(parentNode.tagName.toLocaleLowerCase()) >= 0 && (startNode.tagName === 'BR' ||
716
+ startNode.nodeType === Node.TEXT_NODE ||
717
+ startNode.classList.contains(markerClassName.startSelection) ||
718
+ startNode.classList.contains(markerClassName.endSelection))) {
719
+ var tempNode = startNode.previousSibling &&
720
+ startNode.previousSibling.nodeType === Node.TEXT_NODE ?
721
+ startNode.previousSibling : startNode;
722
+ if (!startNode.nextSibling && !startNode.previousSibling && startNode.tagName === 'BR') {
723
+ collectionNodes.push(tempNode);
724
+ }
725
+ else {
726
+ collectionNodes.push(this.createTempNode(tempNode));
727
+ }
728
+ }
729
+ else {
730
+ collectionNodes.push(parentNode);
731
+ }
708
732
  }
709
733
  }
710
734
  var nodes = [];
@@ -773,6 +797,131 @@ var DOMNode = /** @class */ (function () {
773
797
  DOMNode.prototype.ignoreTableTag = function (element) {
774
798
  return !(CONSTANT.TABLE_BLOCK_TAGS.indexOf(element.tagName.toLocaleLowerCase()) >= 0);
775
799
  };
800
+ DOMNode.prototype.getPreBlockNodeCollection = function (range) {
801
+ var startNode = this.getSelectedNode(range.startContainer, range.startOffset);
802
+ var endNode = this.getSelectedNode(range.endContainer, range.endOffset);
803
+ var nodes = [];
804
+ var rootNode = startNode.closest('td, th');
805
+ if (isNOU(rootNode)) {
806
+ return nodes;
807
+ }
808
+ var rootChildNode = Array.from(rootNode.childNodes);
809
+ var isContinue = true;
810
+ var processedStart = this.getClosestInlineParent(startNode, rootNode, true);
811
+ var processedEnd = this.getClosestInlineParent(endNode, rootNode, false);
812
+ for (var i = 0; i < rootChildNode.length; i++) {
813
+ var child = rootChildNode[i];
814
+ if (processedStart === processedEnd && child === processedStart) {
815
+ nodes.push(child);
816
+ isContinue = true;
817
+ }
818
+ else if (child === processedStart) {
819
+ isContinue = false;
820
+ }
821
+ else if (child === processedEnd) {
822
+ nodes.push(child); // Early Exit so Push the end node.
823
+ isContinue = true;
824
+ }
825
+ if (isContinue) {
826
+ continue;
827
+ }
828
+ else {
829
+ nodes.push(child);
830
+ }
831
+ }
832
+ return nodes;
833
+ };
834
+ DOMNode.prototype.getClosestInlineParent = function (node, rootNode, isStart) {
835
+ // 1. If the node is a text node, return the node
836
+ // 2. If the node is a block node return block node
837
+ // 3. If the node is a inline node,
838
+ // Traverse back untill the TD or TH node
839
+ // Check if the the previous sibling , next sibling is a block node.
840
+ // If yes return the inline node that is closest to the block node.
841
+ if (node.nodeType === Node.TEXT_NODE) {
842
+ return node;
843
+ }
844
+ if (this.isBlockNode(node)) {
845
+ return node;
846
+ }
847
+ var currentNode = node;
848
+ var rootFlag = false;
849
+ while (currentNode) {
850
+ var previousNode = currentNode;
851
+ if (rootFlag) {
852
+ if (this.isBlockNode(currentNode)) {
853
+ return previousNode;
854
+ }
855
+ if (isStart && currentNode.previousSibling) {
856
+ if (this.isBlockNode(currentNode.previousSibling) || currentNode.previousSibling.nodeName === 'BR') {
857
+ return previousNode;
858
+ }
859
+ else {
860
+ currentNode = currentNode.previousSibling;
861
+ }
862
+ }
863
+ else if (!isStart && currentNode.nextSibling) {
864
+ if (this.isBlockNode(currentNode.nextSibling) || currentNode.nextSibling.nodeName === 'BR') {
865
+ return previousNode;
866
+ }
867
+ else {
868
+ currentNode = currentNode.nextSibling;
869
+ }
870
+ }
871
+ else {
872
+ return currentNode;
873
+ }
874
+ }
875
+ else {
876
+ currentNode = currentNode.parentElement;
877
+ if (currentNode === rootNode) {
878
+ currentNode = previousNode;
879
+ rootFlag = true;
880
+ }
881
+ }
882
+ }
883
+ return null;
884
+ };
885
+ DOMNode.prototype.wrapWithBlockNode = function (nodes, collectionNodes) {
886
+ var wrapperElement = createElement('p');
887
+ for (var i = 0; i < nodes.length; i++) {
888
+ var child = nodes[i];
889
+ if (child.nodeName === 'BR') {
890
+ child.parentNode.insertBefore(wrapperElement, child);
891
+ wrapperElement.appendChild(child);
892
+ if (wrapperElement.childNodes.length > 0) {
893
+ collectionNodes.push(wrapperElement);
894
+ }
895
+ wrapperElement = createElement('p');
896
+ }
897
+ else {
898
+ if (!this.isBlockNode(child)) {
899
+ if (child.nodeName === '#text' && child.textContent.trim() === '') {
900
+ continue;
901
+ }
902
+ if (wrapperElement.childElementCount === 0) {
903
+ child.parentNode.insertBefore(wrapperElement, child);
904
+ wrapperElement.appendChild(child);
905
+ }
906
+ else {
907
+ wrapperElement.appendChild(child);
908
+ }
909
+ }
910
+ else {
911
+ collectionNodes.push(child);
912
+ }
913
+ // Use case when the BR is next sibling but the BR is not the part of selection.
914
+ if ((i === nodes.length - 1) && wrapperElement.nextElementSibling &&
915
+ wrapperElement.querySelectorAll('br').length === 0 &&
916
+ wrapperElement.nextElementSibling.nodeName === 'BR') {
917
+ wrapperElement.appendChild(wrapperElement.nextElementSibling);
918
+ }
919
+ }
920
+ }
921
+ if (wrapperElement.childNodes.length > 0 && collectionNodes.indexOf(wrapperElement) < 0) {
922
+ collectionNodes.push(wrapperElement);
923
+ }
924
+ };
776
925
  return DOMNode;
777
926
  }());
778
927
  export { DOMNode };
@@ -242,7 +242,7 @@ var Formats = /** @class */ (function () {
242
242
  }
243
243
  var save = this.parent.nodeSelection.save(range, this.parent.currentDocument);
244
244
  this.parent.domNode.setMarker(save);
245
- var formatsNodes = this.parent.domNode.blockNodes();
245
+ var formatsNodes = this.parent.domNode.blockNodes(true);
246
246
  if (e.enterAction === 'BR') {
247
247
  this.setSelectionBRConfig();
248
248
  var allSelectedNode = this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument);
@@ -79,7 +79,6 @@ var ImageCommand = /** @class */ (function () {
79
79
  }
80
80
  };
81
81
  ImageCommand.prototype.createImage = function (e) {
82
- var _this = this;
83
82
  var isReplaced = false;
84
83
  e.item.url = isNOU(e.item.url) || e.item.url === 'undefined' ? e.item.src : e.item.url;
85
84
  if (!isNOU(e.item.selectParent) && e.item.selectParent[0].tagName === 'IMG') {
@@ -109,21 +108,18 @@ var ImageCommand = /** @class */ (function () {
109
108
  var selectedNode = this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)[0];
110
109
  var imgElm_1 = (e.value === 'Replace' || isReplaced) ? e.item.selectParent[0] :
111
110
  (Browser.isIE ? selectedNode.previousSibling : selectedNode.previousElementSibling);
112
- imgElm_1.addEventListener('load', function () {
113
- if (e.value !== 'Replace' || !isReplaced) {
114
- e.callBack({
115
- requestType: 'Images',
116
- editorMode: 'HTML',
117
- event: e.event,
118
- range: _this.parent.nodeSelection.getRange(_this.parent.currentDocument),
119
- elements: [imgElm_1]
120
- });
121
- }
122
- });
123
- }
124
- if (e.value === 'Replace') {
125
- e.item.subCommand = 'Replace';
126
- this.callBack(e);
111
+ var imageInstance_1 = this;
112
+ var onImageLoadEvent_1 = function () {
113
+ e.callBack({
114
+ requestType: (e.value === 'Replace') ? (e.item.subCommand = 'Replace', "Replace") : 'Images',
115
+ editorMode: 'HTML',
116
+ event: e.event,
117
+ range: imageInstance_1.parent.nodeSelection.getRange(imageInstance_1.parent.currentDocument),
118
+ elements: [imgElm_1]
119
+ });
120
+ imgElm_1.removeEventListener('load', onImageLoadEvent_1);
121
+ };
122
+ imgElm_1.addEventListener('load', onImageLoadEvent_1);
127
123
  }
128
124
  };
129
125
  ImageCommand.prototype.setStyle = function (imgElement, e, imgReplace) {
@@ -26,4 +26,5 @@ export declare class InsertHtml {
26
26
  private static findDetachEmptyElem;
27
27
  private static removeEmptyElements;
28
28
  private static closestEle;
29
+ private static insertTableInList;
29
30
  }
@@ -59,6 +59,10 @@ var InsertHtml = /** @class */ (function () {
59
59
  var isCollapsed = range.collapsed;
60
60
  var nodes = this.getNodeCollection(range, nodeSelection, node);
61
61
  var closestParentNode = (node.nodeName.toLowerCase() === 'table') ? this.closestEle(nodes[0].parentNode, editNode) : nodes[0];
62
+ if (closestParentNode && closestParentNode.nodeName === 'LI' && node.nodeName.toLowerCase() === 'table') {
63
+ this.insertTableInList(range, node, closestParentNode, nodes[0], nodeCutter);
64
+ return;
65
+ }
62
66
  if (isExternal || (!isNOU(node) && !isNOU(node.classList) &&
63
67
  node.classList.contains('pasteContent'))) {
64
68
  this.pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction);
@@ -554,6 +558,9 @@ var InsertHtml = /** @class */ (function () {
554
558
  };
555
559
  InsertHtml.closestEle = function (element, editNode) {
556
560
  var el = element;
561
+ if (closest(el, 'li')) {
562
+ return closest(el, 'li');
563
+ }
557
564
  while (el && el.nodeType === 1) {
558
565
  if (el.parentNode === editNode ||
559
566
  (!isNOU(el.parentNode.tagName) &&
@@ -564,6 +571,30 @@ var InsertHtml = /** @class */ (function () {
564
571
  }
565
572
  return null;
566
573
  };
574
+ InsertHtml.insertTableInList = function (range, insertNode, parentNode, currentNode, nodeCutter) {
575
+ if (range.collapsed) {
576
+ var isStart = range.startOffset === 0;
577
+ var isEnd = range.startContainer.textContent.trimEnd().length === range.startOffset;
578
+ if (isStart || isEnd) {
579
+ if (isStart) {
580
+ InsertMethods.AppendBefore(insertNode, currentNode, false);
581
+ }
582
+ else {
583
+ InsertMethods.AppendBefore(insertNode, currentNode, true);
584
+ }
585
+ }
586
+ else {
587
+ var preNode = nodeCutter.SplitNode(range, parentNode, true);
588
+ var sibNode = preNode.previousSibling;
589
+ sibNode.appendChild(insertNode);
590
+ }
591
+ }
592
+ else {
593
+ range.deleteContents();
594
+ parentNode.appendChild(insertNode);
595
+ }
596
+ insertNode.classList.add('ignore-table');
597
+ };
567
598
  /**
568
599
  * Insert method
569
600
  *
@@ -194,7 +194,7 @@ var LinkCommand = /** @class */ (function () {
194
194
  for (var i = 0, j_2 = 0, k = 0; i <= finalinlineNodes.length; i++) {
195
195
  if (i === 0) {
196
196
  finalinlineNodes[i].parentNode.insertBefore(anchorNodes[j_2], finalinlineNodes[i].nextSibling);
197
- if (this.parent.domNode.blockNodes().length === 1) {
197
+ if (this.parent.domNode.blockNodes().length === 1 && anchorNodes.length === 1) {
198
198
  this.parent.nodeSelection.setSelectionNode(this.parent.currentDocument, anchorNodes[j_2]);
199
199
  }
200
200
  removeNodes[k] = finalinlineNodes[i];
@@ -114,7 +114,8 @@ var Lists = /** @class */ (function () {
114
114
  startNode.textContent = '';
115
115
  }
116
116
  var startNodeParent = startNode.parentElement;
117
- if (isNOU(startNodeParent.parentElement.closest('UL')) && isNOU(startNodeParent.parentElement.closest('OL'))) {
117
+ var parentOfCurrentOLUL = startNodeParent.parentElement;
118
+ if (isNOU(parentOfCurrentOLUL.closest('UL')) && isNOU(parentOfCurrentOLUL.closest('OL'))) {
118
119
  if (!isNOU(startNode.nextElementSibling)) {
119
120
  var nearBlockNode = this.parent.domNode.blockParentNode(startNode);
120
121
  this.parent.nodeCutter.GetSpliceNode(range, nearBlockNode);
@@ -141,6 +142,15 @@ var Lists = /** @class */ (function () {
141
142
  detach(startNode);
142
143
  }
143
144
  }
145
+ // To handle the nested enter key press in the list for the first LI element
146
+ if (!isNOU(parentOfCurrentOLUL) && (!isNOU(parentOfCurrentOLUL.closest('UL')) || !isNOU(parentOfCurrentOLUL.closest('OL'))) &&
147
+ parentOfCurrentOLUL.nodeName === 'LI' && parentOfCurrentOLUL.style.listStyleType === 'none' &&
148
+ parentOfCurrentOLUL.textContent === '' && startNode.textContent === '' && startNode === startNodeParent.firstElementChild &&
149
+ isNOU(startNode.nextSibling)) {
150
+ detach(startNodeParent);
151
+ parentOfCurrentOLUL.style.removeProperty('list-style-type');
152
+ e.event.preventDefault();
153
+ }
144
154
  }
145
155
  };
146
156
  Lists.prototype.backspaceList = function (e) {
@@ -514,7 +524,7 @@ var Lists = /** @class */ (function () {
514
524
  this.currentAction = e.subCommand;
515
525
  this.currentAction = e.subCommand = this.currentAction === 'NumberFormatList' ? 'OL' : this.currentAction === 'BulletFormatList' ? 'UL' : this.currentAction;
516
526
  this.domNode.setMarker(this.saveSelection);
517
- var listsNodes = this.domNode.blockNodes();
527
+ var listsNodes = this.domNode.blockNodes(true);
518
528
  if (e.enterAction === 'BR') {
519
529
  this.setSelectionBRConfig();
520
530
  var allSelectedNode = this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument);
@@ -629,6 +639,18 @@ var Lists = /** @class */ (function () {
629
639
  listEle.innerHTML = '<li><br/></li>';
630
640
  elements[i].appendChild(listEle);
631
641
  }
642
+ else if ('LI' !== elements[i].tagName && isNOU(item) &&
643
+ elements[i].nodeName === 'BLOCKQUOTE') {
644
+ isReverse = false;
645
+ var elemAtt = this.domNode.attributes(elements[i]);
646
+ var openTag = '<' + type + '>';
647
+ var closeTag = '</' + type + '>';
648
+ var newTag = 'li' + elemAtt;
649
+ var replaceHTML = elements[i].innerHTML;
650
+ var innerHTML = this.domNode.createTagString(newTag, null, replaceHTML);
651
+ var collectionString = openTag + innerHTML + closeTag;
652
+ elements[i].innerHTML = collectionString;
653
+ }
632
654
  else if ('LI' !== elements[i].tagName && isNOU(item)) {
633
655
  isReverse = false;
634
656
  var elemAtt = elements[i].tagName === 'IMG' ? '' : this.domNode.attributes(elements[i]);