@syncfusion/ej2-richtexteditor 19.4.54 → 20.1.47

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 (79) hide show
  1. package/CHANGELOG.md +2 -58
  2. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  3. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-richtexteditor.es2015.js +125 -42
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +122 -39
  7. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  8. package/dist/global/ej2-richtexteditor.min.js +2 -2
  9. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +12 -12
  12. package/src/editor-manager/plugin/clearformat.js +3 -2
  13. package/src/editor-manager/plugin/image.js +6 -1
  14. package/src/editor-manager/plugin/inserthtml.js +8 -2
  15. package/src/editor-manager/plugin/link.js +5 -0
  16. package/src/editor-manager/plugin/lists.js +22 -6
  17. package/src/editor-manager/plugin/selection-commands.js +8 -2
  18. package/src/editor-manager/plugin/table.js +6 -5
  19. package/src/rich-text-editor/actions/count.js +2 -2
  20. package/src/rich-text-editor/actions/dropdown-buttons.js +1 -1
  21. package/src/rich-text-editor/actions/html-editor.js +4 -1
  22. package/src/rich-text-editor/base/classes.d.ts +5 -0
  23. package/src/rich-text-editor/base/classes.js +5 -0
  24. package/src/rich-text-editor/base/rich-text-editor.js +4 -3
  25. package/src/rich-text-editor/renderer/image-module.js +23 -7
  26. package/src/rich-text-editor/renderer/table-module.js +21 -6
  27. package/src/selection/selection.js +3 -0
  28. package/styles/bootstrap-dark.css +6 -3
  29. package/styles/bootstrap.css +6 -3
  30. package/styles/bootstrap4.css +2 -2
  31. package/styles/bootstrap5-dark.css +30 -6
  32. package/styles/bootstrap5.css +31 -7
  33. package/styles/fabric-dark.css +2 -2
  34. package/styles/fabric.css +2 -2
  35. package/styles/fluent-dark.css +3001 -0
  36. package/styles/fluent-dark.scss +1 -0
  37. package/styles/fluent.css +3001 -0
  38. package/styles/fluent.scss +1 -0
  39. package/styles/highcontrast-light.css +2 -2
  40. package/styles/highcontrast.css +2 -2
  41. package/styles/material-dark.css +2 -2
  42. package/styles/material.css +2 -2
  43. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +19 -0
  44. package/styles/rich-text-editor/_bootstrap-definition.scss +19 -0
  45. package/styles/rich-text-editor/_bootstrap4-definition.scss +19 -0
  46. package/styles/rich-text-editor/_bootstrap5-definition.scss +24 -3
  47. package/styles/rich-text-editor/_fabric-dark-definition.scss +19 -0
  48. package/styles/rich-text-editor/_fabric-definition.scss +19 -0
  49. package/styles/rich-text-editor/_fluent-dark-definition.scss +1 -0
  50. package/styles/rich-text-editor/_fluent-definition.scss +42 -19
  51. package/styles/rich-text-editor/_highcontrast-definition.scss +19 -0
  52. package/styles/rich-text-editor/_highcontrast-light-definition.scss +19 -0
  53. package/styles/rich-text-editor/_layout.scss +96 -6
  54. package/styles/rich-text-editor/_material-dark-definition.scss +18 -1
  55. package/styles/rich-text-editor/_material-definition.scss +19 -0
  56. package/styles/rich-text-editor/_tailwind-definition.scss +26 -6
  57. package/styles/rich-text-editor/_theme.scss +17 -2
  58. package/styles/rich-text-editor/bootstrap-dark.css +6 -3
  59. package/styles/rich-text-editor/bootstrap.css +6 -3
  60. package/styles/rich-text-editor/bootstrap4.css +2 -2
  61. package/styles/rich-text-editor/bootstrap5-dark.css +30 -6
  62. package/styles/rich-text-editor/bootstrap5.css +31 -7
  63. package/styles/rich-text-editor/fabric-dark.css +2 -2
  64. package/styles/rich-text-editor/fabric.css +2 -2
  65. package/styles/rich-text-editor/fluent-dark.css +3001 -0
  66. package/styles/rich-text-editor/fluent-dark.scss +4 -0
  67. package/styles/rich-text-editor/fluent.css +3001 -0
  68. package/styles/rich-text-editor/fluent.scss +4 -0
  69. package/styles/rich-text-editor/highcontrast-light.css +2 -2
  70. package/styles/rich-text-editor/highcontrast.css +2 -2
  71. package/styles/rich-text-editor/icons/_fluent-dark.scss +1 -0
  72. package/styles/rich-text-editor/icons/_fluent.scss +74 -74
  73. package/styles/rich-text-editor/icons/_tailwind.scss +73 -74
  74. package/styles/rich-text-editor/material-dark.css +2 -2
  75. package/styles/rich-text-editor/material.css +2 -2
  76. package/styles/rich-text-editor/tailwind-dark.css +104 -85
  77. package/styles/rich-text-editor/tailwind.css +105 -86
  78. package/styles/tailwind-dark.css +104 -85
  79. package/styles/tailwind.css +105 -86
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 19.4.54
3
+ * version : 20.1.47
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. 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@19.4.53",
3
+ "_id": "@syncfusion/ej2-richtexteditor@19.7.5",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-wTMXB43eT3dngxxLXS+5BzGvEwh5tZOHKUd+5lLXgD0eWrFWAljm79JdfitOb89dyPBUGVHvbEcYbentqdKbgg==",
5
+ "_integrity": "sha512-qd8dxBBoB6NySpSez7cBo1QjzbpAmvbM3hS4N1NqHbVvaRjJWs8hnvOeCwDAqcS8U4KltG8Np81Ztg0Zsnn+zQ==",
6
6
  "_location": "/@syncfusion/ej2-richtexteditor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -26,8 +26,8 @@
