@syncfusion/ej2-richtexteditor 22.2.12 → 23.1.39

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 (109) hide show
  1. package/CHANGELOG.md +67 -1
  2. package/dist/ej2-richtexteditor.min.js +3 -3
  3. package/dist/ej2-richtexteditor.umd.min.js +3 -3
  4. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  5. package/dist/es6/ej2-richtexteditor.es2015.js +457 -285
  6. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es5.js +457 -281
  8. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  9. package/dist/global/ej2-richtexteditor.min.js +3 -3
  10. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  11. package/dist/global/index.d.ts +2 -2
  12. package/package.json +13 -13
  13. package/src/editor-manager/plugin/dom-node.js +6 -5
  14. package/src/editor-manager/plugin/inserthtml.js +1 -1
  15. package/src/editor-manager/plugin/ms-word-clean-up.d.ts +2 -0
  16. package/src/editor-manager/plugin/ms-word-clean-up.js +79 -12
  17. package/src/editor-manager/plugin/selection-exec.js +1 -1
  18. package/src/editor-manager/plugin/table.js +1 -1
  19. package/src/rich-text-editor/actions/base-quick-toolbar.d.ts +2 -1
  20. package/src/rich-text-editor/actions/base-quick-toolbar.js +10 -6
  21. package/src/rich-text-editor/actions/emoji-picker.js +29 -14
  22. package/src/rich-text-editor/actions/enter-key.js +9 -2
  23. package/src/rich-text-editor/actions/format-painter.js +12 -6
  24. package/src/rich-text-editor/actions/full-screen.js +3 -0
  25. package/src/rich-text-editor/actions/html-editor.js +14 -1
  26. package/src/rich-text-editor/actions/markdown-editor.js +3 -0
  27. package/src/rich-text-editor/actions/paste-clean-up.d.ts +2 -0
  28. package/src/rich-text-editor/actions/paste-clean-up.js +63 -32
  29. package/src/rich-text-editor/actions/quick-toolbar.js +35 -2
  30. package/src/rich-text-editor/actions/toolbar.js +4 -1
  31. package/src/rich-text-editor/actions/xhtml-validation.js +1 -1
  32. package/src/rich-text-editor/base/classes.d.ts +5 -0
  33. package/src/rich-text-editor/base/classes.js +5 -0
  34. package/src/rich-text-editor/base/constant.d.ts +5 -0
  35. package/src/rich-text-editor/base/constant.js +5 -0
  36. package/src/rich-text-editor/base/enum.d.ts +4 -0
  37. package/src/rich-text-editor/base/interface.d.ts +10 -22
  38. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +1 -39
  39. package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -39
  40. package/src/rich-text-editor/base/rich-text-editor.js +14 -10
  41. package/src/rich-text-editor/base/util.js +5 -1
  42. package/src/rich-text-editor/models/items.js +34 -22
  43. package/src/rich-text-editor/models/toolbar-settings-model.d.ts +4 -5
  44. package/src/rich-text-editor/models/toolbar-settings.d.ts +4 -5
  45. package/src/rich-text-editor/models/toolbar-settings.js +1 -1
  46. package/src/rich-text-editor/renderer/audio-module.js +5 -33
  47. package/src/rich-text-editor/renderer/dialog-renderer.js +1 -1
  48. package/src/rich-text-editor/renderer/image-module.js +19 -65
  49. package/src/rich-text-editor/renderer/link-module.js +6 -0
  50. package/src/rich-text-editor/renderer/render.js +4 -0
  51. package/src/rich-text-editor/renderer/table-module.js +50 -24
  52. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +5 -1
  53. package/src/rich-text-editor/renderer/toolbar-renderer.js +28 -2
  54. package/src/rich-text-editor/renderer/video-module.js +5 -33
  55. package/src/rich-text-editor/renderer/view-source.js +4 -0
  56. package/styles/bootstrap-dark.css +4 -4
  57. package/styles/bootstrap.css +4 -4
  58. package/styles/bootstrap4.css +4 -4
  59. package/styles/bootstrap5-dark.css +4 -4
  60. package/styles/bootstrap5.css +4 -4
  61. package/styles/fabric-dark.css +4 -4
  62. package/styles/fabric.css +4 -4
  63. package/styles/fluent-dark.css +4 -4
  64. package/styles/fluent.css +4 -4
  65. package/styles/highcontrast-light.css +4 -4
  66. package/styles/highcontrast.css +4 -4
  67. package/styles/material-dark.css +4 -5
  68. package/styles/material.css +4 -5
  69. package/styles/material3-dark.css +4 -5
  70. package/styles/material3-dark.scss +1 -1
  71. package/styles/material3.css +4 -5
  72. package/styles/material3.scss +1 -1
  73. package/styles/rich-text-editor/_layout.scss +2 -2
  74. package/styles/rich-text-editor/bootstrap-dark.css +4 -4
  75. package/styles/rich-text-editor/bootstrap-dark.scss +1 -1
  76. package/styles/rich-text-editor/bootstrap.css +4 -4
  77. package/styles/rich-text-editor/bootstrap.scss +1 -1
  78. package/styles/rich-text-editor/bootstrap4.css +4 -4
  79. package/styles/rich-text-editor/bootstrap4.scss +1 -1
  80. package/styles/rich-text-editor/bootstrap5-dark.css +4 -4
  81. package/styles/rich-text-editor/bootstrap5-dark.scss +1 -1
  82. package/styles/rich-text-editor/bootstrap5.css +4 -4
  83. package/styles/rich-text-editor/bootstrap5.scss +1 -1
  84. package/styles/rich-text-editor/fabric-dark.css +4 -4
  85. package/styles/rich-text-editor/fabric-dark.scss +1 -1
  86. package/styles/rich-text-editor/fabric.css +4 -4
  87. package/styles/rich-text-editor/fabric.scss +1 -1
  88. package/styles/rich-text-editor/fluent-dark.css +4 -4
  89. package/styles/rich-text-editor/fluent-dark.scss +1 -1
  90. package/styles/rich-text-editor/fluent.css +4 -4
  91. package/styles/rich-text-editor/fluent.scss +1 -1
  92. package/styles/rich-text-editor/highcontrast-light.css +4 -4
  93. package/styles/rich-text-editor/highcontrast-light.scss +1 -1
  94. package/styles/rich-text-editor/highcontrast.css +4 -4
  95. package/styles/rich-text-editor/highcontrast.scss +1 -1
  96. package/styles/rich-text-editor/material-dark.css +4 -5
  97. package/styles/rich-text-editor/material-dark.scss +1 -1
  98. package/styles/rich-text-editor/material.css +4 -5
  99. package/styles/rich-text-editor/material.scss +1 -1
  100. package/styles/rich-text-editor/material3-dark.css +4 -5
  101. package/styles/rich-text-editor/material3-dark.scss +1 -1
  102. package/styles/rich-text-editor/material3.css +4 -5
  103. package/styles/rich-text-editor/material3.scss +1 -1
  104. package/styles/rich-text-editor/tailwind-dark.css +4 -5
  105. package/styles/rich-text-editor/tailwind-dark.scss +1 -1
  106. package/styles/rich-text-editor/tailwind.css +4 -5
  107. package/styles/rich-text-editor/tailwind.scss +1 -1
  108. package/styles/tailwind-dark.css +4 -5
  109. package/styles/tailwind.css +4 -5
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 22.2.12
4
- * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
3
+ * version : 23.1.39
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
7
7
  * licensing@syncfusion.com. Any infringement will be prosecuted under
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-richtexteditor@*",
3
- "_id": "@syncfusion/ej2-richtexteditor@22.2.10",
3
+ "_id": "@syncfusion/ej2-richtexteditor@23.1.36",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-/s7i93DDpA+4DmbZILSVt+DqyUB+0SM3L8ySW03X+M0kYtOMISKalOC1Ltdy1vRYyr3sP7J4U8qHP9Od0UI2jg==",
5
+ "_integrity": "sha512-tzQBXLmkbr4OueypxbaFkKJt0859uHHRPKW1VKxW28waTX/HO8gpNhQLhBQHuo6GERc+KzyNrJChjZCKigb7pQ==",
6
6
  "_location": "/@syncfusion/ej2-richtexteditor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -26,10 +26,10 @@
