@syncfusion/ej2-richtexteditor 20.3.61 → 20.4.38

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 (100) hide show
  1. package/.eslintrc.json +16 -1
  2. package/CHANGELOG.md +0 -40
  3. package/README.md +53 -45
  4. package/dist/ej2-richtexteditor.min.js +2 -2
  5. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  6. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es2015.js +312 -181
  8. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  9. package/dist/es6/ej2-richtexteditor.es5.js +300 -168
  10. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  11. package/dist/global/ej2-richtexteditor.min.js +2 -2
  12. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  13. package/dist/global/index.d.ts +1 -1
  14. package/package.json +15 -15
  15. package/src/editor-manager/plugin/clearformat.js +2 -1
  16. package/src/editor-manager/plugin/dom-node.js +1 -1
  17. package/src/editor-manager/plugin/formats.js +1 -0
  18. package/src/editor-manager/plugin/image.js +1 -0
  19. package/src/editor-manager/plugin/link.js +3 -1
  20. package/src/editor-manager/plugin/lists.js +15 -7
  21. package/src/editor-manager/plugin/ms-word-clean-up.js +6 -2
  22. package/src/editor-manager/plugin/selection-commands.js +8 -41
  23. package/src/editor-manager/plugin/table.js +6 -0
  24. package/src/editor-manager/plugin/toolbar-status.js +3 -0
  25. package/src/editor-manager/plugin/video.js +2 -2
  26. package/src/markdown-parser/plugin/clearformat.js +9 -7
  27. package/src/markdown-parser/plugin/formats.js +6 -5
  28. package/src/markdown-parser/plugin/lists.js +5 -0
  29. package/src/markdown-parser/plugin/markdown-selection.js +3 -0
  30. package/src/markdown-parser/plugin/md-selection-formats.js +13 -10
  31. package/src/rich-text-editor/actions/enter-key.js +66 -15
  32. package/src/rich-text-editor/actions/file-manager.js +1 -0
  33. package/src/rich-text-editor/actions/html-attributes.js +8 -8
  34. package/src/rich-text-editor/actions/html-editor.js +2 -0
  35. package/src/rich-text-editor/actions/keyboard.js +4 -4
  36. package/src/rich-text-editor/actions/markdown-toolbar-status.js +2 -1
  37. package/src/rich-text-editor/actions/paste-clean-up.js +2 -1
  38. package/src/rich-text-editor/actions/toolbar.js +2 -0
  39. package/src/rich-text-editor/base/constant.d.ts +8 -8
  40. package/src/rich-text-editor/base/constant.js +8 -8
  41. package/src/rich-text-editor/base/rich-text-editor.d.ts +2 -0
  42. package/src/rich-text-editor/base/rich-text-editor.js +43 -10
  43. package/src/rich-text-editor/base/util.js +9 -9
  44. package/src/rich-text-editor/renderer/audio-module.d.ts +1 -1
  45. package/src/rich-text-editor/renderer/audio-module.js +7 -5
  46. package/src/rich-text-editor/renderer/image-module.js +10 -6
  47. package/src/rich-text-editor/renderer/link-module.js +5 -4
  48. package/src/rich-text-editor/renderer/table-module.js +19 -5
  49. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +1 -0
  50. package/src/rich-text-editor/renderer/toolbar-renderer.js +1 -0
  51. package/src/rich-text-editor/renderer/video-module.d.ts +1 -1
  52. package/src/rich-text-editor/renderer/video-module.js +13 -4
  53. package/src/rich-text-editor/services/renderer-factory.js +4 -4
  54. package/src/rich-text-editor/services/service-locator.js +4 -4
  55. package/src/selection/selection.js +2 -0
  56. package/styles/bootstrap-dark.css +12 -5
  57. package/styles/bootstrap.css +12 -5
  58. package/styles/bootstrap4.css +12 -5
  59. package/styles/bootstrap5-dark.css +12 -5
  60. package/styles/bootstrap5.css +12 -5
  61. package/styles/fabric-dark.css +12 -5
  62. package/styles/fabric.css +12 -5
  63. package/styles/fluent-dark.css +12 -5
  64. package/styles/fluent.css +12 -5
  65. package/styles/highcontrast-light.css +12 -5
  66. package/styles/highcontrast.css +12 -5
  67. package/styles/material-dark.css +12 -5
  68. package/styles/material.css +12 -5
  69. package/styles/rich-text-editor/_bootstrap-dark-definition.scss +1 -0
  70. package/styles/rich-text-editor/_bootstrap-definition.scss +1 -0
  71. package/styles/rich-text-editor/_bootstrap4-definition.scss +1 -0
  72. package/styles/rich-text-editor/_bootstrap5-definition.scss +1 -0
  73. package/styles/rich-text-editor/_fabric-dark-definition.scss +1 -0
  74. package/styles/rich-text-editor/_fabric-definition.scss +1 -0
  75. package/styles/rich-text-editor/_fluent-definition.scss +1 -0
  76. package/styles/rich-text-editor/_fusionnew-definition.scss +1 -0
  77. package/styles/rich-text-editor/_highcontrast-definition.scss +1 -0
  78. package/styles/rich-text-editor/_highcontrast-light-definition.scss +1 -0
  79. package/styles/rich-text-editor/_material-dark-definition.scss +1 -0
  80. package/styles/rich-text-editor/_material-definition.scss +1 -0
  81. package/styles/rich-text-editor/_material3-definition.scss +1 -0
  82. package/styles/rich-text-editor/_tailwind-definition.scss +1 -0
  83. package/styles/rich-text-editor/_theme.scss +11 -6
  84. package/styles/rich-text-editor/bootstrap-dark.css +12 -5
  85. package/styles/rich-text-editor/bootstrap.css +12 -5
  86. package/styles/rich-text-editor/bootstrap4.css +12 -5
  87. package/styles/rich-text-editor/bootstrap5-dark.css +12 -5
  88. package/styles/rich-text-editor/bootstrap5.css +12 -5
  89. package/styles/rich-text-editor/fabric-dark.css +12 -5
  90. package/styles/rich-text-editor/fabric.css +12 -5
  91. package/styles/rich-text-editor/fluent-dark.css +12 -5
  92. package/styles/rich-text-editor/fluent.css +12 -5
  93. package/styles/rich-text-editor/highcontrast-light.css +12 -5
  94. package/styles/rich-text-editor/highcontrast.css +12 -5
  95. package/styles/rich-text-editor/material-dark.css +12 -5
  96. package/styles/rich-text-editor/material.css +12 -5
  97. package/styles/rich-text-editor/tailwind-dark.css +12 -5
  98. package/styles/rich-text-editor/tailwind.css +12 -5
  99. package/styles/tailwind-dark.css +12 -5
  100. package/styles/tailwind.css +12 -5