26
26
  "/@syncfusion/ej2-react-richtexteditor",
27
27
  "/@syncfusion/ej2-vue-richtexteditor"
28
28
  ],
29
- "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-19.4.53.tgz",
30
- "_shasum": "f7a93f74a7396e02d0f4694f12c06a20e088ae84",
29
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-release/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-19.7.5.tgz",
30
+ "_shasum": "a9cbd4740f94fbe66b3fb49af4d63dc8fed5af77",
31
31
  "_spec": "@syncfusion/ej2-richtexteditor@*",
32
32
  "_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
33
33
  "author": {
@@ -38,13 +38,13 @@
38
38
  },
39
39
  "bundleDependencies": false,
40
40
  "dependencies": {
41
- "@syncfusion/ej2-base": "~19.4.52",
42
- "@syncfusion/ej2-buttons": "~19.4.53",
43
- "@syncfusion/ej2-filemanager": "~19.4.52",
44
- "@syncfusion/ej2-inputs": "~19.4.52",
45
- "@syncfusion/ej2-navigations": "~19.4.53",
46
- "@syncfusion/ej2-popups": "~19.4.53",
47
- "@syncfusion/ej2-splitbuttons": "~19.4.52"
41
+ "@syncfusion/ej2-base": "~20.1.47",
42
+ "@syncfusion/ej2-buttons": "~20.1.47",
43
+ "@syncfusion/ej2-filemanager": "~20.1.47",
44
+ "@syncfusion/ej2-inputs": "~20.1.47",
45
+ "@syncfusion/ej2-navigations": "~20.1.47",
46
+ "@syncfusion/ej2-popups": "~20.1.47",
47
+ "@syncfusion/ej2-splitbuttons": "~20.1.47"
48
48
  },
49
49
  "deprecated": false,
50
50
  "description": "Essential JS 2 RichTextEditor component",
@@ -70,6 +70,6 @@
70
70
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
71
71
  },
72
72
  "typings": "index.d.ts",
73
- "version": "19.4.54",
73
+ "version": "20.1.47",
74
74
  "sideEffects": false
75
75
  }