26
26
  "/@syncfusion/ej2-react-richtexteditor",
27
27
  "/@syncfusion/ej2-vue-richtexteditor"
28
28
  ],
29
- "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-22.2.10.tgz",
30
- "_shasum": "1ba3e6ac565ffd94931aea112724104b805afb1c",
29
+ "_resolved": "https://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-23.1.36.tgz",
30
+ "_shasum": "b5383ec98558caf0b41cde840cafc3c6b89cee96",
31
31
  "_spec": "@syncfusion/ej2-richtexteditor@*",
32
- "_where": "/jenkins/workspace/elease-automation_release_21.1.1/packages/included",
32
+ "_where": "/jenkins/workspace/elease-automation_release_23.1.1/packages/included",
33
33
  "author": {
34
34
  "name": "Syncfusion Inc."
35
35
  },
@@ -38,13 +38,13 @@
38
38
  },
39
39
  "bundleDependencies": false,
40
40
  "dependencies": {
41
- "@syncfusion/ej2-base": "~22.2.12",
42
- "@syncfusion/ej2-buttons": "~22.2.9",
43
- "@syncfusion/ej2-filemanager": "~22.2.12",
44
- "@syncfusion/ej2-inputs": "~22.2.12",
45
- "@syncfusion/ej2-navigations": "~22.2.11",
46
- "@syncfusion/ej2-popups": "~22.2.11",
47
- "@syncfusion/ej2-splitbuttons": "~22.2.8"
41
+ "@syncfusion/ej2-base": "~23.1.38",
42
+ "@syncfusion/ej2-buttons": "~23.1.39",
43
+ "@syncfusion/ej2-filemanager": "~23.1.39",
44
+ "@syncfusion/ej2-inputs": "~23.1.38",
45
+ "@syncfusion/ej2-navigations": "~23.1.39",
46
+ "@syncfusion/ej2-popups": "~23.1.38",
47
+ "@syncfusion/ej2-splitbuttons": "~23.1.36"
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": "22.2.12",
73
+ "version": "23.1.39",
74
74
  "sideEffects": false
75
75
  }
