@syncfusion/ej2-richtexteditor 19.4.55 → 20.1.48

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 (81) hide show
  1. package/CHANGELOG.md +7 -65
  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 +121 -40
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +119 -38
  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/base/constant.d.ts +6 -0
  13. package/src/editor-manager/base/constant.js +6 -0
  14. package/src/editor-manager/plugin/clearformat.js +3 -2
  15. package/src/editor-manager/plugin/inserthtml.js +9 -5
  16. package/src/editor-manager/plugin/lists.js +18 -6
  17. package/src/editor-manager/plugin/ms-word-clean-up.js +6 -0
  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 +3 -2
  22. package/src/rich-text-editor/actions/paste-clean-up.d.ts +1 -0
  23. package/src/rich-text-editor/actions/paste-clean-up.js +11 -1
  24. package/src/rich-text-editor/base/classes.d.ts +5 -0
  25. package/src/rich-text-editor/base/classes.js +5 -0
  26. package/src/rich-text-editor/base/rich-text-editor.js +4 -3
  27. package/src/rich-text-editor/renderer/image-module.js +21 -5
  28. package/src/rich-text-editor/renderer/table-module.js +20 -5
  29. package/src/selection/selection.js +3 -0
  30. package/styles/bootstrap-dark.css +6 -3
  31. package/styles/bootstrap.css +6 -3
  32. package/styles/bootstrap4.css +2 -2
  33. package/styles/bootstrap5-dark.css +30 -6
  34. package/styles/bootstrap5.css +31 -7
  35. package/styles/fabric-dark.css +2 -2
  36. package/styles/fabric.css +2 -2
  37. package/styles/fluent-dark.css +3001 -0
  38. package/styles/fluent-dark.scss +1 -0
  39. package/styles/fluent.css +3001 -0
  40. package/styles/fluent.scss +1 -0
  41. package/styles/highcontrast-light.css +2 -2
  42. package/styles/highcontrast.css +2 -2
  43. package/styles/material-dark.css +2 -2
  44. package/styles/material.css +2 -2
  45. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +19 -0
  46. package/styles/rich-text-editor/_bootstrap-definition.scss +19 -0
  47. package/styles/rich-text-editor/_bootstrap4-definition.scss +19 -0
  48. package/styles/rich-text-editor/_bootstrap5-definition.scss +24 -3
  49. package/styles/rich-text-editor/_fabric-dark-definition.scss +19 -0
  50. package/styles/rich-text-editor/_fabric-definition.scss +19 -0
  51. package/styles/rich-text-editor/_fluent-dark-definition.scss +1 -0
  52. package/styles/rich-text-editor/_fluent-definition.scss +42 -19
  53. package/styles/rich-text-editor/_highcontrast-definition.scss +19 -0
  54. package/styles/rich-text-editor/_highcontrast-light-definition.scss +19 -0
  55. package/styles/rich-text-editor/_layout.scss +96 -6
  56. package/styles/rich-text-editor/_material-dark-definition.scss +18 -1
  57. package/styles/rich-text-editor/_material-definition.scss +19 -0
  58. package/styles/rich-text-editor/_tailwind-definition.scss +26 -6
  59. package/styles/rich-text-editor/_theme.scss +17 -2
  60. package/styles/rich-text-editor/bootstrap-dark.css +6 -3
  61. package/styles/rich-text-editor/bootstrap.css +6 -3
  62. package/styles/rich-text-editor/bootstrap4.css +2 -2
  63. package/styles/rich-text-editor/bootstrap5-dark.css +30 -6
  64. package/styles/rich-text-editor/bootstrap5.css +31 -7
  65. package/styles/rich-text-editor/fabric-dark.css +2 -2
  66. package/styles/rich-text-editor/fabric.css +2 -2
  67. package/styles/rich-text-editor/fluent-dark.css +3001 -0
  68. package/styles/rich-text-editor/fluent-dark.scss +4 -0
  69. package/styles/rich-text-editor/fluent.css +3001 -0
  70. package/styles/rich-text-editor/fluent.scss +4 -0
  71. package/styles/rich-text-editor/highcontrast-light.css +2 -2
  72. package/styles/rich-text-editor/highcontrast.css +2 -2
  73. package/styles/rich-text-editor/icons/_fluent-dark.scss +1 -0
  74. package/styles/rich-text-editor/icons/_fluent.scss +74 -74
  75. package/styles/rich-text-editor/icons/_tailwind.scss +73 -74
  76. package/styles/rich-text-editor/material-dark.css +2 -2
  77. package/styles/rich-text-editor/material.css +2 -2
  78. package/styles/rich-text-editor/tailwind-dark.css +104 -85
  79. package/styles/rich-text-editor/tailwind.css +105 -86
  80. package/styles/tailwind-dark.css +104 -85
  81. package/styles/tailwind.css +105 -86
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 19.4.55
3
+ * version : 20.1.48
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.54",
3
+ "_id": "@syncfusion/ej2-richtexteditor@20.1.47",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-E70Pq8AxDcCeqVsy3fVzowvlB2+hDCyW3MUz4uUZclwpVisLIjWm9otu8fNK3bhw6HBUkAqGSx3BxRAFMzlfUQ==",
5
+ "_integrity": "sha512-+JqSmzz8uh/Xuf7mVptZllX9DZbzfOt9enpA9JftvQiFGKQVDeZwRW2J9qrdtumUBBMmbasVPWkvpMMoLy7w2g==",
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.54.tgz",
30
- "_shasum": "ddaef5ddb9d9ec7598dfc300179180bd1fcbe491",
29
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-20.1.47.tgz",
30
+ "_shasum": "7d854e478b53c30642348539aa9a389c4df071f9",
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.55",
43
- "@syncfusion/ej2-filemanager": "~19.4.52",
44
- "@syncfusion/ej2-inputs": "~19.4.52",
45
- "@syncfusion/ej2-navigations": "~19.4.55",
46
- "@syncfusion/ej2-popups": "~19.4.53",
47
- "@syncfusion/ej2-splitbuttons": "~19.4.52"
41
+ "@syncfusion/ej2-base": "~20.1.48",
42
+ "@syncfusion/ej2-buttons": "~20.1.47",
43
+ "@syncfusion/ej2-filemanager": "~20.1.47",
44
+ "@syncfusion/ej2-inputs": "~20.1.48",
45
+ "@syncfusion/ej2-navigations": "~20.1.48",
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.55",
73
+ "version": "20.1.48",
74
74
  "sideEffects": false