@@ -209,7 +209,8 @@ var ClearFormat = /** @class */ (function () {
209
209
  for (var index = 0; index < textNodes.length; index++) {
210
210
  var currentInlineNode = textNodes[index];
211
211
  var currentNode = void 0;
212
- while (!this.domNode.isBlockNode(currentInlineNode)) {
212
+ while (!this.domNode.isBlockNode(currentInlineNode) &&
213
+ (currentInlineNode.parentElement && !currentInlineNode.parentElement.classList.contains('e-img-inner'))) {
213
214
  currentNode = currentInlineNode;
214
215
  currentInlineNode = currentInlineNode.parentElement;
215
216
  }
@@ -223,7 +224,7 @@ var ClearFormat = /** @class */ (function () {
223
224
  ClearFormat.removeInlineParent = function (textNodes) {
224
225
  var nodes = InsertMethods.unwrap(textNodes);
225
226
  for (var index = 0; index < nodes.length; index++) {
226
- if (nodes[index].parentNode.childNodes.length === 1
227
+ if (nodes[index].parentNode.childNodes.length === 1 && !nodes[index].parentNode.classList.contains('e-img-inner')
227
228
  && IsFormatted.inlineTags.indexOf(nodes[index].parentNode.nodeName.toLocaleLowerCase()) > -1) {
228
229
  this.removeInlineParent(nodes[index].parentNode);
229
230
  }
@@ -218,7 +218,12 @@ var ImageCommand = /** @class */ (function () {
218
218
  ImageCommand.prototype.removeImage = function (e) {
219
219
  if (closest(e.item.selectNode[0], 'a')) {
220
220
  if (e.item.selectNode[0].parentElement.nodeName === 'A' && !isNOU(e.item.selectNode[0].parentElement.innerText)) {
221
- detach(e.item.selectNode[0]);
221
+ if (!isNOU(closest(e.item.selectNode[0], '.' + classes.CLASS_CAPTION))) {
222
+ detach(closest(e.item.selectNode[0], '.' + classes.CLASS_CAPTION));
223
+ }
224
+ else {
225
+ detach(e.item.selectNode[0]);
226
+ }
222
227
  }
223
228
  else {
224
229
  detach(closest(e.item.selectNode[0], 'a'));
@@ -39,6 +39,12 @@ var InsertHtml = /** @class */ (function () {
39
39
  nodeSelection.setSelectionText(docElement, range.startContainer.children[0], range.startContainer.children[0], 0, 0);
40
40
  range = nodeSelection.getRange(docElement);
41
41
  }
42
+ if (range.startContainer.nodeName === 'BR' && range.startOffset === 0 && range.startOffset === range.endOffset &&
43
+ range.startContainer === range.endContainer) {
44
+ var currentIndex = Array.prototype.slice.call(range.startContainer.parentElement.children).indexOf(range.startContainer);
45
+ nodeSelection.setSelectionText(docElement, range.startContainer.parentElement, range.startContainer.parentElement, currentIndex + 1, currentIndex + 1);
46
+ range = nodeSelection.getRange(docElement);
47
+ }
42
48
  var isCursor = range.startOffset === range.endOffset && range.startOffset === 0 &&
43
49
  range.startContainer === range.endContainer;
44
50
  var isCollapsed = range.collapsed;
@@ -222,7 +228,7 @@ var InsertHtml = /** @class */ (function () {
222
228
  else {
223
229
  var tempSpan = createElement('span', { className: 'tempSpan' });
224
230
  var nearestAnchor = closest(range.startContainer.parentElement, 'a');
225
- if (range.startContainer.nodeType === 3 && nearestAnchor) {
231
+ if (range.startContainer.nodeType === 3 && nearestAnchor && closest(nearestAnchor, 'span')) {
226
232
  var immediateBlockNode = this.getImmediateBlockNode(range.startContainer, editNode);
227
233
  if (immediateBlockNode.querySelectorAll('br').length > 0) {
228
234
  detach(immediateBlockNode.querySelector('br'));
@@ -374,7 +380,7 @@ var InsertHtml = /** @class */ (function () {
374
380
  var currentNode = nodes[nodes.length - 1];
375
381
  var splitedElm = void 0;
376
382
  if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR') && !isNOU(currentNode.parentElement) &&
377
- currentNode.parentElement.textContent.trim().length === 0 && (currentNode.parentElement === editNode || !node.classList.contains('pasteContent'))) {
383
+ currentNode.parentElement.textContent.trim().length === 0) {
378
384
  splitedElm = currentNode;
379
385
  }
380
386
  else {
@@ -74,6 +74,11 @@ var LinkCommand = /** @class */ (function () {
74
74
  else {
75
75
  var domSelection = new NodeSelection();
76
76
  var range = domSelection.getRange(this.parent.currentDocument);
77
+ if (range.endContainer.nodeName === '#text' && range.startContainer.textContent.length === (range.endOffset + 1) &&
78
+ range.endContainer.textContent.charAt(range.endOffset) === ' ' && range.endContainer.nextSibling.nodeName === 'A') {
79
+ domSelection.setSelectionText(this.parent.currentDocument, range.startContainer, range.endContainer, range.startOffset, range.endOffset + 1);
80
+ range = domSelection.getRange(this.parent.currentDocument);
81
+ }
77
82
  var text = isNOU(e.item.text) ? true : e.item.text.replace(/ /g, '').localeCompare(range.toString()
78
83
  .replace(/\n/g, ' ').replace(/ /g, '')) < 0;
79
84
  if (e.event && e.event.type === 'keydown' && (e.event.keyCode === 32
@@ -92,6 +92,9 @@ var Lists = /** @class */ (function () {
92
92
  range.endContainer.parentElement.closest('LI');
93
93
  if (!isNOU(startNode) && !isNOU(endNode) && startNode === endNode && startNode.tagName === 'LI' &&
94
94
  startNode.textContent.trim() === '' && startNode.querySelectorAll('IMG').length === 0) {
95
+ if (startNode.innerHTML.indexOf('&nbsp;') >= 0) {
96
+ return;
97
+ }
95
98
  if (startNode.textContent.charCodeAt(0) === 65279) {
96
99
  startNode.textContent = '';
97
100
  }
@@ -233,7 +236,7 @@ var Lists = /** @class */ (function () {
233
236
  e.event.stopPropagation();
234
237
  this.currentAction = this.getAction(nodes[0]);
235
238
  if (e.event.shiftKey) {
236
- this.revertList(nodes);
239
+ this.revertList(nodes, e);
237
240
  this.revertClean();
238
241
  }
239
242
  else {
@@ -395,6 +398,9 @@ var Lists = /** @class */ (function () {
395
398
  append([nestedElement], prevSibling);
396
399
  append([elements[i]], nestedElement);
397
400
  }
401
+ else if (prevSibling.tagName === 'OL' || prevSibling.tagName === 'UL') {
402
+ append([elements[i]], prevSibling);
403
+ }
398
404
  }
399
405
  }
400
406
  else {
@@ -407,6 +413,14 @@ var Lists = /** @class */ (function () {
407
413
  };
408
414
  Lists.prototype.applyListsHandler = function (e) {
409
415
  var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
416
+ if (range.startContainer === range.endContainer && range.startContainer === this.parent.editableElement &&
417
+ range.startOffset === range.endOffset && range.startOffset === 0 &&
418
+ this.parent.editableElement.textContent.length === 0 && (this.parent.editableElement.childNodes[0].nodeName != 'TABLE' &&
419
+ this.parent.editableElement.childNodes[0].nodeName != 'IMG')) {
420
+ var focusNode = range.startContainer.childNodes[0];
421
+ this.parent.nodeSelection.setSelectionText(this.parent.currentDocument, focusNode, focusNode, 0, 0);
422
+ range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
423
+ }
410
424
  this.saveSelection = this.parent.nodeSelection.save(range, this.parent.currentDocument);
411
425
  this.currentAction = e.subCommand;
412
426
  this.currentAction = e.subCommand = this.currentAction === 'NumberFormatList' ? 'OL' : this.currentAction === 'BulletFormatList' ? 'UL' : this.currentAction;
@@ -481,7 +495,7 @@ var Lists = /** @class */ (function () {
481
495
  listsNodes[i] = listsNodes[i].parentNode;
482
496
  }
483
497
  }
484
- this.applyLists(listsNodes, this.currentAction, e.selector, e.item);
498
+ this.applyLists(listsNodes, this.currentAction, e.selector, e.item, e);
485
499
  if (e.callBack) {
486
500
  e.callBack({
487
501
  requestType: this.currentAction,
@@ -502,10 +516,10 @@ var Lists = /** @class */ (function () {
502
516
  this.parent.nodeSelection.setSelectionText(this.parent.currentDocument, startElem, endElem, 0, 0);
503
517
  }
504
518
  };
505
- Lists.prototype.applyLists = function (elements, type, selector, item) {
519
+ Lists.prototype.applyLists = function (elements, type, selector, item, e) {
506
520
  var isReverse = true;
507
521
  if (this.isRevert(elements, type) && isNOU(item)) {
508
- this.revertList(elements);
522
+ this.revertList(elements, e);
509
523
  this.removeEmptyListElements();
510
524
  }
511
525
  else {
@@ -664,7 +678,7 @@ var Lists = /** @class */ (function () {
664
678
  }
665
679
  }
666
680
  };
667
- Lists.prototype.revertList = function (elements) {
681
+ Lists.prototype.revertList = function (elements, e) {
668
682
  var temp = [];
669
683
  for (var i = elements.length - 1; i >= 0; i--) {
670
684
  for (var j = i - 1; j >= 0; j--) {
@@ -714,7 +728,9 @@ var Lists = /** @class */ (function () {
714
728
  ' class="' + className + ' e-rte-wrap-inner"';
715
729
  var wrapper = '<' + CONSTANT.DEFAULT_TAG + wrapperclass +
716
730
  this.domNode.attributes(parentNode) + '></' + CONSTANT.DEFAULT_TAG + '>';
717
- this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
731
+ if (e.enterAction !== 'BR') {
732
+ this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
733
+ }
718
734
  }
719
735
  else if (this.domNode.contents(element)[0].nodeType === 3) {
720
736
  var replace = this.domNode.createTagString(CONSTANT.DEFAULT_TAG, parentNode, this.parent.domNode.encode(this.domNode.contents(element)[0].textContent));
@@ -110,6 +110,7 @@ var SelectionCommands = /** @class */ (function () {
110
110
  };
111
111
  SelectionCommands.insertCursorNode = function (docElement, domSelection, range, isFormatted, nodeCutter, format, value, endNode) {
112
112
  var cursorNodes = domSelection.getNodeCollection(range);
113
+ var domNode = new DOMNode(endNode, docElement);
113
114
  var cursorFormat = (cursorNodes.length > 0) ?
114
115
  (cursorNodes.length > 1 && range.startContainer === range.endContainer) ?
115
116
  this.getCursorFormat(isFormatted, cursorNodes, format, endNode) :
@@ -117,12 +118,17 @@ var SelectionCommands = /** @class */ (function () {
117
118
  var cursorNode = null;
118
119
  if (cursorFormat) {
119
120
  cursorNode = cursorNodes[0];
120
- if (cursorFormat.firstChild.textContent.charCodeAt(0) === 8203) {
121
+ if (cursorFormat.firstChild.textContent.charCodeAt(0) === 8203 && cursorFormat.firstChild.nodeType === 3) {
121
122
  var isCursorEqual = false;
122
123
  var regEx = new RegExp(String.fromCharCode(8203), 'g');
123
124
  var emptySpaceNode = void 0;
124
125
  if (cursorFormat.firstChild === cursorNode) {
125
- cursorNode.textContent = cursorNode.textContent.replace(regEx, '');
126
+ cursorNode.textContent = (cursorFormat.parentElement && (domNode.isBlockNode(cursorFormat.parentElement) &&
127
+ cursorFormat.parentElement.textContent.length <= 1 ? cursorFormat.parentElement.childElementCount > 1 :
128
+ cursorFormat.childElementCount === 0) &&
129
+ (cursorFormat.parentElement.textContent.length > 1 ||
130
+ cursorFormat.parentElement.firstChild && cursorFormat.parentElement.firstChild.nodeType === 1) ?
131
+ cursorNode.textContent : cursorNode.textContent.replace(regEx, ''));
126
132
  emptySpaceNode = cursorNode;
127
133
  isCursorEqual = true;
128
134
  }
@@ -182,7 +182,7 @@ var TableCommand = /** @class */ (function () {
182
182
  var tdElement = createElement('td');
183
183
  tdElement.appendChild(createElement('br'));
184
184
  newRow.appendChild(tdElement);
185
- tdElement.setAttribute('style', allCells[(isHeaderSelect && isBelow) ? (minVal + 1) : minVal][i].getAttribute('style'));
185
+ tdElement.setAttribute('style', allCells[(isHeaderSelect && isBelow) ? allCells[(minVal + 1)] ? (minVal + 1) : minVal : minVal][i].getAttribute('style'));
186
186
  }
187
187
  }
188
188
  // eslint-disable-next-line
@@ -566,7 +566,8 @@ var TableCommand = /** @class */ (function () {
566
566
  if (min < (max = Math.min(max, eleArray.length - 1))) {
567
567
  for (rowValue = min; rowValue <= max; rowValue++) {
568
568
  // eslint-disable-next-line
569
- if (!(min < rowValue && eleArray[rowValue][0] === eleArray[rowValue - 1][0]) && 1 < (index = Math.min(parseInt(eleArray[rowValue][0].getAttribute('rowspan'), 10) || 1, max - min + 1)) && eleArray[rowValue][0] === eleArray[rowValue + 1][0]) {
569
+ if (!(min < rowValue && eleArray[rowValue][0] === eleArray[rowValue - 1][0]) && eleArray[rowValue][0] &&
570
+ 1 < (index = Math.min(parseInt(eleArray[rowValue][0].getAttribute('rowspan'), 10) || 1, max - min + 1)) && eleArray[rowValue][0] === eleArray[rowValue + 1][0]) {
570
571
  for (count = index - 1, colIndex = 1; colIndex < eleArray[0].length; colIndex++) {
571
572
  if (eleArray[rowValue][colIndex] !== eleArray[rowValue][colIndex - 1]) {
572
573
  for (rowMin = rowValue; rowMin < rowValue + index; rowMin++) {
@@ -608,10 +609,10 @@ var TableCommand = /** @class */ (function () {
608
609
  };
609
610
  TableCommand.prototype.mergeCellContent = function () {
610
611
  var selectedCells = this.curTable.querySelectorAll('.e-cell-select');
611
- var innerHtml = selectedCells[0].innerHTML;
612
- for (var i = 1; i < selectedCells.length - 1; i++) {
612
+ var innerHtml = selectedCells[0].innerHTML === '<br>' ? '' : selectedCells[0].innerHTML;
613
+ for (var i = 1; i < selectedCells.length; i++) {
613
614
  if ('<br>' !== selectedCells[i].innerHTML) {
614
- innerHtml = innerHtml + selectedCells[i].innerHTML;
615
+ innerHtml = innerHtml ? innerHtml + '<br>' + selectedCells[i].innerHTML : innerHtml + selectedCells[i].innerHTML;
615
616
  }
616
617
  }
617
618
  selectedCells[0].innerHTML = innerHtml;
@@ -34,8 +34,8 @@ var Count = /** @class */ (function () {
34
34
  }
35
35
  };
36
36
  Count.prototype.appendCount = function () {
37
- var htmlText = this.parent.editorMode === 'Markdown' ? this.editPanel.value.trim() :
38
- this.editPanel.textContent.trim();
37
+ var htmlText = this.parent.editorMode === 'Markdown' ? this.editPanel.value :
38
+ this.editPanel.textContent;
39
39
  if (this.parent.editorMode !== 'Markdown' && htmlText.indexOf('\u200B') !== -1) {
40
40
  this.htmlLength = htmlText.replace(/\u200B/g, '').length;
41
41
  }
@@ -159,7 +159,7 @@ var DropDownButtons = /** @class */ (function () {
159
159
  }
160
160
  _this.alignDropDown = _this.toolbarRenderer.renderDropDownButton({
161
161
  iconCss: 'e-justify-left e-icons',
162
- cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS,
162
+ cssClass: classes.CLS_DROPDOWN_POPUP + ' ' + classes.CLS_DROPDOWN_ITEMS + ' ' + classes.CLS_ALIGN_TB_BTN,
163
163
  itemName: 'Alignments', items: model.alignmentItems, element: targetElement
164
164
  });
165
165
  break;
@@ -106,7 +106,9 @@ var HtmlEditor = /** @class */ (function () {
106
106
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), range.startContainer, pointer);
107
107
  }
108
108
  if (!isNOU(range.startContainer.previousSibling) && !isNOU(range.startContainer.previousSibling.parentElement) &&
109
- range.startContainer.parentElement === range.startContainer.previousSibling.parentElement && range.startContainer.previousSibling.textContent.charCodeAt(0) === 8203) {
109
+ range.startContainer.parentElement === range.startContainer.previousSibling.parentElement &&
110
+ range.startContainer.previousSibling.textContent.charCodeAt(0) === 8203 &&
111
+ range.startContainer.previousSibling.textContent.length <= 1) {
110
112
  range.startContainer.previousSibling.textContent = range.startContainer.previousSibling.textContent.replace(regEx, '');
111
113
  }
112
114
  if (range.endContainer.textContent.charCodeAt(range.endOffset) === 8203) {
@@ -197,6 +199,7 @@ var HtmlEditor = /** @class */ (function () {
197
199
  if (!this.isImageDelete) {
198
200
  args.preventDefault();
199
201
  }
202
+ args.preventDefault();
200
203
  }
201
204
  };
202
205
  HtmlEditor.prototype.isOrderedList = function (editorValue) {
@@ -324,6 +324,11 @@ export declare const CLS_FONT_SIZE_TB_BTN: string;
324
324
  /**
325
325
  * @hidden
326
326
 
327
+ */
328
+ export declare const CLS_ALIGN_TB_BTN: string;
329
+ /**
330
+ * @hidden
331
+
327
332
  */
328
333
  export declare const CLS_FONT_COLOR_TARGET: string;
329
334
  /**
@@ -324,6 +324,11 @@ export var CLS_FONT_SIZE_TB_BTN = 'e-font-size-tbar-btn';
324
324
  /**
325
325
  * @hidden
326
326
 
327
+ */
328
+ export var CLS_ALIGN_TB_BTN = 'e-alignment-tbar-btn';
329
+ /**
330
+ * @hidden
331
+
327
332
  */
328
333
  export var CLS_FONT_COLOR_TARGET = 'e-rte-fontcolor-element';
329
334
  /**
@@ -1211,7 +1211,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1211
1211
  this.inputElement.parentElement.insertBefore(this.placeHolderWrapper, this.inputElement);
1212
1212
  }
1213
1213
  attributes(this.placeHolderWrapper, {
1214
- 'style': 'font-size: 14px; padding: 16px; margin-left: 0px; margin-right: 0px;'
1214
+ 'style': 'font-size: 14px; margin-left: 0px; margin-right: 0px;'
1215
1215
  });
1216
1216
  }
1217
1217
  this.placeHolderWrapper.innerHTML = this.placeholder;
@@ -1451,7 +1451,8 @@ var RichTextEditor = /** @class */ (function (_super) {
1451
1451
  };
1452
1452
  RichTextEditor.prototype.setValue = function () {
1453
1453
  if (this.valueTemplate) {
1454
- if (typeof this.valueTemplate === 'string') {
1454
+ var regEx = new RegExp(/<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i);
1455
+ if (regEx.test(this.valueTemplate)) {
1455
1456
  this.setProperties({ value: this.valueTemplate });
1456
1457
  }
1457
1458
  else {
@@ -2037,7 +2038,7 @@ var RichTextEditor = /** @class */ (function (_super) {
2037
2038
  RichTextEditor.prototype.restrict = function (e) {
2038
2039
  if (this.maxLength >= 0) {
2039
2040
  var element = this.editorMode === 'Markdown' ? this.contentModule.getText() :
2040
- e.currentTarget.textContent.trim();
2041
+ e.currentTarget.textContent;
2041
2042
  var array = [8, 16, 17, 37, 38, 39, 40, 46, 65];
2042
2043
  var arrayKey = void 0;
2043
2044
  for (var i = 0; i <= array.length - 1; i++) {
@@ -286,6 +286,7 @@ var Image = /** @class */ (function () {
286
286
  Image.prototype.calcPos = function (elem) {
287
287
  var ignoreOffset = ['TD', 'TH', 'TABLE', 'A'];
288
288
  var parentOffset = { top: 0, left: 0 };
289
+ var elementOffset;
289
290
  var doc = elem.ownerDocument;
290
291
  var offsetParent = ((elem.offsetParent && (elem.offsetParent.classList.contains('e-img-caption') ||
291
292
  ignoreOffset.indexOf(elem.offsetParent.tagName) > -1)) ?
@@ -299,10 +300,19 @@ var Image = /** @class */ (function () {
299
300
  // eslint-disable-next-line
300
301
  parentOffset = offsetParent.getBoundingClientRect();
301
302
  }
302
- return {
303
- top: elem.offsetTop,
304
- left: elem.offsetLeft
305
- };
303
+ if (elem.offsetParent && (elem.offsetParent.classList.contains('e-img-caption'))) {
304
+ elementOffset = elem.getBoundingClientRect();
305
+ return {
306
+ top: elementOffset.top - parentOffset.top,
307
+ left: elementOffset.left - parentOffset.left
308
+ };
309
+ }
310
+ else {
311
+ return {
312
+ top: elem.offsetTop,
313
+ left: elem.offsetLeft
314
+ };
315
+ }
306
316
  };
307
317
  Image.prototype.setAspectRatio = function (img, expectedX, expectedY, e) {
308
318
  if (isNullOrUndefined(img.width)) {
@@ -312,7 +322,7 @@ var Image = /** @class */ (function () {
312
322
  parseInt(img.style.width, 10) : img.width;
313
323
  var height = img.style.height !== '' ? parseInt(img.style.height, 10) : img.height;
314
324
  if (width > height) {
315
- img.style.minWidth = '20px';
325
+ img.style.minWidth = this.parent.insertImageSettings.minWidth === 0 ? '20px' : formatUnit(this.parent.insertImageSettings.minWidth);
316
326
  if (this.parent.insertImageSettings.resizeByPercent) {
317
327
  if (parseInt('' + img.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
318
328
  var percentageValue = this.pixToPerc((width / height * expectedY), (img.previousElementSibling || img.parentElement));
@@ -635,6 +645,10 @@ var Image = /** @class */ (function () {
635
645
  range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_CAPINLINE))) {
636
646
  detach(range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_CAPINLINE));
637
647
  }
648
+ else if (range.startContainer.nodeType === 1 &&
649
+ range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_IMGBREAK)) {
650
+ detach(range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_IMGBREAK));
651
+ }
638
652
  }
639
653
  break;
640
654
  case 'insert-image':
@@ -805,6 +819,8 @@ var Image = /** @class */ (function () {
805
819
  if (this.parent.quickToolbarModule.imageQTBar) {
806
820
  if (e.isNotify) {
807
821
  setTimeout(function () {
822
+ _this.parent.formatter.editorManager.nodeSelection.Clear(_this.contentModule.getDocument());
823
+ _this.parent.formatter.editorManager.nodeSelection.setSelectionContents(_this.contentModule.getDocument(), target);
808
824
  _this.quickToolObj.imageQTBar.showPopup(args.pageX, pageY, target);
809
825
  }, 400);
810
826
  }
@@ -1846,7 +1862,8 @@ var Image = /** @class */ (function () {
1846
1862
  if (activePopupElement) {
1847
1863
  activePopupElement.classList.add(classes.CLS_HIDE);
1848
1864
  }
1849
- if (e.dataTransfer.files.length > 0) { //For external image drag and drop
1865
+ var imgElement = this.parent.inputElement.ownerDocument.querySelector('.' + classes.CLS_RTE_DRAG_IMAGE);
1866
+ if (e.dataTransfer.files.length > 0 && imgElement === null) { //For external image drag and drop
1850
1867
  if (e.dataTransfer.files.length > 1) {
1851
1868
  return;
1852
1869
  }
@@ -1869,7 +1886,6 @@ var Image = /** @class */ (function () {
1869
1886
  }
1870
1887
  else { //For internal image drag and drop
1871
1888
  var range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
1872
- var imgElement = this.parent.inputElement.ownerDocument.querySelector('.' + classes.CLS_RTE_DRAG_IMAGE);
1873
1889
  if (imgElement && imgElement.tagName === 'IMG') {
1874
1890
  if (imgElement.nextElementSibling) {
1875
1891
  if (imgElement.nextElementSibling.classList.contains(classes.CLS_IMG_INNER)) {
@@ -301,7 +301,7 @@ var Table = /** @class */ (function () {
301
301
  ele.classList.add(classes.CLS_TABLE_SEL);
302
302
  this.addRow(selection, event, true);
303
303
  ele.classList.remove(classes.CLS_TABLE_SEL);
304
- nextElement = nextElement.parentElement.nextSibling.firstChild;
304
+ nextElement = nextElement.parentElement.nextSibling ? nextElement.parentElement.nextSibling.firstChild : nextElement.parentElement.firstChild;
305
305
  // eslint-disable-next-line
306
306
  (nextElement.textContent.trim() !== '' && closest(nextElement, 'td')) ?
307
307
  selection.setSelectionNode(this.contentModule.getDocument(), nextElement) :
@@ -511,7 +511,7 @@ var Table = /** @class */ (function () {
511
511
  return;
512
512
  }
513
513
  var target = e.target || e.targetTouches[0].target;
514
- var closestTable = closest(target, 'table');
514
+ var closestTable = closest(target, 'table.e-rte-table');
515
515
  if (!isNOU(this.curTable) && !isNOU(closestTable) && closestTable !== this.curTable) {
516
516
  this.removeResizeElement();
517
517
  this.removeHelper(e);
@@ -590,6 +590,7 @@ var Table = /** @class */ (function () {
590
590
  var offset = elem.getBoundingClientRect();
591
591
  var doc = elem.ownerDocument;
592
592
  var offsetParent = elem.offsetParent || doc.documentElement;
593
+ var isNestedTable = false;
593
594
  while (offsetParent &&
594
595
  (offsetParent === doc.body || offsetParent === doc.documentElement) &&
595
596
  offsetParent.style.position === 'static') {
@@ -597,15 +598,29 @@ var Table = /** @class */ (function () {
597
598
  }
598
599
  if (offsetParent.nodeName === 'TD' && elem.nodeName === 'TABLE') {
599
600
  offsetParent = closest(offsetParent, '.e-rte-content');
601
+ isNestedTable = true;
600
602
  }
601
603
  if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
602
604
  // eslint-disable-next-line
603
605
  parentOffset = offsetParent.getBoundingClientRect();
604
606
  }
605
- return {
606
- top: elem.offsetTop,
607
- left: elem.offsetLeft
608
- };
607
+ if (isNestedTable) {
608
+ isNestedTable = false;
609
+ var topValue = this.parent.inputElement && this.parent.inputElement.scrollTop > 0 ?
610
+ (this.parent.inputElement.scrollTop + offset.top) - parentOffset.top : offset.top - parentOffset.top;
611
+ var leftValue = this.parent.inputElement && this.parent.inputElement.scrollLeft > 0 ?
612
+ (this.parent.inputElement.scrollLeft + offset.left) - parentOffset.left : offset.left - parentOffset.left;
613
+ return {
614
+ top: topValue,
615
+ left: leftValue
616
+ };
617
+ }
618
+ else {
619
+ return {
620
+ top: elem.offsetTop,
621
+ left: elem.offsetLeft
622
+ };
623
+ }
609
624
  };
610
625
  Table.prototype.getPointX = function (e) {
611
626
  if (e.touches && e.touches.length) {
@@ -296,6 +296,9 @@ var NodeSelection = /** @class */ (function () {
296
296
  node = node && node.childNodes[num[index]];
297
297
  }
298
298
  if (node && constant >= 0 && node.nodeName !== 'html') {
299
+ if (node.nodeType === 3 && node.nodeValue.replace(/\u00a0/g, '&nbsp;') === '&nbsp;') {
300
+ constant = node.textContent.length;
301
+ }
299
302
  range[isvalid ? 'setStart' : 'setEnd'](node, constant);
300
303
  }
301
304
  return range;
@@ -756,6 +756,7 @@
756
756
  line-height: 18px;
757
757
  opacity: 00.54;
758
758
  overflow: hidden;
759
+ padding: 16px;
759
760
  position: absolute;
760
761
  text-align: start;
761
762
  top: 0;
@@ -920,10 +921,9 @@
920
921
  .e-richtexteditor .e-rte-character-count {
921
922
  bottom: 0;
922
923
  color: #f0f0f0;
923
- font-family: 'Times New Roman', Georgia, Serif;
924
924
  font-size: 14px;
925
925
  margin-right: 30px;
926
- opacity: 00.54;
926
+ opacity: 0.54;
927
927
  padding-bottom: 2px;
928
928
  position: absolute;
929
929
  right: 0;
@@ -2388,7 +2388,10 @@
2388
2388
  padding: 0;
2389
2389
  }
2390
2390
 
2391
- .e-rte-quick-toolbar.e-rte-toolbar.e-toolbar .e-toolbar-items .e-toolbar-item .e-rte-backgroundcolor-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control {
2391
+ .e-rte-quick-toolbar.e-toolbar .e-toolbar-items .e-toolbar-item .e-rte-backgroundcolor-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control,
2392
+ .e-rte-quick-toolbar.e-rte-toolbar.e-toolbar .e-toolbar-items .e-toolbar-item .e-rte-backgroundcolor-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control:hover,
2393
+ .e-rte-quick-toolbar.e-rte-toolbar.e-toolbar .e-toolbar-items .e-toolbar-item .e-rte-backgroundcolor-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control:active,
2394
+ .e-rte-quick-toolbar.e-rte-toolbar.e-toolbar .e-toolbar-items .e-toolbar-item .e-rte-backgroundcolor-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control.e-active {
2392
2395
  padding-left: 0;
2393
2396
  padding-right: 0;
2394
2397
  }
@@ -902,6 +902,7 @@
902
902
  line-height: 18px;
903
903
  opacity: 00.54;
904
904
  overflow: hidden;
905
+ padding: 16px;
905
906
  position: absolute;
906
907
  text-align: start;
907
908
  top: 0;
@@ -1066,10 +1067,9 @@
1066
1067
  .e-richtexteditor .e-rte-character-count {
1067
1068
  bottom: 0;
1068
1069
  color: #000;
1069
- font-family: 'Times New Roman', Georgia, Serif;
1070
1070
  font-size: 14px;
1071
1071
  margin-right: 30px;
1072
- opacity: 00.54;
1072
+ opacity: 0.54;
1073
1073
  padding-bottom: 2px;
1074
1074
  position: absolute;
1075
1075
  right: 0;
@@ -2534,7 +2534,10 @@
2534
2534
  padding: 0;
2535
2535
  }
2536
2536
 
2537
- .e-rte-quick-toolbar.e-rte-toolbar.e-toolbar .e-toolbar-items .e-toolbar-item .e-rte-backgroundcolor-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control {
2537
+ .e-rte-quick-toolbar.e-toolbar .e-toolbar-items .e-toolbar-item .e-rte-backgroundcolor-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control,
2538
+ .e-rte-quick-toolbar.e-rte-toolbar.e-toolbar .e-toolbar-items .e-toolbar-item .e-rte-backgroundcolor-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control:hover,
2539
+ .e-rte-quick-toolbar.e-rte-toolbar.e-toolbar .e-toolbar-items .e-toolbar-item .e-rte-backgroundcolor-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control:active,
2540
+ .e-rte-quick-toolbar.e-rte-toolbar.e-toolbar .e-toolbar-items .e-toolbar-item .e-rte-backgroundcolor-dropdown.e-dropdown-btn.e-tbar-btn.e-btn.e-control.e-active {
2538
2541
  padding-left: 0;
2539
2542
  padding-right: 0;
2540
2543
  }
@@ -1035,6 +1035,7 @@
1035
1035
  line-height: 18px;
1036
1036
  opacity: 00.54;
1037
1037
  overflow: hidden;
1038
+ padding: 16px;
1038
1039
  position: absolute;
1039
1040
  text-align: start;
1040
1041
  top: 0;
@@ -1199,10 +1200,9 @@
1199
1200
  .e-richtexteditor .e-rte-character-count {
1200
1201
  bottom: 0;
1201
1202
  color: #6c757d;
1202
- font-family: 'Times New Roman', Georgia, Serif;
1203
1203
  font-size: 14px;
1204
1204
  margin-right: 30px;
1205
- opacity: 00.54;
1205
+ opacity: 1;
1206
1206
  padding-bottom: 2px;
1207
1207
  position: absolute;
1208
1208
  right: 0;