@@ -452,11 +452,12 @@ var DOMNode = /** @class */ (function () {
452
452
  var startTextNode;
453
453
  var endTextNode;
454
454
  if (start.textContent === '' && isNOU(end) && action !== 'tab') {
455
- if (isNOU(action) && save.range.startContainer.nodeType === 1 &&
456
- save.range.startContainer.querySelectorAll('audio,video,image').length === 0) {
457
- start.innerHTML = '<br>';
458
- }
459
- else if (start.childNodes.length === 1 && start.childNodes[0].nodeName === 'BR') {
455
+ // To Do Apply Heading and Back space press in empty content.
456
+ // if (isNOU(action) && save.range.startContainer.nodeType === 1 &&
457
+ // (save.range.startContainer as HTMLElement).querySelectorAll('audio,video,image').length === 0) {
458
+ // start.innerHTML = '<br>';
459
+ // }
460
+ if (start.childNodes.length === 1 && start.childNodes[0].nodeName === 'BR') {
460
461
  start.innerHTML = '&#65279;&#65279;<br>';
461
462
  }
462
463
  else {
@@ -36,7 +36,7 @@ var InsertHtml = /** @class */ (function () {
36
36
  var range = nodeSelection.getRange(docElement);
37
37
  if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
38
38
  range.startOffset === range.endOffset && editNode.textContent.length === 0 &&
39
- (editNode.children[0].tagName === 'P' || (editNode.children[0].tagName === 'BR'))) {
39
+ (editNode.children[0].tagName === 'P' || editNode.children[0].tagName === 'DIV' || (editNode.children[0].tagName === 'BR'))) {
40
40
  nodeSelection.setSelectionText(docElement, range.startContainer.children[0], range.startContainer.children[0], 0, 0);
41
41
  range = nodeSelection.getRange(docElement);
42
42
  }
@@ -19,6 +19,7 @@ export declare class MsWordPaste {
19
19
  private removableElements;
20
20
  private listContents;
21
21
  private addEventListener;
22
+ private cropImageDimensions;
22
23
  private wordCleanup;
23
24
  private cleanList;
24
25
  private insertAfter;
@@ -31,6 +32,7 @@ export declare class MsWordPaste {
31
32
  private conBytesToBase64;
32
33
  private conHexStringToBytes;
33
34
  private hexConversion;
35
+ private extractCropValue;
34
36
  private removeClassName;
35
37
  private breakLineAddition;
36
38
  private findDetachElem;
@@ -45,6 +45,7 @@ var MsWordPaste = /** @class */ (function () {
45
45
  'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω'];
46
46
  this.removableElements = ['o:p', 'style'];
47
47
  this.listContents = [];
48
+ this.cropImageDimensions = [];
48
49
  this.parent = parent;
49
50
  this.addEventListener();
50
51
  }
@@ -94,7 +95,7 @@ var MsWordPaste = /** @class */ (function () {
94
95
  }
95
96
  }
96
97
  }
97
- e.callBack(elm.innerHTML);
98
+ e.callBack(elm.innerHTML, this.cropImageDimensions);
98
99
  }
99
100
  else {
100
101
  e.callBack(elm.innerHTML);
@@ -162,7 +163,8 @@ var MsWordPaste = /** @class */ (function () {
162
163
  imgElem[i].getAttribute('v:shapes').indexOf('Grafik') < 0 &&
163
164
  imgElem[i].getAttribute('v:shapes').toLowerCase().indexOf('image') < 0 &&
164
165
  imgElem[i].getAttribute('v:shapes').indexOf('Graphic') < 0 &&
165
- imgElem[i].getAttribute('v:shapes').indexOf('_x0000_s') < 0) {
166
+ imgElem[i].getAttribute('v:shapes').indexOf('_x0000_s') < 0 &&
167
+ imgElem[i].getAttribute('v:shapes').indexOf('_x0000_i') < 0) {
166
168
  detach(imgElem[i]);
167
169
  }
168
170
  }
@@ -179,14 +181,36 @@ var MsWordPaste = /** @class */ (function () {
179
181
  }
180
182
  var hexValue = this.hexConversion(rtfData);
181
183
  for (var i = 0; i < hexValue.length; i++) {
182
- base64Src.push(this.convertToBase64(hexValue[i]));
184
+ base64Src.push({
185
+ base64Data: !isNOU(hexValue[i].hex) ? this.convertToBase64(hexValue[i]) : null,
186
+ isCroppedImage: hexValue[i].isCroppedImage
187
+ });
188
+ if (hexValue[i].isCroppedImage) {
189
+ this.cropImageDimensions.push({
190
+ goalWidth: hexValue[i].goalWidth,
191
+ goalHeight: hexValue[i].goalHeight,
192
+ cropLength: hexValue[i].cropLength,
193
+ cropTop: hexValue[i].cropTop,
194
+ cropR: hexValue[i].cropR,
195
+ cropB: hexValue[i].cropB
196
+ });
197
+ }
183
198
  }
184
199
  for (var i = 0; i < imgElem.length; i++) {
185
200
  if (imgSrc[i].match(linkRegex)) {
186
201
  imgElem[i].setAttribute('src', imgSrc[i]);
187
202
  }
188
203
  else {
189
- imgElem[i].setAttribute('src', base64Src[i]);
204
+ if (!isNOU(base64Src[i]) && !isNOU(base64Src[i].base64Data)) {
205
+ imgElem[i].setAttribute('src', base64Src[i].base64Data);
206
+ }
207
+ else {
208
+ imgElem[i].removeAttribute('src');
209
+ imgElem[i].setAttribute('alt', 'Unsupported file format');
210
+ }
211
+ if (!isNOU(base64Src[i]) && base64Src[i].isCroppedImage) {
212
+ imgElem[i].classList.add('e-img-cropped');
213
+ }
190
214
  }
191
215
  imgElem[i].setAttribute('id', 'msWordImg-' + imgName[i]);
192
216
  }
@@ -263,6 +287,13 @@ var MsWordPaste = /** @class */ (function () {
263
287
  var result = [];
264
288
  if (!isNOU(fullImg)) {
265
289
  for (var i = 0; i < fullImg.length; i++) {
290
+ var isCroppedImage = false;
291
+ var goalWidth = 0;
292
+ var goalHeight = 0;
293
+ var cropLength = 0;
294
+ var cropTop = 0;
295
+ var cropR = 0;
296
+ var cropB = 0;
266
297
  if (picHead.test(fullImg[i])) {
267
298
  if (fullImg[i].indexOf('\\pngblip') !== -1) {
268
299
  imgType = 'image/png';
@@ -270,20 +301,45 @@ var MsWordPaste = /** @class */ (function () {
270
301
  else if (fullImg[i].indexOf('\\jpegblip') !== -1) {
271
302
  imgType = 'image/jpeg';
272
303
  }
304
+ else if (fullImg[i].indexOf('\\picprop') !== -1) {
305
+ imgType = null;
306
+ }
273
307
  else {
274
308
  continue;
275
309
  }
310
+ isCroppedImage = this.extractCropValue('cropl', fullImg[i]) > 0 &&
311
+ this.extractCropValue('cropt', fullImg[i]) > 0 ? true : false;
312
+ if (isCroppedImage) {
313
+ goalWidth = this.extractCropValue('wgoal', fullImg[i]);
314
+ goalHeight = this.extractCropValue('hgoal', fullImg[i]);
315
+ cropLength = this.extractCropValue('cropl', fullImg[i]);
316
+ cropTop = this.extractCropValue('cropt', fullImg[i]);
317
+ cropR = this.extractCropValue('cropr', fullImg[i]);
318
+ cropB = this.extractCropValue('cropb', fullImg[i]);
319
+ }
276
320
  result.push({
277
321
  hex: imgType ? fullImg[i].replace(picHead, '').replace(/[^\da-fA-F]/g, '') : null,
278
- type: imgType
322
+ type: imgType,
323
+ isCroppedImage: isCroppedImage,
324
+ goalWidth: goalWidth,
325
+ goalHeight: goalHeight,
326
+ cropLength: cropLength,
327
+ cropTop: cropTop,
328
+ cropR: cropR,
329
+ cropB: cropB
279
330
  });
280
331
  }
281
332
  }
282
333
  }
283
334
  return result;
284
335
  };
336
+ MsWordPaste.prototype.extractCropValue = function (crop, rtfData) {
337
+ // eslint-disable-next-line security/detect-non-literal-regexp
338
+ var result = new RegExp('\\\\pic' + crop + '(\\-?\\d+)\\\\').exec(rtfData.replace('\r\n\\', '\\'))[1];
339
+ return parseInt(result, 10);
340
+ };
285
341
  MsWordPaste.prototype.removeClassName = function (elm) {
286
- var elmWithClass = elm.querySelectorAll('*[class]');
342
+ var elmWithClass = elm.querySelectorAll('*[class]:not(.e-img-cropped)');
287
343
  for (var i = 0; i < elmWithClass.length; i++) {
288
344
  elmWithClass[i].removeAttribute('class');
289
345
  }
@@ -620,8 +676,10 @@ var MsWordPaste = /** @class */ (function () {
620
676
  currentListStyle = listNodes[i].getAttribute('style');
621
677
  }
622
678
  }
623
- collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
624
- listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft });
679
+ collection.push({
680
+ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
681
+ listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft
682
+ });
625
683
  }
626
684
  }
627
685
  stNode = listNodes.shift();
@@ -718,10 +776,20 @@ var MsWordPaste = /** @class */ (function () {
718
776
  temp.style.listStyleType = collection[index].listStyleTypeName;
719
777
  }
720
778
  else if (collection[index].nestedLevel === pLevel) {
721
- if (prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
779
+ if (!isNOU(prevList) && !isNOU(prevList.parentElement)
780
+ && prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
722
781
  prevList.parentElement.appendChild(prevList = createElement('li'));
723
782
  prevList.appendChild(pElement);
724
783
  }
784
+ else if (isNOU(prevList)) {
785
+ temp = createElement(collection[index].listType);
786
+ temp.style.listStyleType = collection[index].listStyleTypeName;
787
+ prevList = createElement('li');
788
+ prevList.appendChild(pElement);
789
+ temp.appendChild(prevList);
790
+ temp.setAttribute('level', collection[index].nestedLevel.toString());
791
+ root.appendChild(temp);
792
+ }
725
793
  else {
726
794
  temp = createElement(collection[index].listType);
727
795
  temp.style.listStyleType = collection[index].listStyleTypeName;
@@ -749,8 +817,7 @@ var MsWordPaste = /** @class */ (function () {
749
817
  }
750
818
  else {
751
819
  if (collection[index].nestedLevel > pLevel && isNormalList) {
752
- var initialNode = void 0;
753
- initialNode = createElement(collection[index].listType);
820
+ var initialNode = createElement(collection[index].listType);
754
821
  prevList = createElement('li');
755
822
  initialNode.appendChild(prevList);
756
823
  initialNode.style.listStyleType = 'none';
@@ -839,7 +906,7 @@ var MsWordPaste = /** @class */ (function () {
839
906
  if (firstChild.childNodes.length > 0) {
840
907
  var listIgnoreTag = firstChild.querySelectorAll('[style*="mso-list"]');
841
908
  for (var i = 0; i < listIgnoreTag.length; i++) {
842
- listIgnoreTag[i].setAttribute('style', listIgnoreTag[i].getAttribute('style').replace(/\n/g, ""));
909
+ listIgnoreTag[i].setAttribute('style', listIgnoreTag[i].getAttribute('style').replace(/\n/g, ''));
843
910
  }
844
911
  var listOrder = firstChild.querySelector('span[style="mso-list:Ignore"]');
845
912
  if (!isNOU(listOrder)) {
@@ -26,7 +26,7 @@ var SelectionBasedExec = /** @class */ (function () {
26
26
  SelectionBasedExec.prototype.keyDownHandler = function (e) {
27
27
  var validFormats = ['bold', 'italic', 'underline', 'strikethrough', 'superscript',
28
28
  'subscript', 'uppercase', 'lowercase'];
29
- if (e.event.ctrlKey && validFormats.indexOf(e.event.action) > -1) {
29
+ if ((e.event.ctrlKey || e.event.metaKey) && validFormats.indexOf(e.event.action) > -1) {
30
30
  e.event.preventDefault();
31
31
  SelectionCommands.applyFormat(this.parent.currentDocument, e.event.action, this.parent.editableElement, e.enterAction);
32
32
  this.callBack(e, e.event.action);
@@ -92,7 +92,7 @@ var TableCommand = /** @class */ (function () {
92
92
  TableCommand.prototype.calculateStyleValue = function (value) {
93
93
  var styleValue;
94
94
  if (typeof (value) === 'string') {
95
- if (value.indexOf('px') || value.indexOf('%') || value.indexOf('auto')) {
95
+ if (value.indexOf('px') >= 0 || value.indexOf('%') >= 0 || value.indexOf('auto') >= 0) {
96
96
  styleValue = value;
97
97
  }
98
98
  else {
@@ -42,11 +42,12 @@ export declare class BaseQuickToolbar {
42
42
  * @param {number} x - specifies the x value
43
43
  * @param {number} y - specifies the y value
44
44
  * @param {Element} target - specifies the element
45
+ * @param {string} type - specifies the type
45
46
  * @returns {void}
46
47
  * @hidden
47
48
 
48
49
  */
49
- showPopup(x: number, y: number, target: Element): void;
50
+ showPopup(x: number, y: number, target: Element, type?: string): void;
50
51
  /**
51
52
  * hidePopup method
52
53
  *
@@ -42,6 +42,9 @@ var BaseQuickToolbar = /** @class */ (function () {
42
42
  else if (args.popupType === 'Inline') {
43
43
  className = classes.CLS_INLINE_POP;
44
44
  }
45
+ else if (args.popupType === 'Text') {
46
+ className = classes.CLS_TEXT_POP;
47
+ }
45
48
  else {
46
49
  className = '';
47
50
  }
@@ -121,7 +124,7 @@ var BaseQuickToolbar = /** @class */ (function () {
121
124
  case 'bottom': {
122
125
  var posY = void 0;
123
126
  if (viewPort === 'document') {
124
- if (type === 'inline') {
127
+ if (type === 'inline' || type === 'text') {
125
128
  posY = (e.y - e.popHeight - 10);
126
129
  }
127
130
  else {
@@ -150,7 +153,7 @@ var BaseQuickToolbar = /** @class */ (function () {
150
153
  break;
151
154
  }
152
155
  case 'right':
153
- if (type === 'inline') {
156
+ if (type === 'inline' || type === 'text') {
154
157
  x = window.pageXOffset + (e.windowWidth - (e.popWidth + e.bodyRightSpace + 10));
155
158
  }
156
159
  else {
@@ -158,7 +161,7 @@ var BaseQuickToolbar = /** @class */ (function () {
158
161
  }
159
162
  break;
160
163
  case 'left':
161
- if (type === 'inline') {
164
+ if (type === 'inline' || type === 'text') {
162
165
  x = 0;
163
166
  }
164
167
  else {
@@ -177,11 +180,12 @@ var BaseQuickToolbar = /** @class */ (function () {
177
180
  * @param {number} x - specifies the x value
178
181
  * @param {number} y - specifies the y value
179
182
  * @param {Element} target - specifies the element
183
+ * @param {string} type - specifies the type
180
184
  * @returns {void}
181
185
  * @hidden
182
186
 
183
187
  */
184
- BaseQuickToolbar.prototype.showPopup = function (x, y, target) {
188
+ BaseQuickToolbar.prototype.showPopup = function (x, y, target, type) {
185
189
  var _this = this;
186
190
  var eventArgs = { popup: this.popupObj, cancel: false, targetElement: target,
187
191
  positionX: x, positionY: y };
@@ -212,7 +216,7 @@ var BaseQuickToolbar = /** @class */ (function () {
212
216
  editPanelTop = (cntEle) ? cntEle.scrollTop : 0;
213
217
  editPanelHeight = (cntEle) ? cntEle.offsetHeight : 0;
214
218
  }
215
- if (!_this.parent.inlineMode.enable && !closest(target, 'table')) {
219
+ if (!_this.parent.inlineMode.enable && !closest(target, 'table') && type !== 'text') {
216
220
  _this.parent.disableToolbarItem(_this.parent.toolbarSettings.items);
217
221
  _this.parent.enableToolbarItem(['Undo', 'Redo']);
218
222
  }
@@ -265,7 +269,7 @@ var BaseQuickToolbar = /** @class */ (function () {
265
269
  if (!_this.parent.inlineMode.enable) {
266
270
  _this.checkCollision(showPopupData, 'parent', '');
267
271
  }
268
- _this.checkCollision(showPopupData, 'document', ((_this.parent.inlineMode.enable) ? 'inline' : ''));
272
+ _this.checkCollision(showPopupData, 'document', ((_this.parent.inlineMode.enable) ? 'inline' : (type === 'text') ? 'text' : ''));
269
273
  _this.popupObj.element.classList.remove('e-popup-open');
270
274
  removeClass([_this.element], [classes.CLS_HIDE]);
271
275
  _this.popupObj.show({ name: 'ZoomIn', duration: (Browser.isIE ? 250 : 400) });
@@ -36,7 +36,13 @@ var EmojiPicker = /** @class */ (function () {
36
36
  EmojiPicker.prototype.toolbarClick = function (args) {
37
37
  var _this = this;
38
38
  var _a, _b;
39
- var spanElement = this.parent.element.querySelector('.e-emoji');
39
+ var spanElement;
40
+ if (!isNOU(this.parent.element.querySelector('.e-emoji'))) {
41
+ spanElement = this.parent.element.querySelector('.e-emoji');
42
+ }
43
+ else if (this.parent.inlineMode.enable) {
44
+ spanElement = this.parent.element.ownerDocument.querySelector('.e-emoji');
45
+ }
40
46
  this.divElement = spanElement.closest('div');
41
47
  var range = this.parent.formatter.editorManager.nodeSelection.getRange(this.parent.contentModule.getDocument());
42
48
  this.save = this.parent.formatter.editorManager.nodeSelection.save(range, this.parent.contentModule.getDocument());
@@ -51,7 +57,12 @@ var EmojiPicker = /** @class */ (function () {
51
57
  this.popupObj.hide();
52
58
  }
53
59
  this.popDiv = this.parent.createElement('div', { className: 'e-rte-emojipicker-popup', id: this.parent.getID() + '_emojiPicker' });
54
- this.parent.getToolbar().appendChild(this.popDiv);
60
+ if (!isNOU(this.parent.getToolbar()) && !this.parent.inlineMode.enable) {
61
+ this.parent.getToolbar().appendChild(this.popDiv);
62
+ }
63
+ else if (this.parent.inlineMode.enable) {
64
+ this.parent.inputElement.appendChild(this.popDiv);
65
+ }
55
66
  EventHandler.add(this.popDiv, 'keydown', this.onKeyDown, this);
56
67
  EventHandler.add(this.popDiv, 'keyup', this.searchFilter, this);
57
68
  var extendEle = this.parent.element.querySelector('.e-toolbar-extended');
@@ -66,13 +77,14 @@ var EmojiPicker = /** @class */ (function () {
66
77
  var target;
67
78
  var xValue;
68
79
  var yValue;
69
- if (!isNOU(args.args)) {
80
+ if (!isNOU(args.args) && !this.parent.inlineMode.enable &&
81
+ isNOU(this.parent.quickToolbarSettings.text)) {
70
82
  target = args.args.originalEvent.target;
71
83
  target = target.classList.contains('e-toolbar-item') ? target.firstChild : target.parentElement;
72
84
  xValue = 'left';
73
85
  yValue = 'bottom';
74
86
  }
75
- else if (isNOU(args.x) && isNOU(args.y)) {
87
+ else if (isNOU(args.x) && isNOU(args.y) && !this.parent.inlineMode.enable && isNOU(this.parent.quickToolbarSettings.text)) {
76
88
  target = this.parent.inputElement;
77
89
  if (window.getSelection().rangeCount > 0) {
78
90
  var coordinates = this.getCoordinates();
@@ -80,6 +92,14 @@ var EmojiPicker = /** @class */ (function () {
80
92
  yValue = coordinates.top;
81
93
  }
82
94
  }
95
+ else if (isNOU(args.x) && isNOU(args.y) && (this.parent.inlineMode.enable || !isNOU(this.parent.quickToolbarSettings.text))) {
96
+ this.parent.notify(events.hidePopup, {});
97
+ if (window.getSelection().rangeCount > 0) {
98
+ var coordinates = this.getCoordinates();
99
+ xValue = coordinates.left;
100
+ yValue = coordinates.top;
101
+ }
102
+ }
83
103
  else {
84
104
  target = this.parent.inputElement;
85
105
  xValue = args.x;
@@ -106,7 +126,8 @@ var EmojiPicker = /** @class */ (function () {
106
126
  addClass([this.popupObj.element], 'e-popup-open');
107
127
  this.popupObj.refreshPosition(target);
108
128
  // header search element
109
- if ((!isNOU(args.args) || (isNOU(args.x) && isNOU(args.y))) && this.parent.emojiPickerSettings.showSearchBox) {
129
+ if ((!isNOU(args.args) || (isNOU(args.x) && isNOU(args.y))) &&
130
+ this.parent.emojiPickerSettings.showSearchBox) {
110
131
  var inputEle = createElement('input', { id: 'e-rte-emoji-search', className: 'e-rte-emoji-search' });
111
132
  this.popDiv.append(inputEle);
112
133
  var inputobj = new TextBox({
@@ -142,7 +163,8 @@ var EmojiPicker = /** @class */ (function () {
142
163
  this.popDiv.appendChild(emojiBtnDiv);
143
164
  var height;
144
165
  var popupBorder = window.getComputedStyle(this.popDiv);
145
- if ((isNOU(args.args) && !(isNOU(args.x) && isNOU(args.y))) || !this.parent.emojiPickerSettings.showSearchBox) {
166
+ if ((isNOU(args.args) && !(isNOU(args.x) && isNOU(args.y))) ||
167
+ !this.parent.emojiPickerSettings.showSearchBox) {
146
168
  height = (this.popDiv.getBoundingClientRect().height - emojiToolBar.getBoundingClientRect().height - (2 * parseFloat(popupBorder.borderWidth))) + 'px';
147
169
  emojiBtnDiv.style.setProperty('height', height, 'important');
148
170
  }
@@ -188,13 +210,6 @@ var EmojiPicker = /** @class */ (function () {
188
210
  if (!isNOU(popup)) {
189
211
  scrollTop = Math.round(popup.scrollTop);
190
212
  }
191
- for (var i = 0; i < toolbarName.length; i++) {
192
- /* eslint-disable */
193
- if (toolbarName[i].classList.contains('e-selected')) {
194
- removeClass([toolbarName[i]], 'e-selected');
195
- }
196
- /* eslint-enable */
197
- }
198
213
  if (scrollTop < toolbarName[0].offsetHeight) {
199
214
  addClass([toolbarName[0]], 'e-selected');
200
215
  }
@@ -649,7 +664,7 @@ var EmojiPicker = /** @class */ (function () {
649
664
  var startOffset = this.save.startOffset;
650
665
  var textContent = this.save.range.startContainer.textContent;
651
666
  var previousText = textContent.substring(startOffset, startOffset + 1);
652
- // When toolbar action is clicked then only restore the range.
667
+ // When toolbar action is clicked then only restore the range.
653
668
  if (!isNOU(this.clickEvent) || previousText !== ':') {
654
669
  this.save.restore();
655
670
  }
@@ -14,6 +14,9 @@ var EnterKeyAction = /** @class */ (function () {
14
14
  this.parent.on(events.moduleDestroy, this.moduleDestroy, this);
15
15
  };
16
16
  EnterKeyAction.prototype.destroy = function () {
17
+ if (isNOU(this.parent)) {
18
+ return;
19
+ }
17
20
  this.removeEventListener();
18
21
  };
19
22
  EnterKeyAction.prototype.moduleDestroy = function () {
@@ -173,8 +176,12 @@ var EnterKeyAction = /** @class */ (function () {
173
176
  (_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
174
177
  var isNearBlockLengthZero = void 0;
175
178
  var newElem = void 0;
176
- if (!isNOU(_this.range.startContainer.childNodes) && _this.range.startContainer.textContent.length === 0
177
- && (_this.range.startContainer.querySelectorAll('img, audio, video').length > 0 ||
179
+ if (!isNOU(_this.range.startContainer.childNodes) &&
180
+ (_this.range.startContainer.textContent.length === 0 ||
181
+ (_this.range.startContainer.nodeName !== '#text' && !isNOU(_this.range.startContainer.querySelector('.e-video-clickelem')) &&
182
+ _this.range.startContainer.querySelector('.e-video-clickelem').textContent.length === 0)) &&
183
+ (_this.range.startContainer.querySelectorAll('img, audio, video').length > 0 ||
184
+ !isNOU(_this.range.startContainer.querySelector('.e-video-clickelem')) ||
178
185
  _this.range.startContainer.nodeName === 'IMG' || _this.range.startContainer.nodeName === 'TABLE')) {
179
186
  newElem = _this.createInsertElement(shiftKey_1);
180
187
  isMediaNode = true;
@@ -25,6 +25,10 @@ var FormatPainter = /** @class */ (function () {
25
25
  clickargs.args.action = 'escape';
26
26
  this.actionHandler(clickargs, 'keyBoard');
27
27
  }
28
+ if (this.parent.quickToolbarModule && !isNOU(this.parent.quickToolbarSettings.text) &&
29
+ this.parent.element.ownerDocument.contains(this.parent.quickToolbarModule.textQTBar.element)) {
30
+ this.parent.quickToolbarModule.textQTBar.hidePopup();
31
+ }
28
32
  };
29
33
  FormatPainter.prototype.toolbarDoubleClick = function (args) {
30
34
  this.isActive = true;
@@ -103,12 +107,14 @@ var FormatPainter = /** @class */ (function () {
103
107
  }
104
108
  };
105
109
  FormatPainter.prototype.updateToolbarBtn = function (enable) {
106
- var toolbarBtn = this.parent.element.querySelector('.e-rte-format-painter').parentElement.parentElement;
107
- if (enable) {
108
- addClass([toolbarBtn], 'e-active');
109
- }
110
- else if (!this.isSticky) {
111
- removeClass([toolbarBtn], 'e-active');
110
+ if (!isNOU(this.parent.element.querySelector('.e-rte-format-painter'))) {
111
+ var toolbarBtn = this.parent.element.querySelector('.e-rte-format-painter').parentElement.parentElement;
112
+ if (enable) {
113
+ addClass([toolbarBtn], 'e-active');
114
+ }
115
+ else if (!this.isSticky) {
116
+ removeClass([toolbarBtn], 'e-active');
117
+ }
112
118
  }
113
119
  };
114
120
  FormatPainter.prototype.editAreaClick = function (args) {
@@ -164,6 +164,9 @@ var FullScreen = /** @class */ (function () {
164
164
 
165
165
  */
166
166
  FullScreen.prototype.destroy = function () {
167
+ if (isNOU(this.parent)) {
168
+ return;
169
+ }
167
170
  if (this.parent.element.classList.contains(classes.CLS_FULL_SCREEN)) {
168
171
  this.toggleParentOverflow(false);
169
172
  }
@@ -126,11 +126,24 @@ var HtmlEditor = /** @class */ (function () {
126
126
  var currentLength = this.parent.inputElement.innerHTML.replace(regEx, '').length;
127
127
  var focusNode = range.startContainer;
128
128
  if (previousLength > currentLength && !isRootParent) {
129
+ if (focusNode.textContent.trim().length !== 0 && focusNode.previousSibling) {
130
+ var tempSpan = document.createElement('span');
131
+ tempSpan.className = 'tempSpan';
132
+ range.insertNode(tempSpan);
133
+ }
129
134
  var currentChild = this.parent.inputElement.firstChild;
130
135
  while (!isNOU(currentChild) && currentChild.textContent.replace(regEx, '').trim().length > 0) {
131
136
  currentChild.innerHTML = currentChild.innerHTML.replace(regEx, '');
132
137
  currentChild = currentChild.nextElementSibling;
133
138
  }
139
+ var tempSpanToRemove = this.parent.inputElement.querySelector('.tempSpan');
140
+ if (tempSpanToRemove && tempSpanToRemove.previousSibling && focusNode.textContent.trim().length !== 0) {
141
+ focusNode = tempSpanToRemove.previousSibling;
142
+ pointer = tempSpanToRemove.previousSibling.textContent.length;
143
+ var parentElement = tempSpanToRemove.parentNode;
144
+ parentElement.removeChild(tempSpanToRemove);
145
+ tempSpanToRemove = null;
146
+ }
134
147
  var currentChildNode = this.parent.inputElement.querySelector('.currentStartMark').childNodes;
135
148
  if (currentChildNode.length > 1) {
136
149
  for (var i = 0; i < currentChildNode.length; i++) {
@@ -585,7 +598,7 @@ var HtmlEditor = /** @class */ (function () {
585
598
  var item = args.item;
586
599
  var closestElement = closest(args.originalEvent.target, '.e-rte-quick-popup');
587
600
  if (item.command !== 'FormatPainter') {
588
- if (closestElement && !closestElement.classList.contains('e-rte-inline-popup')) {
601
+ if (closestElement && !closestElement.classList.contains('e-rte-inline-popup') && !closestElement.classList.contains('e-rte-text-popup')) {
589
602
  if (!(item.subCommand === 'SourceCode' || item.subCommand === 'Preview' ||
590
603
  item.subCommand === 'FontColor' || item.subCommand === 'BackgroundColor')) {
591
604
  if (isIDevice() && item.command === 'Images') {
@@ -25,6 +25,9 @@ var MarkdownEditor = /** @class */ (function () {
25
25
 
26
26
  */
27
27
  MarkdownEditor.prototype.destroy = function () {
28
+ if (isNullOrUndefined(this.parent)) {
29
+ return;
30
+ }
28
31
  this.removeEventListener();
29
32
  };
30
33
  MarkdownEditor.prototype.moduleDestroy = function () {
@@ -22,6 +22,7 @@ export declare class PasteCleanup {
22
22
  private blockNode;
23
23
  private isNotFromHtml;
24
24
  private containsHtml;
25
+ private cropImageData;
25
26
  constructor(parent?: IRichTextEditor, serviceLocator?: ServiceLocator);
26
27
  private addEventListener;
27
28
  private destroy;
@@ -56,6 +57,7 @@ export declare class PasteCleanup {
56
57
  private destroyDialog;
57
58
  private cleanAppleClass;
58
59
  private formatting;
60
+ private cropImageHandler;
59
61
  private addTableClass;
60
62
  private setImageProperties;
61
63
  private addTempClass;