@syncfusion/ej2-richtexteditor 25.2.3 → 25.2.5

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 (29) hide show
  1. package/CHANGELOG.md +30 -2
  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 +236 -114
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +238 -113
  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/base/editor-manager.js +5 -3
  15. package/src/editor-manager/plugin/alignments.js +3 -0
  16. package/src/editor-manager/plugin/dom-node.d.ts +20 -0
  17. package/src/editor-manager/plugin/dom-node.js +105 -2
  18. package/src/editor-manager/plugin/formats.js +1 -1
  19. package/src/editor-manager/plugin/indents.js +3 -0
  20. package/src/editor-manager/plugin/lists.d.ts +0 -1
  21. package/src/editor-manager/plugin/lists.js +2 -76
  22. package/src/rich-text-editor/actions/full-screen.js +0 -6
  23. package/src/rich-text-editor/actions/html-editor.d.ts +1 -0
  24. package/src/rich-text-editor/actions/html-editor.js +62 -9
  25. package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
  26. package/src/rich-text-editor/actions/paste-clean-up.js +41 -5
  27. package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -0
  28. package/src/rich-text-editor/base/rich-text-editor.js +6 -2
  29. package/src/rich-text-editor/renderer/toolbar-renderer.js +7 -9
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 25.2.3
3
+ * version : 25.2.5
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@25.1.42",
3
+ "_id": "@syncfusion/ej2-richtexteditor@25.2.4",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-XGBgOsVJDjeoUg7NCBMs+ayX0m4MrTWbdXlHzdK3COGoWMO8ssDjO3iw8e+6828qeoGJnLQrJHa23r7RYWpb/Q==",
5
+ "_integrity": "sha512-axjlW/M2AfJzH2TUhZ6jxy0E69gZEmC+Oxm+OBXnGOWNez043U4Nw8uw+eV/UuK52BrzdX0n99k9vxWwlIoKcw==",
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.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-25.1.42.tgz",
29
- "_shasum": "e1bb753283216537b608b5a49c85096650d5693d",
28
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-25.2.4.tgz",
29
+ "_shasum": "b32bf82ce555a4b5b2905f206d207d22866194fd",
30
30
  "_spec": "@syncfusion/ej2-richtexteditor@*",
31
31
  "_where": "/jenkins/workspace/elease-automation_release_25.1.1/packages/included",
32
32
  "author": {
@@ -37,13 +37,13 @@
37
37
  },
38
38
  "bundleDependencies": false,
39
39
  "dependencies": {
40
- "@syncfusion/ej2-base": "~25.2.3",
41
- "@syncfusion/ej2-buttons": "~25.2.3",
40
+ "@syncfusion/ej2-base": "~25.2.5",
41
+ "@syncfusion/ej2-buttons": "~25.2.4",
42
42
  "@syncfusion/ej2-filemanager": "~25.2.3",
43
- "@syncfusion/ej2-inputs": "~25.2.3",
44
- "@syncfusion/ej2-navigations": "~25.2.3",
45
- "@syncfusion/ej2-popups": "~25.2.3",
46
- "@syncfusion/ej2-splitbuttons": "~25.2.3"
43
+ "@syncfusion/ej2-inputs": "~25.2.5",
44
+ "@syncfusion/ej2-navigations": "~25.2.4",
45
+ "@syncfusion/ej2-popups": "~25.2.4",
46
+ "@syncfusion/ej2-splitbuttons": "~25.2.4"
47
47
  },
48
48
  "deprecated": false,
49
49
  "description": "Essential JS 2 RichTextEditor component",
@@ -79,6 +79,6 @@
79
79
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
80
80
  },
81
81
  "typings": "index.d.ts",
82
- "version": "25.2.3",
82
+ "version": "25.2.5",
83
83
  "sideEffects": false
84
84
  }
@@ -213,11 +213,14 @@ export function nestedListCleanUp(range) {
213
213
  item.remove();
214
214
  });
215
215
  }
216
+ else {
217
+ break;
218
+ }
216
219
  }
217
220
  var liElem = (range.startContainer.nodeName === "#text" ? range.startContainer.parentElement : range.startContainer).querySelectorAll("li");