@@ -41,8 +41,8 @@ var EnterKeyAction = /** @class */ (function () {
41
41
  var curElement = this.startNode;
42
42
  var blockElement = curElement;
43
43
  while (!this.parent.formatter.editorManager.domNode.isBlockNode(curElement)) {
44
- blockElement = curElement;
45
44
  curElement = curElement.parentElement;
45
+ blockElement = curElement;
46
46
  }
47
47
  isTableEnter = blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
48
48
  }
@@ -59,7 +59,10 @@ var EnterKeyAction = /** @class */ (function () {
59
59
  this.parent.trigger(events.actionBegin, actionBeginArgs, function (actionBeginArgs) {
60
60
  if (!actionBeginArgs.cancel) {
61
61
  if (!(_this.range.startOffset === _this.range.endOffset && _this.range.startContainer === _this.range.endContainer)) {
62
- _this.range.deleteContents();
62
+ if (!(_this.range.startContainer.nodeName === 'SPAN' && (_this.range.startContainer.classList.contains('e-video-wrap') ||
63
+ _this.range.startContainer.classList.contains('e-audio-wrap')))) {
64
+ _this.range.deleteContents();
65
+ }
63
66
  if (_this.range.startContainer.nodeName === '#text' && _this.range.startContainer.textContent.length === 0 &&
64
67
  _this.range.startContainer.parentElement !== _this.parent.inputElement) {
65
68
  if (_this.parent.enterKey === 'BR') {
@@ -88,8 +91,8 @@ var EnterKeyAction = /** @class */ (function () {
88
91
  while (!isNOU(currentFocusElem) && currentFocusElem.nodeName !== '#text' && currentFocusElem.nodeName !== 'BR') {
89
92
  currentFocusElem = currentFocusElem.lastChild;
90
93
  }
91
- if (currentFocusElem.nodeName != 'BR' && currentFocusElem.parentElement.textContent.length === 0 && currentFocusElem.parentElement.innerHTML.length === 0 &&
92
- currentFocusElem.parentElement.nodeName != 'BR') {
94
+ if (currentFocusElem.nodeName !== 'BR' && currentFocusElem.parentElement.textContent.length === 0 && currentFocusElem.parentElement.innerHTML.length === 0 &&
95
+ currentFocusElem.parentElement.nodeName !== 'BR') {
93
96
  currentFocusElem.parentElement.appendChild(_this.parent.createElement('BR'));
94
97
  }
95
98
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), currentFocusElem.nodeName === 'BR' ? currentFocusElem : currentFocusElem.parentElement, currentFocusElem.parentElement.textContent.length >= 0 || currentFocusElem.nodeName === 'BR' ? 0 : 1);
@@ -141,13 +144,14 @@ var EnterKeyAction = /** @class */ (function () {
141
144
  else {
142
145
  nearBlockNode = _this.parent.formatter.editorManager.domNode.blockParentNode(_this.startNode);
143
146
  }
144
- var isImageNode = false;
147
+ var isMediaNode = false; // To check the image audio and video node cases
145
148
  var isFocusedFirst = false;
146
149
  if (_this.range.startOffset !== 0 && _this.range.endOffset !== 0 &&
147
150
  _this.range.startContainer === _this.range.endContainer && !(!isNOU(nearBlockNode.childNodes[0])
148
- && nearBlockNode.childNodes[0].nodeName === 'IMG')) {
151
+ && nearBlockNode.childNodes[0].nodeName === 'IMG' && nearBlockNode.querySelectorAll('img,audio,video').length > 0)) {
149
152
  var startNodeText = _this.range.startContainer.textContent;
150
153
  var splitFirstText = startNodeText.substring(0, _this.range.startOffset);
154
+ // eslint-disable-next-line max-len
151
155
  if (splitFirstText.charCodeAt(_this.range.startOffset - 1) !== 160 && splitFirstText.trim().length === 0) {
152
156
  isFocusedFirst = true;
153
157
  }
@@ -159,26 +163,29 @@ var EnterKeyAction = /** @class */ (function () {
159
163
  var fireFoxEnterAtMiddle = Browser.userAgent.indexOf('Firefox') !== -1 && _this.range.startOffset === 0 && _this.range.startContainer === _this.range.endContainer &&
160
164
  _this.range.startContainer.nodeName === '#text' && !_this.parent.formatter.editorManager.domNode.isBlockNode(_this.range.startContainer.previousSibling) &&
161
165
  _this.range.startContainer.parentElement === _this.range.startContainer.previousSibling.parentElement;
166
+ // eslint-disable-next-line max-len
162
167
  if (!fireFoxEnterAtMiddle && ((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
163
168
  !(!isNOU(_this.range.startContainer.previousSibling) &&
164
169
  (_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
165
170
  var isNearBlockLengthZero = void 0;
166
171
  var newElem = void 0;
167
- if (_this.range.startContainer.nodeName === 'IMG' || _this.range.startContainer.nodeName === 'TABLE') {
172
+ if (!isNOU(_this.range.startContainer.childNodes) && _this.range.startContainer.textContent.length === 0 &&
173
+ (_this.range.startContainer.querySelectorAll('img,audio,video').length > 0 ||
174
+ _this.range.startContainer.nodeName === 'IMG' || _this.range.startContainer.nodeName === 'TABLE')) {
168
175
  newElem = _this.createInsertElement(shiftKey_1);
169
- isImageNode = true;
176
+ isMediaNode = true;
170
177
  isNearBlockLengthZero = false;
171
178
  }
172
179
  else {
173
180
  if ((nearBlockNode.textContent.trim().length !== 0 ||
174
181
  nearBlockNode.childNodes[0].nodeName === 'IMG' ||
175
- (nearBlockNode.textContent.trim() === '' && nearBlockNode.querySelectorAll('img').length > 0))) {
176
- if ((_this.range.startOffset === _this.range.endOffset && _this.range.startOffset != 0)) {
182
+ (nearBlockNode.textContent.trim() === '' && nearBlockNode.querySelectorAll('img,audio,video').length > 0))) {
183
+ if ((_this.range.startOffset === _this.range.endOffset && _this.range.startOffset !== 0)) {
177
184
  newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, false).cloneNode(true);
178
185
  }
179
186
  else {
180
187
  newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, true).cloneNode(true);
181
- isImageNode = true;
188
+ isMediaNode = true;
182
189
  }
183
190
  isNearBlockLengthZero = false;
184
191
  }
@@ -201,7 +208,7 @@ var EnterKeyAction = /** @class */ (function () {
201
208
  if (!isNearBlockLengthZero) {
202
209
  var currentFocusElem = insertElem;
203
210
  var finalFocusElem = void 0;
204
- if (_this.range.startOffset === _this.range.endOffset && _this.range.startOffset != 0) {
211
+ if (_this.range.startOffset === _this.range.endOffset && _this.range.startOffset !== 0) {
205
212
  while (!isNOU(currentFocusElem) && currentFocusElem.nodeName !== '#text' &&
206
213
  currentFocusElem.nodeName !== 'BR') {
207
214
  finalFocusElem = currentFocusElem;
@@ -212,7 +219,7 @@ var EnterKeyAction = /** @class */ (function () {
212
219
  finalFocusElem = currentFocusElem;
213
220
  }
214
221
  finalFocusElem.innerHTML = '<br>';
215
- if (!isImageNode) {
222
+ if (!isMediaNode) {
216
223
  detach(nearBlockNode);
217
224
  }
218
225
  }
@@ -231,6 +238,48 @@ var EnterKeyAction = /** @class */ (function () {
231
238
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), insertElem, 0);
232
239
  }
233
240
  }
241
+ else if (_this.range.startContainer === _this.range.endContainer && _this.range.startContainer.nodeName === 'SPAN' &&
242
+ (_this.range.startContainer.classList.contains('e-video-wrap') ||
243
+ _this.range.startContainer.classList.contains('e-audio-wrap'))) {
244
+ if (nearBlockNode.textContent.trim().length > 0) {
245
+ var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, true);
246
+ var audioVideoElem = !isNOU(newElem.previousSibling.querySelector('.e-video-wrap')) ?
247
+ newElem.previousSibling.querySelector('.e-video-wrap') : newElem.previousSibling.querySelector('.e-audio-wrap');
248
+ var isBRInserted = false;
249
+ var lastNode = audioVideoElem.previousSibling;
250
+ while (!isNOU(lastNode) && lastNode.nodeName !== '#text') {
251
+ lastNode = lastNode.lastChild;
252
+ }
253
+ if (isNOU(lastNode)) {
254
+ var brElm = _this.parent.createElement('br');
255
+ audioVideoElem.parentElement.appendChild(brElm);
256
+ isBRInserted = true;
257
+ }
258
+ if (isBRInserted) {
259
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), audioVideoElem.parentElement, 0);
260
+ }
261
+ else {
262
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), lastNode, lastNode.textContent.length);
263
+ }
264
+ detach(audioVideoElem);
265
+ }
266
+ else {
267
+ var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, true);
268
+ var focusElem = newElem.previousSibling;
269
+ while (!isNOU(focusElem.firstChild)) {
270
+ detach(focusElem.firstChild);
271
+ }
272
+ var brElm = _this.parent.createElement('br');
273
+ focusElem.appendChild(brElm);
274
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), focusElem, 0);
275
+ }
276
+ if (!isNOU(_this.parent.audioModule)) {
277
+ _this.parent.audioModule.hideAudioQuickToolbar();
278
+ }
279
+ if (!isNOU(_this.parent.videoModule)) {
280
+ _this.parent.videoModule.hideVideoQuickToolbar();
281
+ }
282
+ }
234
283
  else {
235
284
  var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, true);
236
285
  if (!isNOU(newElem.childNodes[0]) && newElem.childNodes[0].nodeName === '#text' &&
@@ -246,7 +295,7 @@ var EnterKeyAction = /** @class */ (function () {
246
295
  _this.startNode = startParentElem;
247
296
  }
248
297
  else {
249
- if (_this.startNode.nodeName != 'BR') {
298
+ if (_this.startNode.nodeName !== 'BR') {
250
299
  _this.startNode.appendChild(brElm);
251
300
  }
252
301
  }
@@ -330,6 +379,7 @@ var EnterKeyAction = /** @class */ (function () {
330
379
  var outerBRElem = _this.parent.createElement('br');
331
380
  if (_this.range.startOffset === 0 && _this.range.endOffset === 0 &&
332
381
  !isNOU(currentParent.previousSibling) && currentParent.previousSibling.nodeName === 'BR') {
382
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
333
383
  newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, currentParent, false).cloneNode(true);
334
384
  _this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
335
385
  _this.insertFocusContent();
@@ -338,6 +388,7 @@ var EnterKeyAction = /** @class */ (function () {
338
388
  currentFocusElem = currentFocusElem.lastChild;
339
389
  }
340
390
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), currentFocusElem, 0);
391
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
341
392
  isEmptyBrInserted = true;
342
393
  }
343
394
  else {
@@ -367,7 +418,7 @@ var EnterKeyAction = /** @class */ (function () {
367
418
  EnterKeyAction.prototype.insertBRElement = function () {
368
419
  var isEmptyBrInserted = false;
369
420
  var isFocusTextNode = true;
370
- if (this.range.endContainer.textContent.length == 0 && this.range.startContainer.nodeName === "BR") {
421
+ if (this.range.endContainer.textContent.length === 0 && this.range.startContainer.nodeName === 'BR') {
371
422
  isFocusTextNode = false;
372
423
  }
373
424
  var brElm = this.parent.createElement('br');
@@ -80,6 +80,7 @@ var FileManager = /** @class */ (function () {
80
80
  this.dialogObj.show(Browser.isDevice ? true : false);
81
81
  this.setCssClass({ cssClass: this.parent.cssClass });
82
82
  };
83
+ // eslint-disable-next-line @typescript-eslint/tslint/config
83
84
  FileManager.prototype.setCssClass = function (e) {
84
85
  if (this.dialogObj && e.cssClass) {
85
86
  if (isNullOrUndefined(e.oldCssClass)) {
@@ -19,33 +19,33 @@ export function setAttributes(htmlAttributes, rte, isFrame, initial) {
19
19
  for (var _i = 0, _a = Object.keys(htmlAttributes); _i < _a.length; _i++) {
20
20
  var htmlAttr = _a[_i];
21
21
  if (htmlAttr === 'class') {
22
- target.classList.add(htmlAttributes[htmlAttr]);
22
+ target.classList.add(htmlAttributes["" + htmlAttr]);
23
23
  }
24
- else if (htmlAttr === 'disabled' && htmlAttributes[htmlAttr] === 'disabled') {
24
+ else if (htmlAttr === 'disabled' && htmlAttributes["" + htmlAttr] === 'disabled') {
25
25
  rte.enabled = false;
26
26
  rte.setEnable();
27
27
  }
28
- else if (htmlAttr === 'readonly' && htmlAttributes[htmlAttr] === 'readonly') {
28
+ else if (htmlAttr === 'readonly' && htmlAttributes["" + htmlAttr] === 'readonly') {
29
29
  rte.readonly = true;
30
30
  rte.setReadOnly(initial);
31
31
  }
32
32
  else if (htmlAttr === 'style') {
33
- target.setAttribute('style', htmlAttributes[htmlAttr]);
33
+ target.setAttribute('style', htmlAttributes["" + htmlAttr]);
34
34
  }
35
35
  else if (htmlAttr === 'tabindex') {
36
- rte.inputElement.setAttribute('tabindex', htmlAttributes[htmlAttr]);
36
+ rte.inputElement.setAttribute('tabindex', htmlAttributes["" + htmlAttr]);
37
37
  }
38
38
  else if (htmlAttr === 'placeholder') {
39
- rte.placeholder = htmlAttributes[htmlAttr];
39
+ rte.placeholder = htmlAttributes["" + htmlAttr];
40
40
  rte.setPlaceHolder();
41
41
  }
42
42
  else {
43
43
  var validateAttr = ['name', 'required'];
44
44
  if (validateAttr.indexOf(htmlAttr) > -1) {
45
- rte.valueContainer.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
45
+ rte.valueContainer.setAttribute(htmlAttr, htmlAttributes["" + htmlAttr]);
46
46
  }
47
47
  else {
48
- target.setAttribute(htmlAttr, htmlAttributes[htmlAttr]);
48
+ target.setAttribute(htmlAttr, htmlAttributes["" + htmlAttr]);
49
49
  }
50
50
  }
51
51
  }
@@ -106,10 +106,12 @@ var HtmlEditor = /** @class */ (function () {
106
106
  var restrictKeys = [8, 9, 13, 16, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
107
107
  112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123];
108
108
  var range = this.parent.getRange();
109
+ // eslint-disable-next-line
109
110
  var regEx = new RegExp(String.fromCharCode(8203), 'g');
110
111
  var pointer;
111
112
  if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey) {
112
113
  pointer = range.startOffset;
114
+ // eslint-disable-next-line @typescript-eslint/no-unused-expressions
113
115
  range.startContainer.nodeName === '#text' ? range.startContainer.parentElement.classList.add('currentStartMark') : range.startContainer.classList.add('currentStartMark');
114
116
  if (range.startContainer.textContent.charCodeAt(0) === 8203) {
115
117
  pointer = range.startOffset === 0 ? range.startOffset : range.startOffset - 1;
@@ -113,7 +113,7 @@ var KeyboardEvents = /** @class */ (function (_super) {
113
113
  var keys = Object.keys(_this.keyConfigs);
114
114
  for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {
115
115
  var key = keys_1[_i];
116
- var configCollection = _this.keyConfigs[key].split(',');
116
+ var configCollection = _this.keyConfigs["" + key].split(',');
117
117
  for (var _a = 0, configCollection_1 = configCollection; _a < configCollection_1.length; _a++) {
118
118
  var rconfig = configCollection_1[_a];
119
119
  var rKeyObj = KeyboardEvents_1.getKeyConfigData(rconfig.trim());
@@ -187,7 +187,7 @@ var KeyboardEvents = /** @class */ (function (_super) {
187
187
  */
188
188
  KeyboardEvents.getKeyConfigData = function (config) {
189
189
  if (config in this.configCache) {
190
- return this.configCache[config];
190
+ return this.configCache["" + config];
191
191
  }
192
192
  var keys = config.toLowerCase().split('+');
193
193
  var keyData = {
@@ -202,12 +202,12 @@ var KeyboardEvents = /** @class */ (function (_super) {
202
202
  else {
203
203
  keyData.keyCode = KeyboardEvents_1.getKeyCode(keys[keys.length - 1]);
204
204
  }
205
- KeyboardEvents_1.configCache[config] = keyData;
205
+ KeyboardEvents_1.configCache["" + config] = keyData;
206
206
  return keyData;
207
207
  };
208
208
  // Return the keycode value as string
209
209
  KeyboardEvents.getKeyCode = function (keyVal) {
210
- return keyCode[keyVal] || keyVal.toUpperCase().charCodeAt(0);
210
+ return keyCode["" + keyVal] || keyVal.toUpperCase().charCodeAt(0);
211
211
  };
212
212
  var KeyboardEvents_1;
213
213
  KeyboardEvents.configCache = {};
@@ -58,7 +58,7 @@ var MarkdownToolbarStatus = /** @class */ (function () {
58
58
  }
59
59
  else {
60
60
  for (var i = 0; i < lines.length; i++) {
61
- if (!this.selection.isStartWith(lines[i].text, this.parent.formatter.listTags[type])) {
61
+ if (!this.selection.isStartWith(lines[i].text, this.parent.formatter.listTags["" + type])) {
62
62
  isApply = false;
63
63
  break;
64
64
  }
@@ -118,6 +118,7 @@ var MarkdownToolbarStatus = /** @class */ (function () {
118
118
  return text.search('\\' + cmd + '') !== -1;
119
119
  };
120
120
  MarkdownToolbarStatus.prototype.multiCharRegx = function (cmd) {
121
+ // eslint-disable-next-line
121
122
  return new RegExp('(\\' + cmd + ')', 'g');
122
123
  };
123
124
  return MarkdownToolbarStatus;
@@ -569,6 +569,7 @@ var PasteCleanup = /** @class */ (function () {
569
569
  }
570
570
  }
571
571
  };
572
+ // eslint-disable-next-line @typescript-eslint/tslint/config
572
573
  PasteCleanup.prototype.setCssClass = function (e) {
573
574
  if (this.popupObj && e.cssClass) {
574
575
  if (isNullOrUndefined(e.oldCssClass)) {
@@ -820,7 +821,7 @@ var PasteCleanup = /** @class */ (function () {
820
821
  var groupingTags = deniedTags.slice();
821
822
  var keys = Object.keys(pasteCleanupGroupingTags);
822
823
  var values = keys.map(function (key) {
823
- return pasteCleanupGroupingTags[key];
824
+ return pasteCleanupGroupingTags["" + key];
824
825
  });
825
826
  var addTags = [];
826
827
  for (var i = 0; i < groupingTags.length; i++) {
@@ -134,6 +134,7 @@ var Toolbar = /** @class */ (function () {
134
134
  this.isTransformChild = false;
135
135
  var transformElements = selectAll('[style*="transform"]', document);
136
136
  for (var i = 0; i < transformElements.length; i++) {
137
+ // eslint-disable-next-line max-len
137
138
  if (!isNullOrUndefined(transformElements[i].contains) && transformElements[i].contains(this.parent.element)) {
138
139
  this.isTransformChild = true;
139
140
  break;
@@ -632,6 +633,7 @@ var Toolbar = /** @class */ (function () {
632
633
  this.parent.off(events.toolbarClick, this.toolbarClickHandler);
633
634
  }
634
635
  };
636
+ // eslint-disable-next-line @typescript-eslint/tslint/config
635
637
  Toolbar.prototype.setCssClass = function (e) {
636
638
  if (this.toolbarObj && e.cssClass) {
637
639
  if (isNullOrUndefined(e.oldCssClass)) {
@@ -572,24 +572,24 @@ export declare const imageRemoving: string;
572
572
  */
573
573
  export declare const fileSelected: string;
574
574
  /**
575
- * @hidden
575
+ * @hidden
576
576
 
577
- */
577
+ */
578
578
  export declare const fileUploading: string;
579
579
  /**
580
- * @hidden
580
+ * @hidden
581
581
 
582
- */
582
+ */
583
583
  export declare const fileUploadSuccess: string;
584
584
  /**
585
- * @hidden
585
+ * @hidden
586
586
 
587
- */
587
+ */
588
588
  export declare const fileUploadFailed: string;
589
589
  /**
590
- * @hidden
590
+ * @hidden
591
591
 
592
- */
592
+ */
593
593
  export declare const fileRemoving: string;
594
594
  /**
595
595
  * @hidden
@@ -572,24 +572,24 @@ export var imageRemoving = 'imageRemoving';
572
572
  */
573
573
  export var fileSelected = 'fileSelected';
574
574
  /**
575
- * @hidden
575
+ * @hidden
576
576
 
577
- */
577
+ */
578
578
  export var fileUploading = 'fileUploading';
579
579
  /**
580
- * @hidden
580
+ * @hidden
581
581
 
582
- */
582
+ */
583
583
  export var fileUploadSuccess = 'fileUploadSuccess';
584
584
  /**
585
- * @hidden
585
+ * @hidden
586
586
 
587
- */
587
+ */
588
588
  export var fileUploadFailed = 'fileUploadFailed';
589
589
  /**
590
- * @hidden
590
+ * @hidden
591
591
 
592
- */
592
+ */
593
593
  export var fileRemoving = 'fileRemoving';
594
594
  /**
595
595
  * @hidden
@@ -55,6 +55,7 @@ export declare class RichTextEditor extends Component<HTMLElement> implements IN
55
55
  private defaultResetValue;
56
56
  private isResizeInitialized;
57
57
  private isValueChangeBlurhandler;
58
+ private displayTempElem;
58
59
  /**
59
60
  * @hidden
60
61
 
@@ -1404,6 +1405,7 @@ export declare class RichTextEditor extends Component<HTMLElement> implements IN
1404
1405
  private createScriptElement;
1405
1406
  private createStyleElement;
1406
1407
  private setValue;
1408
+ renderTemplates(callBack: any): void;
1407
1409
  private updateResizeFlag;
1408
1410
  /**
1409
1411
  * Image max width calculation method
@@ -339,7 +339,7 @@ var RichTextEditor = /** @class */ (function (_super) {
339
339
  this.focusIn();
340
340
  }
341
341
  }
342
- var tool = executeGroup[commandName];
342
+ var tool = executeGroup["" + commandName];
343
343
  if (option && option.undo) {
344
344
  if (option.undo && this.formatter.getUndoRedoStack().length === 0) {
345
345
  this.formatter.saveData();
@@ -564,8 +564,10 @@ var RichTextEditor = /** @class */ (function (_super) {
564
564
  audioElm[i].classList.add('e-rte-audio');
565
565
  audioElm[i].classList.add(classes.CLS_AUDIOINLINE);
566
566
  }
567
+ // eslint-disable-next-line max-len
567
568
  if (!audioElm[i].parentElement.classList.contains(classes.CLS_CLICKELEM) && !audioElm[i].parentElement.classList.contains(classes.CLS_AUDIOWRAP)) {
568
569
  var audioWrapElem = this.createElement('span', { className: classes.CLS_AUDIOWRAP });
570
+ audioWrapElem.setAttribute('style', 'width:300px; margin:0 auto;');
569
571
  audioWrapElem.contentEditable = 'false';
570
572
  var audioInnerWrapElem = this.createElement('span', { className: classes.CLS_CLICKELEM });
571
573
  audioWrapElem.appendChild(audioInnerWrapElem);
@@ -583,6 +585,7 @@ var RichTextEditor = /** @class */ (function (_super) {
583
585
  videoElm[i].classList.add('e-rte-video');
584
586
  videoElm[i].classList.add(classes.CLS_VIDEOINLINE);
585
587
  }
588
+ // eslint-disable-next-line max-len
586
589
  if (!videoElm[i].parentElement.classList.contains(classes.CLS_CLICKELEM) && !videoElm[i].parentElement.classList.contains(classes.CLS_VIDEOWRAP)) {
587
590
  var videoWrapElem = this.createElement('span', { className: classes.CLS_VIDEOWRAP });
588
591
  videoWrapElem.contentEditable = 'false';
@@ -594,10 +597,12 @@ var RichTextEditor = /** @class */ (function (_super) {
594
597
  }
595
598
  }
596
599
  if (Browser.userAgent.indexOf('Firefox') !== -1) {
600
+ // eslint-disable-next-line
597
601
  videoElm[i].addEventListener('play', function (args) {
598
602
  _this.notify(events.mouseDown, { args: args });
599
603
  _this.notify('editAreaClick', { args: args });
600
604
  });
605
+ // eslint-disable-next-line
601
606
  videoElm[i].addEventListener('pause', function (args) {
602
607
  _this.notify(events.mouseDown, { args: args });
603
608
  _this.notify('editAreaClick', { args: args });
@@ -616,6 +621,7 @@ var RichTextEditor = /** @class */ (function (_super) {
616
621
  RichTextEditor.prototype.eventInitializer = function () {
617
622
  this.wireEvents();
618
623
  };
624
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
619
625
  RichTextEditor.prototype.cleanList = function (e) {
620
626
  var range = this.getRange();
621
627
  var currentStartContainer = range.startContainer;
@@ -663,6 +669,7 @@ var RichTextEditor = /** @class */ (function (_super) {
663
669
  if (closest(startNode, 'pre') &&
664
670
  (e.which === 8 && range.startContainer.textContent.charCodeAt(range.startOffset - 1) === 8203) ||
665
671
  (e.which === 46 && range.startContainer.textContent.charCodeAt(range.startOffset) === 8203)) {
672
+ // eslint-disable-next-line
666
673
  var regEx = new RegExp(String.fromCharCode(8203), 'g');
667
674
  var pointer = e.which === 8 ? range.startOffset - 1 : range.startOffset;
668
675
  range.startContainer.textContent = range.startContainer.textContent.replace(regEx, '');
@@ -681,6 +688,7 @@ var RichTextEditor = /** @class */ (function (_super) {
681
688
  var bool = true;
682
689
  var removeNodeArray = [];
683
690
  for (i = index; i >= 0; i--) {
691
+ // eslint-disable-next-line max-len
684
692
  if (parentEle.childNodes[i].nodeType === 3 && parentEle.childNodes[i].textContent.charCodeAt(0) === 8203 && bool) {
685
693
  removeNodeArray.push(i);
686
694
  }
@@ -739,7 +747,7 @@ var RichTextEditor = /** @class */ (function (_super) {
739
747
  }
740
748
  }
741
749
  this.notify(events.keyUp, { member: 'keyup', args: e });
742
- if (e.keyCode == 39 || e.keyCode == 37) {
750
+ if (e.keyCode === 39 || e.keyCode === 37) {
743
751
  this.notify(events.tableModulekeyUp, { member: 'tableModulekeyUp', args: e });
744
752
  }
745
753
  if (e.code === 'KeyX' && e.which === 88 && e.keyCode === 88 && e.ctrlKey && (this.inputElement.innerHTML === '' ||
@@ -1158,6 +1166,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1158
1166
  * @hidden
1159
1167
 
1160
1168
  */
1169
+ /* eslint-disable */
1161
1170
  RichTextEditor.prototype.onPropertyChanged = function (newProp, oldProp) {
1162
1171
  for (var _i = 0, _a = Object.keys(newProp); _i < _a.length; _i++) {
1163
1172
  var prop = _a[_i];
@@ -1197,7 +1206,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1197
1206
  break;
1198
1207
  }
1199
1208
  case 'valueTemplate':
1200
- this.setValue();
1209
+ this.setValue(true);
1201
1210
  if (this.showCharCount) {
1202
1211
  this.countModule.refresh();
1203
1212
  }
@@ -1293,7 +1302,6 @@ var RichTextEditor = /** @class */ (function (_super) {
1293
1302
  this.notify(events.xhtmlValidation, { module: 'XhtmlValidation', newProp: newProp, oldProp: oldProp });
1294
1303
  break;
1295
1304
  case 'quickToolbarSettings':
1296
- // eslint-disable-next-line
1297
1305
  newProp.quickToolbarSettings.showOnRightClick ? this.wireContextEvent() : this.unWireContextEvent();
1298
1306
  this.notify(events.modelChanged, { newProp: newProp, oldProp: oldProp });
1299
1307
  break;
@@ -1303,6 +1311,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1303
1311
  }
1304
1312
  }
1305
1313
  };
1314
+ /* eslint-enable */
1306
1315
  /**
1307
1316
  * @hidden
1308
1317
  * @returns {void}
@@ -1644,7 +1653,8 @@ var RichTextEditor = /** @class */ (function (_super) {
1644
1653
  styleEle.rel = 'stylesheet';
1645
1654
  return styleEle;
1646
1655
  };
1647
- RichTextEditor.prototype.setValue = function () {
1656
+ RichTextEditor.prototype.setValue = function (isPropertyChange) {
1657
+ var _this = this;
1648
1658
  if (this.valueTemplate) {
1649
1659
  var regEx = new RegExp(/<(?=.*? .*?\/ ?>|br|hr|input|!--|wbr)[a-z]+.*?>|<([a-z]+).*?<\/\1>/i);
1650
1660
  if (regEx.test(this.valueTemplate)) {
@@ -1652,11 +1662,30 @@ var RichTextEditor = /** @class */ (function (_super) {
1652
1662
  }
1653
1663
  else {
1654
1664
  var compiledTemplate = compile(this.valueTemplate)('', this, 'valueTemplate');
1655
- for (var i = 0; i < compiledTemplate.length; i++) {
1656
- var item = compiledTemplate[i];
1657
- append([item], this.element);
1665
+ if (typeof this.valueTemplate !== 'string' && this.isReact) {
1666
+ this.displayTempElem = this.createElement('div');
1667
+ for (var i = 0; i < compiledTemplate.length; i++) {
1668
+ var item = compiledTemplate[i];
1669
+ append([item], this.displayTempElem);
1670
+ }
1671
+ this.renderTemplates(function () {
1672
+ _this.inputElement.innerHTML = _this.displayTempElem.childNodes[0].innerHTML;
1673
+ _this.setProperties({ value: _this.inputElement.innerHTML.trim() });
1674
+ });
1675
+ }
1676
+ else {
1677
+ var appendElem = this.element;
1678
+ if (isPropertyChange) {
1679
+ this.inputElement.innerHTML = '';
1680
+ appendElem = this.inputElement;
1681
+ }
1682
+ for (var i = 0; i < compiledTemplate.length; i++) {
1683
+ var item = compiledTemplate[i];
1684
+ append([item], appendElem);
1685
+ }
1686
+ this.setProperties({ value: appendElem.innerHTML.trim() });
1687
+ this.renderReactTemplates();
1658
1688
  }
1659
- this.setProperties({ value: this.element.innerHTML.trim() });
1660
1689
  }
1661
1690
  }
1662
1691
  else {
@@ -1672,6 +1701,10 @@ var RichTextEditor = /** @class */ (function (_super) {
1672
1701
  }
1673
1702
  }
1674
1703
  };
1704
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1705
+ RichTextEditor.prototype.renderTemplates = function (callBack) {
1706
+ this.renderReactTemplates(callBack);
1707
+ };
1675
1708
  RichTextEditor.prototype.updateResizeFlag = function () {
1676
1709
  this.isResizeInitialized = true;
1677
1710
  };
@@ -1741,7 +1774,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1741
1774
  var rzHandle = this.element.querySelector('.' + classes.CLS_RTE_RES_HANDLE);
1742
1775
  var rzHeight = this.enableResize ? (!isNOU(rzHandle) ? (rzHandle.offsetHeight + 8) : 0) : 0;
1743
1776
  var expandPopHeight = this.getToolbar() ? this.toolbarModule.getExpandTBarPopHeight() : 0;
1744
- if (this.toolbarSettings.type === ToolbarType.Expand && isExpand && target !== 'preview') {
1777
+ if (this.toolbarSettings.type === ToolbarType.Expand && isExpand) {
1745
1778
  heightValue = (this.height === 'auto' && rzHeight === 0) ? 'auto' : rteHeight - (tbHeight + expandPopHeight + rzHeight) + 'px';
1746
1779
  topValue = (!this.toolbarSettings.enableFloating) ? expandPopHeight : 0;
1747
1780
  }