75
75
  }
@@ -74,3 +74,9 @@ export declare const INSERT_TEXT_TYPE: string;
74
74
  * @hidden
75
75
  */
76
76
  export declare const CLEAR_TYPE: string;
77
+ /**
78
+ * Self closing tags
79
+ *
80
+ * @hidden
81
+ */
82
+ export declare const SELF_CLOSING_TAGS: string[];
@@ -79,3 +79,9 @@ export var INSERT_TEXT_TYPE = 'insert-text-type';
79
79
  * @hidden
80
80
  */
81
81
  export var CLEAR_TYPE = 'clear-type';
82
+ /**
83
+ * Self closing tags
84
+ *
85
+ * @hidden
86
+ */
87
+ export var SELF_CLOSING_TAGS = ['area', 'base', 'br', 'embed', 'hr', 'img', 'input', 'param', 'source', 'track', 'wbr', 'iframe', 'td'];
@@ -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
  }
@@ -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 {
@@ -431,9 +437,7 @@ var InsertHtml = /** @class */ (function () {
431
437
  InsertHtml.removeEmptyElements = function (element) {
432
438
  var emptyElements = element.querySelectorAll(':empty');
433
439
  for (var i = 0; i < emptyElements.length; i++) {
434
- if (emptyElements[i].tagName !== 'IMG' && emptyElements[i].tagName !== 'BR' &&
435
- emptyElements[i].tagName !== 'IFRAME' && emptyElements[i].tagName !== 'TD' &&
436
- emptyElements[i].tagName !== 'SOURCE' && emptyElements[i].tagName !== 'HR') {
440
+ if (CONSTANT.SELF_CLOSING_TAGS.indexOf(emptyElements[i].tagName.toLowerCase()) < 0) {
437
441
  var detachableElement = this.findDetachEmptyElem(emptyElements[i]);
438
442
  if (!isNOU(detachableElement)) {
439
443
  detach(detachableElement);
@@ -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
  }
@@ -137,6 +140,10 @@ var Lists = /** @class */ (function () {
137
140
  (startNode.textContent.length === 1 && startNode.textContent.charCodeAt(0) === 8203))) {
138
141
  startNode.textContent = '';
139
142
  }
143
+ if (startNode === endNode && startNode.tagName === 'LI' && startNode.textContent.length === 0 &&
144
+ isNOU(startNode.previousElementSibling)) {
145
+ startNode.removeAttribute('style');
146
+ }
140
147
  if (startNode === endNode && startNode.textContent === '') {
141
148
  if (startNode.parentElement.tagName === 'LI' && endNode.parentElement.tagName === 'LI') {
142
149
  detach(startNode);
@@ -233,7 +240,7 @@ var Lists = /** @class */ (function () {
233
240
  e.event.stopPropagation();
234
241
  this.currentAction = this.getAction(nodes[0]);
235
242
  if (e.event.shiftKey) {
236
- this.revertList(nodes);
243
+ this.revertList(nodes, e);
237
244
  this.revertClean();
238
245
  }
239
246
  else {
@@ -395,6 +402,9 @@ var Lists = /** @class */ (function () {
395
402
  append([nestedElement], prevSibling);
396
403
  append([elements[i]], nestedElement);
397
404
  }
405
+ else if (prevSibling.tagName === 'OL' || prevSibling.tagName === 'UL') {
406
+ append([elements[i]], prevSibling);
407
+ }
398
408
  }
399
409
  }
400
410
  else {
@@ -489,7 +499,7 @@ var Lists = /** @class */ (function () {
489
499
  listsNodes[i] = listsNodes[i].parentNode;
490
500
  }
491
501
  }
492
- this.applyLists(listsNodes, this.currentAction, e.selector, e.item);
502
+ this.applyLists(listsNodes, this.currentAction, e.selector, e.item, e);
493
503
  if (e.callBack) {
494
504
  e.callBack({
495
505
  requestType: this.currentAction,
@@ -510,10 +520,10 @@ var Lists = /** @class */ (function () {
510
520
  this.parent.nodeSelection.setSelectionText(this.parent.currentDocument, startElem, endElem, 0, 0);
511
521
  }
512
522
  };
513
- Lists.prototype.applyLists = function (elements, type, selector, item) {
523
+ Lists.prototype.applyLists = function (elements, type, selector, item, e) {
514
524
  var isReverse = true;
515
525
  if (this.isRevert(elements, type) && isNOU(item)) {
516
- this.revertList(elements);
526
+ this.revertList(elements, e);
517
527
  this.removeEmptyListElements();
518
528
  }
519
529
  else {
@@ -672,7 +682,7 @@ var Lists = /** @class */ (function () {
672
682
  }
673
683
  }
674
684
  };
675
- Lists.prototype.revertList = function (elements) {
685
+ Lists.prototype.revertList = function (elements, e) {
676
686
  var temp = [];
677
687
  for (var i = elements.length - 1; i >= 0; i--) {
678
688
  for (var j = i - 1; j >= 0; j--) {
@@ -722,7 +732,9 @@ var Lists = /** @class */ (function () {
722
732
  ' class="' + className + ' e-rte-wrap-inner"';
723
733
  var wrapper = '<' + CONSTANT.DEFAULT_TAG + wrapperclass +
724
734
  this.domNode.attributes(parentNode) + '></' + CONSTANT.DEFAULT_TAG + '>';
725
- this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
735
+ if (e.enterAction !== 'BR') {
736
+ this.domNode.wrapInner(element, this.domNode.parseHTMLFragment(wrapper));
737
+ }
726
738
  }
727
739
  else if (this.domNode.contents(element)[0].nodeType === 3) {
728
740
  var replace = this.domNode.createTagString(CONSTANT.DEFAULT_TAG, parentNode, this.parent.domNode.encode(this.domNode.contents(element)[0].textContent));
@@ -110,6 +110,12 @@ var MsWordPaste = /** @class */ (function () {
110
110
  MsWordPaste.prototype.imageConversion = function (elm, rtfData) {
111
111
  this.checkVShape(elm);
112
112
  var imgElem = elm.querySelectorAll('img');
113
+ for (var i = 0; i < imgElem.length; i++) {
114
+ if (!isNOU(imgElem[i].getAttribute('v:shapes')) && imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0) {
115
+ detach(imgElem[i]);
116
+ }
117
+ }
118
+ imgElem = elm.querySelectorAll('img');
113
119
  var imgSrc = [];
114
120
  var base64Src = [];
115
121
  var imgName = [];
@@ -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;
@@ -199,6 +199,7 @@ var HtmlEditor = /** @class */ (function () {
199
199
  if (!this.isImageDelete) {
200
200
  args.preventDefault();
201
201
  }
202
+ args.preventDefault();
202
203
  }
203
204
  };
204
205
  HtmlEditor.prototype.isOrderedList = function (editorValue) {
@@ -245,8 +246,8 @@ var HtmlEditor = /** @class */ (function () {
245
246
  }
246
247
  }
247
248
  }
248
- else if (this.rangeElement.tagName === 'TABLE' || (!isNullOrUndefined(this.rangeElement.previousElementSibling) &&
249
- this.rangeElement.previousElementSibling.tagName === 'TABLE')) {
249
+ else if (this.rangeElement === this.parent.inputElement || this.rangeElement.tagName === 'TABLE' ||
250
+ (!isNullOrUndefined(this.rangeElement.previousElementSibling) && this.rangeElement.previousElementSibling.tagName === 'TABLE')) {
250
251
  return;
251
252
  }
252
253
  else {
@@ -47,6 +47,7 @@ export declare class PasteCleanup {
47
47
  private selectFormatting;
48
48
  private pasteDialog;
49
49
  private destroyDialog;
50
+ private cleanAppleClass;
50
51
  private formatting;
51
52
  private addTempClass;
52
53
  private removeTempClass;
@@ -77,7 +77,9 @@ var PasteCleanup = /** @class */ (function () {
77
77
  this.containsHtml = htmlRegex.test(value);
78
78
  var file = e && e.args.clipboardData &&
79
79
  e.args.clipboardData.items.length > 0 ?
80
- e.args.clipboardData.items[0].getAsFile() : null;
80
+ (e.args.clipboardData.items[0].getAsFile() === null ?
81
+ (!isNOU(e.args.clipboardData.items[1]) ? e.args.clipboardData.items[1].getAsFile() : null) :
82
+ e.args.clipboardData.items[0].getAsFile()) : null;
81
83
  this.parent.notify(events.paste, {
82
84
  file: file,
83
85
  args: e.args,
@@ -558,6 +560,13 @@ var PasteCleanup = /** @class */ (function () {
558
560
  detach(rteDialogWrapper.children[0]);
559
561
  }
560
562
  };
563
+ PasteCleanup.prototype.cleanAppleClass = function (elem) {
564
+ var appleClassElem = elem.querySelectorAll('br.Apple-interchange-newline');
565
+ for (var i = 0; i < appleClassElem.length; i++) {
566
+ detach(appleClassElem[i]);
567
+ }
568
+ return elem;
569
+ };
561
570
  PasteCleanup.prototype.formatting = function (value, clean, args) {
562
571
  var _this = this;
563
572
  var clipBoardElem = this.parent.createElement('div', { className: 'pasteContent', styles: 'display:inline;' });
@@ -565,6 +574,7 @@ var PasteCleanup = /** @class */ (function () {
565
574
  value = this.splitBreakLine(value);
566
575
  }
567
576
  clipBoardElem.innerHTML = value;
577
+ clipBoardElem = this.cleanAppleClass(clipBoardElem);
568
578
  if (this.parent.pasteCleanupSettings.deniedTags !== null) {
569
579
  clipBoardElem = this.deniedTags(clipBoardElem);
570
580
  }
@@ -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
  }
@@ -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) :
@@ -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;