218
221
  if (liElem.length > 0) {
219
222
  liElem.forEach(function (item) {
220
- if (item.firstChild.nodeName === "OL" || item.firstChild.nodeName === "UL") {
223
+ if (!isNullOrUndefined(item.firstChild) && (item.firstChild.nodeName === "OL" || item.firstChild.nodeName === "UL")) {
221
224
  item.style.listStyleType = "none";
222
225
  }
223
226
  });
@@ -115,12 +115,14 @@ var EditorManager = /** @class */ (function () {
115
115
  case 'alignments':
116
116
  this.observer.notify(CONSTANT.ALIGNMENT_TYPE, {
117
117
  subCommand: value, event: event, callBack: callBack,
118
- selector: selector,
119
- value: exeValue
118
+ selector: selector, value: exeValue, enterAction: enterAction
120
119
  });
121
120
  break;
122
121
  case 'indents':
123
- this.observer.notify(CONSTANT.INDENT_TYPE, { subCommand: value, event: event, callBack: callBack, selector: selector });
122
+ this.observer.notify(CONSTANT.INDENT_TYPE, {
123
+ subCommand: value, event: event, callBack: callBack,
124
+ selector: selector, enterAction: enterAction
125
+ });
124
126
  break;
125
127
  case 'links':
126
128
  this.observer.notify(CONSTANT.LINK, { command: command, value: value, item: exeValue, event: event, callBack: callBack });
@@ -64,6 +64,9 @@ var Alignments = /** @class */ (function () {
64
64
  if (!isTableAlign) {
65
65
  this.parent.domNode.setMarker(save);
66
66
  var alignmentNodes = this.parent.domNode.blockNodes();
67
+ if (e.enterAction === 'BR') {
68
+ alignmentNodes = this.parent.domNode.convertToBlockNodes(alignmentNodes, false);
69
+ }
67
70
  for (var i = 0; i < alignmentNodes.length; i++) {
68
71
  var parentNode = alignmentNodes[i];
69
72
  setStyleAttribute(parentNode, { 'text-align': this.alignments[e.subCommand] });
@@ -314,6 +314,26 @@ export declare class DOMNode {
314
314
 
315
315
  */
316
316
  getImageTagInSelection(): NodeListOf<HTMLImageElement>;
317
+ /**
318
+ * Method to wrap the inline and text node with block node.
319
+ *
320
+ * @param {HTMLElement} node - specifies the element sent to wrap the node around it with block nodes.
321
+ * @param {string} wrapperElement - specifies which block nodes to wrap around.
322
+ * @returns {HTMLElement} - returns the wrapped element.
323
+ * @hidden
324
+
325
+ */
326
+ gatherElementsAround(node: HTMLElement, wrapperElement: string): HTMLElement;
327
+ /**
328
+ * Method to convert all the inline nodes between the selection to block nodes.
329
+ *
330
+ * @param {Node[]} selectedNodes - specifies the nodes of the start and end selection.
331
+ * @param {boolean} fromList - specifies if the method is called from list module.
332
+ * @returns {Node[]} - returns the selected list of elements as block nodes.
333
+ * @hidden
334
+
335
+ */
336
+ convertToBlockNodes(selectedNodes: Node[], fromList: boolean): Node[];
317
337
  /**
318
338
  * blockNodes method
319
339
  *
@@ -1,5 +1,5 @@
1
1
  import * as CONSTANT from './../base/constant';
2
- import { append, detach, createElement, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
2
+ import { append, detach, createElement, isNullOrUndefined as isNOU, closest } from '@syncfusion/ej2-base';
3
3
  import { NodeSelection } from './../../selection/index';
4
4
  import { selfClosingTags } from '../../common/config';
5
5
  import { getLastTextNode } from '../../common/util';
@@ -318,7 +318,7 @@ var DOMNode = /** @class */ (function () {
318
318
  DOMNode.prototype.unWrap = function (element) {
319
319
  var parent = element.parentNode;
320
320
  var unWrapNode = [];
321
- while (element.firstChild) {
321
+ while (element.firstChild && (element.previousSibling !== this.parent.querySelector('.e-mention-chip') || element.textContent !== ' ')) {
322
322
  unWrapNode.push(element.firstChild);
323
323
  parent.insertBefore(element.firstChild, element);
324
324
  }
@@ -668,6 +668,109 @@ var DOMNode = /** @class */ (function () {
668
668
  }
669
669
  return null;
670
670
  };
671
+ /**
672
+ * Method to wrap the inline and text node with block node.
673
+ *
674
+ * @param {HTMLElement} node - specifies the element sent to wrap the node around it with block nodes.
675
+ * @param {string} wrapperElement - specifies which block nodes to wrap around.
676
+ * @returns {HTMLElement} - returns the wrapped element.
677
+ * @hidden
678
+
679
+ */
680
+ DOMNode.prototype.gatherElementsAround = function (node, wrapperElement) {
681
+ var newWrapElem = createElement(wrapperElement);
682
+ // Insert the new div element before the current node.
683
+ var currentNode = node.previousSibling;
684
+ var currentNodeParent = node.parentElement;
685
+ if (currentNodeParent.className === 'e-editor-select-start') {
686
+ currentNodeParent.parentNode.insertBefore(newWrapElem, currentNodeParent);
687
+ }
688
+ else if (currentNodeParent) {
689
+ currentNodeParent.insertBefore(newWrapElem, node);
690
+ }
691
+ var i = 0;
692
+ while (currentNode !== null && currentNode.nodeName !== 'BR' &&
693
+ !this.isBlockNode(currentNode)) {
694
+ var prevSibling = currentNode.previousSibling;
695
+ if (currentNode.nodeType === 3 || currentNode.nodeType === 1) {
696
+ if (i === 0) {
697
+ newWrapElem.appendChild(currentNode);
698
+ }
699
+ else {
700
+ newWrapElem.insertBefore(currentNode, newWrapElem.firstChild);
701
+ }
702
+ }
703
+ currentNode = prevSibling;
704
+ i++;
705
+ }
706
+ // Add the current node to the new div
707
+ newWrapElem.appendChild(node);
708
+ // Gather text and inline elements after the currentNode
709
+ currentNode = newWrapElem.nextSibling ? newWrapElem.nextSibling :
710
+ newWrapElem.parentElement.nextSibling;
711
+ while (currentNode !== null && currentNode.nodeName !== 'BR' &&
712
+ !this.isBlockNode(currentNode)) {
713
+ var nextSibling = currentNode.nextSibling ?
714
+ currentNode.nextSibling : currentNode.parentElement.nextSibling;
715
+ if (currentNode.nodeType === 3 || currentNode.nodeType === 1) {
716
+ newWrapElem.appendChild(currentNode);
717
+ }
718
+ currentNode = nextSibling;
719
+ }
720
+ return newWrapElem;
721
+ };
722
+ /**
723
+ * Method to convert all the inline nodes between the selection to block nodes.
724
+ *
725
+ * @param {Node[]} selectedNodes - specifies the nodes of the start and end selection.
726
+ * @param {boolean} fromList - specifies if the method is called from list module.
727
+ * @returns {Node[]} - returns the selected list of elements as block nodes.
728
+ * @hidden
729
+
730
+ */
731
+ DOMNode.prototype.convertToBlockNodes = function (selectedNodes, fromList) {
732
+ if (selectedNodes.length > 1) {
733
+ var i = 0;
734
+ var currentSelectedNode = selectedNodes[0];
735
+ while (!isNOU(currentSelectedNode)) {
736
+ if (currentSelectedNode.nodeName === 'BR') {
737
+ var nextNode = currentSelectedNode.nextSibling;
738
+ detach(currentSelectedNode);
739
+ currentSelectedNode = nextNode;
740
+ }
741
+ if (!isNOU(currentSelectedNode)) {
742
+ if (fromList) {
743
+ selectedNodes[i] = currentSelectedNode.nodeName === 'LI' || this.isBlockNode(currentSelectedNode) ?
744
+ currentSelectedNode :
745
+ this.gatherElementsAround(currentSelectedNode, (fromList ? 'p' : 'div'));
746
+ }
747
+ else {
748
+ selectedNodes[i] = !this.isBlockNode(selectedNodes[i]) ?
749
+ this.gatherElementsAround(currentSelectedNode, (fromList ? 'p' : 'div')) :
750
+ selectedNodes[i];
751
+ }
752
+ var currentProcessNode = selectedNodes[i].nodeName === 'LI' ? selectedNodes[i].parentElement : selectedNodes[i];
753
+ var currentElementCheckNode = currentProcessNode.nodeName === '#text' ? currentProcessNode.parentElement : currentProcessNode;
754
+ currentSelectedNode = !isNOU(currentElementCheckNode.querySelector('.e-editor-select-end')) ||
755
+ !isNOU(closest(currentSelectedNode, '.e-editor-select-end')) ?
756
+ null : currentProcessNode.nextSibling;
757
+ if (currentSelectedNode === null && !isNOU(currentProcessNode.nextSibling) && currentProcessNode.nextSibling.nodeName === 'BR') {
758
+ detach(currentProcessNode.nextSibling);
759
+ }
760
+ }
761
+ i++;
762
+ }
763
+ }
764
+ else {
765
+ if (!this.isBlockNode(selectedNodes[0])) {
766
+ selectedNodes[0] = this.gatherElementsAround(selectedNodes[0], (fromList ? 'p' : 'div'));
767
+ if (!isNOU(selectedNodes[0].nextSibling) && (selectedNodes[0].nextSibling.nodeName === 'BR')) {
768
+ detach(selectedNodes[0].nextSibling);
769
+ }
770
+ }
771
+ }
772
+ return selectedNodes;
773
+ };
671
774
  /**
672
775
  * blockNodes method
673
776
  *
@@ -51,7 +51,7 @@ var Formats = /** @class */ (function () {
51
51
  }
52
52
  }
53
53
  }
54
- if (e.enterAction !== 'BR' && !isNOU(range.startContainer) && !isNOU(range.startContainer.parentElement) && range.startContainer === range.endContainer && range.startContainer.nodeName === '#text' && range.startContainer.parentElement.classList.contains("e-content") && range.startContainer.parentElement.isContentEditable) {
54
+ if (e.enterAction !== 'BR' && !isNOU(range.startContainer) && !isNOU(range.startContainer.parentElement) && range.startContainer === range.endContainer && range.startContainer.nodeName === '#text' && range.startContainer.parentElement.classList.contains('e-content') && range.startContainer.parentElement.isContentEditable) {
55
55
  var pTag = createElement(e.enterAction);
56
56
  range.startContainer.parentElement.insertBefore(pTag, range.startContainer);
57
57
  pTag.appendChild(range.startContainer);
@@ -43,6 +43,9 @@ var Indents = /** @class */ (function () {
43
43
  var save = this.parent.nodeSelection.save(range, this.parent.currentDocument);
44
44
  this.parent.domNode.setMarker(save);
45
45
  var indentsNodes = this.parent.domNode.blockNodes();
46
+ if (e.enterAction === 'BR') {
47
+ indentsNodes = this.parent.domNode.convertToBlockNodes(indentsNodes, false);
48
+ }
46
49
  var parentNodes = indentsNodes.slice();
47
50
  var listsNodes = [];
48
51
  for (var i = 0; i < parentNodes.length; i++) {
@@ -47,5 +47,4 @@ export declare class Lists {
47
47
  private revertList;
48
48
  private openTag;
49
49
  private closeTag;
50
- private gatherElementsAround;
51
50
  }
@@ -553,39 +553,7 @@ var Lists = /** @class */ (function () {
553
553
  var listsNodes = this.domNode.blockNodes(true);
554
554
  if (e.enterAction === 'BR') {
555
555
  this.setSelectionBRConfig();
556
- var selectedNodes = this.parent.domNode.blockNodes();
557
- if (selectedNodes.length > 1) {
558
- var i = 0;
559
- var currentAlignmentNode = selectedNodes[0];
560
- while (!isNOU(currentAlignmentNode)) {
561
- if (currentAlignmentNode.nodeName === 'BR') {
562
- var nextNode = currentAlignmentNode.nextSibling;
563
- detach(currentAlignmentNode);
564
- currentAlignmentNode = nextNode;
565
- }
566
- if (!isNOU(currentAlignmentNode)) {
567
- selectedNodes[i] = currentAlignmentNode.nodeName === 'LI' || this.parent.domNode.isBlockNode(currentAlignmentNode) ?
568
- currentAlignmentNode : this.gatherElementsAround(currentAlignmentNode);
569
- var currentSelectNode = selectedNodes[i].nodeName === 'LI' ? selectedNodes[i].parentElement : selectedNodes[i];
570
- var currentElementCheckNode = currentAlignmentNode.nodeName === '#text' ? currentAlignmentNode.parentElement : currentAlignmentNode;
571
- currentAlignmentNode = !isNOU(currentElementCheckNode.querySelector('.e-editor-select-end')) ||
572
- !isNOU(closest(currentAlignmentNode, '.e-editor-select-end')) ?
573
- null : currentSelectNode.nextSibling;
574
- if (currentAlignmentNode === null && !isNOU(currentSelectNode.nextSibling) && currentSelectNode.nextSibling.nodeName === 'BR') {
575
- detach(currentSelectNode.nextSibling);
576
- }
577
- }
578
- i++;
579
- }
580
- }
581
- else {
582
- if (!this.parent.domNode.isBlockNode(selectedNodes[0])) {
583
- selectedNodes[0] = this.gatherElementsAround(selectedNodes[0]);
584
- if (!isNOU(selectedNodes[0].nextSibling) && (selectedNodes[0].nextSibling.nodeName === 'BR')) {
585
- detach(selectedNodes[0].nextSibling);
586
- }
587
- }
588
- }
556
+ this.parent.domNode.convertToBlockNodes(this.parent.domNode.blockNodes(), true);
589
557
  this.setSelectionBRConfig();
590
558
  listsNodes = this.parent.domNode.blockNodes();
591
559
  }
@@ -897,7 +865,7 @@ var Lists = /** @class */ (function () {
897
865
  parentNode.removeAttribute("style");
898
866
  }
899
867
  }
900
- var wrapper = '<' + CONSTANT.DEFAULT_TAG + wrapperclass + this.domNode.attributes(element) + '></' + CONSTANT.DEFAULT_TAG + '>';
868
+ var wrapper = '<' + e.enterAction + wrapperclass + this.domNode.attributes(element) + '></' + e.enterAction + '>';
901
869
  if (e.enterAction !== 'BR') {
902
870
  this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
903
871
  }
@@ -971,48 +939,6 @@ var Lists = /** @class */ (function () {
971
939
  Lists.prototype.closeTag = function (type) {
972
940
  return this.domNode.parseHTMLFragment('<span class="e-rte-list-close-' + type.toLowerCase() + '"></span>');
973
941
  };
974
- Lists.prototype.gatherElementsAround = function (node) {
975
- var pWrap = document.createElement('p');
976
- // Insert the new div before the current node
977
- var currentNode = node.previousSibling;
978
- var classNode = node.parentNode;
979
- if (classNode.className === 'e-editor-select-start') {
980
- node.parentNode.parentNode.insertBefore(pWrap, node.parentNode);
981
- }
982
- else if (node.parentNode) {
983
- node.parentNode.insertBefore(pWrap, node);
984
- }
985
- // Gather text and inline elements before the currentNode
986
- var i = 0;
987
- while (currentNode !== null && currentNode.nodeName !== 'BR' &&
988
- !this.parent.domNode.isBlockNode(currentNode)) {
989
- var prevSibling = currentNode.previousSibling;
990
- if (currentNode.nodeType === 3 || currentNode.nodeType === 1) {
991
- if (i === 0) {
992
- pWrap.appendChild(currentNode);
993
- }
994
- else {
995
- pWrap.insertBefore(currentNode, pWrap.firstChild);
996
- }
997
- }
998
- currentNode = prevSibling;
999
- i++;
1000
- }
1001
- // Add the current node to the new p
1002
- pWrap.appendChild(node);
1003
- // Gather text and inline elements after the currentNode
1004
- currentNode = pWrap.nextSibling ? pWrap.nextSibling : pWrap.parentElement.nextSibling;
1005
- while (currentNode !== null && currentNode.nodeName !== 'BR' &&
1006
- !this.parent.domNode.isBlockNode(currentNode)) {
1007
- var nextSibling = currentNode.nextSibling ?
1008
- currentNode.nextSibling : currentNode.parentElement.nextSibling;
1009
- if (currentNode.nodeType === 3 || currentNode.nodeType === 1) {
1010
- pWrap.appendChild(currentNode);
1011
- }
1012
- currentNode = nextSibling;
1013
- }
1014
- return pWrap;
1015
- };
1016
942
  return Lists;
1017
943
  }());
1018
944
  export { Lists };
@@ -25,9 +25,6 @@ var FullScreen = /** @class */ (function () {
25
25
  && !isNOU(this.parent.quickToolbarModule)) {
26
26
  this.parent.quickToolbarModule.hideQuickToolbars();
27
27
  }
28
- if (this.parent.showTooltip && !isNOU(document.querySelector('.e-tooltip-wrap'))) {
29
- this.parent.notify(events.destroyTooltip, { args: event });
30
- }
31
28
  this.scrollableParent = getScrollableParent(this.parent.element);
32
29
  if (!this.parent.element.classList.contains(classes.CLS_FULL_SCREEN)) {
33
30
  var evenArgs = {
@@ -80,9 +77,6 @@ var FullScreen = /** @class */ (function () {
80
77
  && !isNOU(this.parent.quickToolbarModule)) {
81
78
  this.parent.quickToolbarModule.hideQuickToolbars();
82
79
  }
83
- if (this.parent.showTooltip && !isNOU(document.querySelector('.e-tooltip-wrap'))) {
84
- this.parent.notify(events.destroyTooltip, { args: event });
85
- }
86
80
  if (this.parent.element.classList.contains(classes.CLS_FULL_SCREEN)) {
87
81
  var evenArgs = {
88
82
  cancel: false,
@@ -106,4 +106,5 @@ export declare class HtmlEditor {
106
106
  * @hidden
107
107
  */
108
108
  private getSelectedHtml;
109
+ private marginTabAdd;
109
110
  }
@@ -287,25 +287,54 @@ var HtmlEditor = /** @class */ (function () {
287
287
  this.deleteCleanup(e, currentRange);
288
288
  }
289
289
  if (args.keyCode === 9 && this.parent.enableTabKey) {
290
+ this.parent.formatter.saveData(e);
290
291
  if (!isNOU(args.target) && isNullOrUndefined(closest(args.target, '.e-rte-toolbar'))) {
291
292
  var range = this.nodeSelectionObj.getRange(this.contentRenderer.getDocument());
292
293
  var parentNode = this.nodeSelectionObj.getParentNodeCollection(range);
293
294
  if (!((parentNode[0].nodeName === 'LI' || closest(parentNode[0], 'li') ||
294
295
  closest(parentNode[0], 'table')) && range.startOffset === 0)) {
295
296
  args.preventDefault();
296
- if (!args.shiftKey) {
297
- InsertHtml.Insert(this.contentRenderer.getDocument(), '&nbsp;&nbsp;&nbsp;&nbsp;');
298
- this.rangeCollection.push(this.nodeSelectionObj.getRange(this.contentRenderer.getDocument()));
297
+ var selection = this.contentRenderer.getDocument().getSelection().getRangeAt(0);
298
+ var alignmentNodes = this.parent.formatter.editorManager.domNode.blockNodes();
299
+ if (this.parent.enterKey === 'BR') {
300
+ if (selection.startOffset !== selection.endOffset && selection.startOffset === 0) {
301
+ var save = this.nodeSelectionObj.save(range, this.contentRenderer.getDocument());
302
+ this.parent.formatter.editorManager.domNode.setMarker(save);
303
+ alignmentNodes = this.parent.formatter.editorManager.domNode.blockNodes();
304
+ this.parent.formatter.editorManager.domNode.convertToBlockNodes(alignmentNodes, false);
305
+ this.marginTabAdd(args.shiftKey, alignmentNodes);
306
+ save = this.parent.formatter.editorManager.domNode.saveMarker(save);
307
+ save.restore();
308
+ }
309
+ else {
310
+ InsertHtml.Insert(this.contentRenderer.getDocument(), '&nbsp;&nbsp;&nbsp;&nbsp;');
311
+ this.rangeCollection.push(this.nodeSelectionObj.getRange(this.contentRenderer.getDocument()));
312
+ }
299
313
  }
300
- else if (this.rangeCollection.length > 0 &&
301
- this.rangeCollection[this.rangeCollection.length - 1].startContainer.textContent.length === 4) {
302
- var textCont = this.rangeCollection[this.rangeCollection.length - 1].startContainer;
303
- this.nodeSelectionObj.setSelectionText(this.contentRenderer.getDocument(), textCont, textCont, 0, textCont.textContent.length);
304
- InsertHtml.Insert(this.contentRenderer.getDocument(), document.createTextNode(''));
305
- this.rangeCollection.pop();
314
+ else {
315
+ if (!args.shiftKey) {
316
+ if (selection.startOffset !== selection.endOffset && selection.startOffset === 0) {
317
+ this.marginTabAdd(args.shiftKey, alignmentNodes);
318
+ }
319
+ else {
320
+ InsertHtml.Insert(this.contentRenderer.getDocument(), '&nbsp;&nbsp;&nbsp;&nbsp;');
321
+ this.rangeCollection.push(this.nodeSelectionObj.getRange(this.contentRenderer.getDocument()));
322
+ }
323
+ }
324
+ else if (this.rangeCollection.length > 0 &&
325
+ this.rangeCollection[this.rangeCollection.length - 1].startContainer.textContent.length === 4) {
326
+ var textCont = this.rangeCollection[this.rangeCollection.length - 1].startContainer;
327
+ this.nodeSelectionObj.setSelectionText(this.contentRenderer.getDocument(), textCont, textCont, 0, textCont.textContent.length);
328
+ InsertHtml.Insert(this.contentRenderer.getDocument(), document.createTextNode(''));
329
+ this.rangeCollection.pop();
330
+ }
331
+ else {
332
+ this.marginTabAdd(args.shiftKey, alignmentNodes);
333
+ }
306
334
  }
307
335
  }
308
336
  }
337
+ this.parent.formatter.saveData(e);
309
338
  }
310
339
  if (e.args.action === 'space' ||
311
340
  e.args.action === 'enter' ||
@@ -968,6 +997,30 @@ var HtmlEditor = /** @class */ (function () {
968
997
  HtmlEditor.prototype.getSelectedHtml = function (e) {
969
998
  e.callBack(this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument()).toString());
970
999
  };
1000
+ HtmlEditor.prototype.marginTabAdd = function (val, alignmentNodes) {
1001
+ for (var index = 0; index < alignmentNodes.length; index++) {
1002
+ var element = alignmentNodes[index];
1003
+ if (element.closest('li')) {
1004
+ continue;
1005
+ }
1006
+ if (element.style.marginLeft) {
1007
+ var count = parseInt(element.style.marginLeft, 10);
1008
+ if (val) {
1009
+ count -= 20;
1010
+ }
1011
+ else {
1012
+ count += 20;
1013
+ }
1014
+ element.style.marginLeft = count.toString() + 'px';
1015
+ if (element.style.marginLeft === '0px') {
1016
+ element.removeAttribute('style');
1017
+ }
1018
+ }
1019
+ else if (!val) {
1020
+ element.style.marginLeft = '20px';
1021
+ }
1022
+ }
1023
+ };
971
1024
  return HtmlEditor;
972
1025
  }());
973
1026
  export { HtmlEditor };
@@ -58,6 +58,7 @@ export declare class PasteCleanup {
58
58
  private docClick;
59
59
  private cleanAppleClass;
60
60
  private formatting;
61
+ private convertBlobToBase64;
61
62
  private cropImageHandler;
62
63
  private addTableClass;
63
64
  private setImageProperties;
@@ -729,11 +729,36 @@ var PasteCleanup = /** @class */ (function () {
729
729
  this.cropImageHandler(this.parent.inputElement);
730
730
  }
731
731
  };
732
+ PasteCleanup.prototype.convertBlobToBase64 = function (element) {
733
+ var imgElem = element.querySelectorAll('img');
734
+ var _loop_1 = function (i) {
735
+ if (imgElem[i].getAttribute('src') &&
736
+ imgElem[i].getAttribute('src').startsWith("blob")) {
737
+ var blobImageUrl = imgElem[i].getAttribute('src');
738
+ var img_1 = new Image();
739
+ var onImageLoadEvent_1 = function () {
740
+ var canvas = document.createElement('canvas');
741
+ var ctx = canvas.getContext('2d');
742
+ canvas.width = img_1.width;
743
+ canvas.height = img_1.height;
744
+ ctx.drawImage(img_1, 0, 0);
745
+ var base64String = canvas.toDataURL('image/png');
746
+ imgElem[i].src = base64String;
747
+ img_1.removeEventListener('load', onImageLoadEvent_1);
748
+ };
749
+ img_1.src = blobImageUrl;
750
+ img_1.addEventListener('load', onImageLoadEvent_1);
751
+ }
752
+ };
753
+ for (var i = 0; i < imgElem.length; i++) {
754
+ _loop_1(i);
755
+ }
756
+ };
732
757
  PasteCleanup.prototype.cropImageHandler = function (element) {
733
758
  var _this = this;
734
759
  var allImgElm = element.querySelectorAll('.e-img-cropped');
735
760
  if (allImgElm.length > 0) {
736
- var _loop_1 = function (i) {
761
+ var _loop_2 = function (i) {
737
762
  if (allImgElm[i].getAttribute('src').split(',')[0].indexOf('base64') >= 0) {
738
763
  var image_1 = new Image();
739
764
  image_1.src = allImgElm[i].getAttribute('src');
@@ -767,13 +792,24 @@ var PasteCleanup = /** @class */ (function () {
767
792
  }
768
793
  };
769
794
  for (var i = 0; i < allImgElm.length; i++) {
770
- _loop_1(i);
795
+ _loop_2(i);
771
796
  }
772
797
  }
773
798
  else {
774
- this.imgUploading(this.parent.inputElement);
775
- if (this.parent.iframeSettings.enable) {
776
- this.parent.updateValue();
799
+ if (!isNullOrUndefined(this.parent.insertImageSettings.saveUrl) && !isNullOrUndefined(this.parent.insertImageSettings.path) && !isNullOrUndefined(this.parent.inputElement.querySelectorAll("img")) && this.parent.inputElement.querySelectorAll("img")[0].src.startsWith("blob")) {
800
+ this.convertBlobToBase64(this.parent.inputElement);
801
+ setTimeout(function () {
802
+ _this.imgUploading(_this.parent.inputElement);
803
+ if (_this.parent.iframeSettings.enable) {
804
+ _this.parent.updateValue();
805
+ }
806
+ }, 20);
807
+ }
808
+ else {
809
+ this.imgUploading(this.parent.inputElement);
810
+ if (this.parent.iframeSettings.enable) {
811
+ this.parent.updateValue();
812
+ }
777
813
  }
778
814
  }
779
815
  };
@@ -58,6 +58,7 @@ export declare class RichTextEditor extends Component<HTMLElement> implements IN
58
58
  private isResizeInitialized;
59
59
  private isValueChangeBlurhandler;
60
60
  private displayTempElem;
61
+ private beforeRenderClassValue;
61
62
  /**
62
63
  * @hidden
63
64
 
@@ -196,6 +196,7 @@ var RichTextEditor = /** @class */ (function (_super) {
196
196
  this.persistData();
197
197
  setStyleAttribute(this.element, { 'width': formatUnit(this.width) });
198
198
  attributes(this.element, { role: 'application', 'aria-label': 'Rich Text Editor' });
199
+ this.beforeRenderClassValue = this.element.getAttribute('class');
199
200
  };
200
201
  RichTextEditor.prototype.persistData = function () {
201
202
  if (this.enablePersistence && this.originalElement.tagName === 'TEXTAREA') {
@@ -1068,6 +1069,10 @@ var RichTextEditor = /** @class */ (function (_super) {
1068
1069
  if (this.isDestroyed || !this.isRendered) {
1069
1070
  return;
1070
1071
  }
1072
+ this.element.className = this.beforeRenderClassValue;
1073
+ this.removeHtmlAttributes();
1074
+ this.removeAttributes();
1075
+ this.beforeRenderClassValue = null;
1071
1076
  if (!isNOU(this.timeInterval)) {
1072
1077
  clearInterval(this.timeInterval);
1073
1078
  this.timeInterval = null;
@@ -1135,8 +1140,6 @@ var RichTextEditor = /** @class */ (function (_super) {
1135
1140
  }
1136
1141
  }
1137
1142
  }
1138
- this.removeHtmlAttributes();
1139
- this.removeAttributes();
1140
1143
  _super.prototype.destroy.call(this);
1141
1144
  this.isRendered = false;
1142
1145
  };
@@ -1167,6 +1170,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1167
1170
  this.element.removeAttribute('aria-disabled');
1168
1171
  this.element.removeAttribute('role');
1169
1172
  this.element.removeAttribute('tabindex');
1173
+ this.element.removeAttribute('aria-label');
1170
1174
  };
1171
1175
  RichTextEditor.prototype.destroyDependentModules = function () {
1172
1176
  /* destroy dependent modules */