@syncfusion/ej2-richtexteditor 19.3.43 → 19.3.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/CHANGELOG.md +44 -2
  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 +199 -80
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +195 -80
  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/common/constant.d.ts +8 -8
  13. package/src/common/constant.js +8 -8
  14. package/src/editor-manager/base/editor-manager.js +1 -1
  15. package/src/editor-manager/plugin/clearformat.d.ts +1 -0
  16. package/src/editor-manager/plugin/clearformat.js +1 -0
  17. package/src/editor-manager/plugin/image.js +12 -17
  18. package/src/editor-manager/plugin/inserthtml.js +16 -6
  19. package/src/editor-manager/plugin/lists.js +0 -1
  20. package/src/editor-manager/plugin/ms-word-clean-up.js +1 -0
  21. package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
  22. package/src/editor-manager/plugin/selection-commands.js +52 -2
  23. package/src/editor-manager/plugin/table.js +3 -3
  24. package/src/editor-manager/plugin/toolbar-status.js +3 -3
  25. package/src/rich-text-editor/actions/enter-key.js +4 -16
  26. package/src/rich-text-editor/actions/html-editor.d.ts +1 -0
  27. package/src/rich-text-editor/actions/html-editor.js +31 -1
  28. package/src/rich-text-editor/actions/quick-toolbar.js +5 -2
  29. package/src/rich-text-editor/actions/xhtml-validation.d.ts +1 -0
  30. package/src/rich-text-editor/actions/xhtml-validation.js +5 -3
  31. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +6 -6
  32. package/src/rich-text-editor/base/util.d.ts +1 -0
  33. package/src/rich-text-editor/base/util.js +1 -0
  34. package/src/rich-text-editor/renderer/image-module.d.ts +2 -0
  35. package/src/rich-text-editor/renderer/image-module.js +39 -12
  36. package/src/rich-text-editor/renderer/link-module.js +5 -3
  37. package/src/rich-text-editor/renderer/table-module.js +10 -3
  38. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +0 -1
  39. package/src/rich-text-editor/renderer/toolbar-renderer.js +1 -1
  40. package/styles/bootstrap-dark.css +1 -1
  41. package/styles/bootstrap.css +1 -1
  42. package/styles/bootstrap4.css +1 -1
  43. package/styles/bootstrap5-dark.css +1 -1
  44. package/styles/bootstrap5.css +1 -1
  45. package/styles/fabric-dark.css +1 -1
  46. package/styles/fabric.css +1 -1
  47. package/styles/highcontrast-light.css +1 -1
  48. package/styles/highcontrast.css +1 -1
  49. package/styles/material-dark.css +1 -1
  50. package/styles/material.css +1 -1
  51. package/styles/rich-text-editor/_tailwind-definition.scss +1 -1
  52. package/styles/rich-text-editor/_theme.scss +1 -1
  53. package/styles/rich-text-editor/bootstrap-dark.css +1 -1
  54. package/styles/rich-text-editor/bootstrap.css +1 -1
  55. package/styles/rich-text-editor/bootstrap4.css +1 -1
  56. package/styles/rich-text-editor/bootstrap5-dark.css +1 -1
  57. package/styles/rich-text-editor/bootstrap5.css +1 -1
  58. package/styles/rich-text-editor/fabric-dark.css +1 -1
  59. package/styles/rich-text-editor/fabric.css +1 -1
  60. package/styles/rich-text-editor/highcontrast-light.css +1 -1
  61. package/styles/rich-text-editor/highcontrast.css +1 -1
  62. package/styles/rich-text-editor/material-dark.css +1 -1
  63. package/styles/rich-text-editor/material.css +1 -1
  64. package/styles/rich-text-editor/tailwind-dark.css +1 -1
  65. package/styles/rich-text-editor/tailwind.css +1 -1
  66. package/styles/tailwind-dark.css +1 -1
  67. package/styles/tailwind.css +1 -1
@@ -2515,6 +2515,7 @@ function getEditValue(value, rteObj) {
2515
2515
  }
2516
2516
  /**
2517
2517
  * @param {string} value - specifies the value
2518
+ * @param {IRichTextEditor} rteObj - specifies the rich text editor instance.
2518
2519
  * @returns {string} - returns the string
2519
2520
  * @hidden
2520
2521
  */
@@ -2861,7 +2862,6 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
2861
2862
  * renderListDropDown method
2862
2863
  *
2863
2864
  * @param {IDropDownModel} args - specifies the the arguments.
2864
- * @param {string} item - specifies the string value
2865
2865
  * @returns {void}
2866
2866
  * @hidden
2867
2867
  * @deprecated
@@ -3149,6 +3149,7 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
3149
3149
  enablePersistence: this.parent.enablePersistence,
3150
3150
  enableRtl: this.parent.enableRtl,
3151
3151
  inline: true,
3152
+ value: '#fff',
3152
3153
  created: function () {
3153
3154
  var value = (item === 'backgroundcolor') ? proxy.parent.backgroundColor.default : proxy.parent.fontColor.default;
3154
3155
  colorPicker.setProperties({ value: value });
@@ -5812,7 +5813,10 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
5812
5813
  else {
5813
5814
  var closestAnchor = closest(target, 'a');
5814
5815
  target = closestAnchor ? closestAnchor : target;
5815
- if (target.tagName !== 'IMG' && target.tagName !== 'A' && (!closest(target, 'td,th') || !range.collapsed)) {
5816
+ var startNode = this.parent.getRange().startContainer.parentElement;
5817
+ var endNode = this.parent.getRange().endContainer.parentElement;
5818
+ if ((isNullOrUndefined(closest(startNode, 'A')) || isNullOrUndefined(closest(endNode, 'A'))) && (!closest(target, 'td,th') || !range.collapsed) &&
5819
+ (target.tagName !== 'IMG' || this.parent.getRange().startOffset !== this.parent.getRange().endOffset)) {
5816
5820
  if (this.parent.inlineMode.onSelection && range.collapsed) {
5817
5821
  return;
5818
5822
  }
@@ -6789,16 +6793,16 @@ var MS_WORD_CLEANUP_PLUGIN = 'ms_word_cleanup_plugin';
6789
6793
  */
6790
6794
  var MS_WORD_CLEANUP = 'ms_word_cleanup';
6791
6795
  /**
6792
- * ActionBegin event callback
6793
- *
6794
- * @hidden
6795
- */
6796
+ * ActionBegin event callback
6797
+ *
6798
+ * @hidden
6799
+ */
6796
6800
  var ON_BEGIN = 'onBegin';
6797
6801
  /**
6798
- * Callback for spacelist action
6799
- *
6800
- * @hidden
6801
- */
6802
+ * Callback for spacelist action
6803
+ *
6804
+ * @hidden
6805
+ */
6802
6806
  var SPACE_ACTION = 'actionBegin';
6803
6807
 
6804
6808
  /**
@@ -10577,7 +10581,6 @@ var Lists = /** @__PURE__ @class */ (function () {
10577
10581
  }
10578
10582
  }
10579
10583
  };
10580
- // eslint-disable-next-line
10581
10584
  Lists.prototype.enterList = function (e) {
10582
10585
  var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
10583
10586
  var startNode = range.startContainer.nodeName === 'LI' ? range.startContainer :
@@ -11935,6 +11938,11 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
11935
11938
  var nodeSelection = new NodeSelection();
11936
11939
  var nodeCutter = new NodeCutter();
11937
11940
  var range = nodeSelection.getRange(docElement);
11941
+ if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
11942
+ range.startOffset === range.endOffset && editNode.textContent.length === 0 && editNode.children[0].tagName === 'P') {
11943
+ nodeSelection.setSelectionText(docElement, range.startContainer.children[0], range.startContainer.children[0], 0, 0);
11944
+ range = nodeSelection.getRange(docElement);
11945
+ }
11938
11946
  var isCursor = range.startOffset === range.endOffset && range.startOffset === 0 &&
11939
11947
  range.startContainer === range.endContainer;
11940
11948
  var isCollapsed = range.collapsed;
@@ -12246,15 +12254,20 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
12246
12254
  blockNode = range.endContainer;
12247
12255
  range.setEnd(blockNode, range.endContainer.textContent.length);
12248
12256
  }
12249
- if (!isNullOrUndefined(blockNode) && editNode === blockNode &&
12250
- range.startContainer === editNode && range.endContainer === editNode) {
12251
- blockNode = editNode.firstElementChild;
12252
- range.setStart(editNode.firstElementChild, editNode.firstElementChild.textContent.length);
12253
- range.setEnd(editNode.firstElementChild, editNode.firstElementChild.textContent.length);
12254
- }
12255
12257
  if (blockNode.nodeName === 'BODY' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
12256
12258
  blockNode = range.startContainer;
12257
12259
  }
12260
+ if (blockNode.closest('LI') && node && node.firstElementChild &&
12261
+ ((node).firstElementChild.tagName === 'OL' || node.firstElementChild.tagName === 'UL')) {
12262
+ var liNode = void 0;
12263
+ while (node.firstElementChild.lastElementChild && node.firstElementChild.lastElementChild.tagName === 'LI') {
12264
+ liNode = node.firstElementChild.lastElementChild;
12265
+ liNode.style.removeProperty('margin-left');
12266
+ liNode.style.removeProperty('margin-top');
12267
+ liNode.style.removeProperty('margin-bottom');
12268
+ node.firstElementChild.insertAdjacentElement('afterend', liNode);
12269
+ }
12270
+ }
12258
12271
  if (blockNode.nodeName === 'TD' || blockNode.nodeName === 'TH') {
12259
12272
  var tempSpan = createElement('span', { className: 'tempSpan' });
12260
12273
  range.insertNode(tempSpan);
@@ -12891,7 +12904,7 @@ var ImageCommand = /** @__PURE__ @class */ (function () {
12891
12904
  * @deprecated
12892
12905
  */
12893
12906
  ImageCommand.prototype.imageCommand = function (e) {
12894
- switch (e.value.toString().toLocaleLowerCase()) {
12907
+ switch (e.value.toString().toLowerCase()) {
12895
12908
  case 'image':
12896
12909
  case 'replace':
12897
12910
  this.createImage(e);
@@ -12968,21 +12981,8 @@ var ImageCommand = /** @__PURE__ @class */ (function () {
12968
12981
  var selectedNode = this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)[0];
12969
12982
  var imgElm_1 = (e.value === 'Replace' || isReplaced) ? e.item.selectParent[0] :
12970
12983
  (Browser.isIE ? selectedNode.previousSibling : selectedNode.previousElementSibling);
12971
- var preventLoadCall_1 = false;
12972
12984
  imgElm_1.addEventListener('load', function () {
12973
- if (e.value === 'Replace' || isReplaced) {
12974
- if (!preventLoadCall_1) {
12975
- e.callBack({
12976
- requestType: 'Images',
12977
- editorMode: 'HTML',
12978
- event: e.event,
12979
- range: _this.parent.nodeSelection.getRange(_this.parent.currentDocument),
12980
- elements: [imgElm_1]
12981
- });
12982
- preventLoadCall_1 = true;
12983
- }
12984
- }
12985
- else {
12985
+ if (e.value !== 'Replace' || !isReplaced) {
12986
12986
  e.callBack({
12987
12987
  requestType: 'Images',
12988
12988
  editorMode: 'HTML',
@@ -13112,10 +13112,18 @@ var ImageCommand = /** @__PURE__ @class */ (function () {
13112
13112
  var selectNode = e.item.selectNode[0];
13113
13113
  selectNode.style.height = '';
13114
13114
  selectNode.style.width = '';
13115
- e.item.width !== 'auto' ? selectNode.style.width = formatUnit(e.item.width) :
13115
+ if (e.item.width !== 'auto') {
13116
+ selectNode.style.width = formatUnit(e.item.width);
13117
+ }
13118
+ else {
13116
13119
  selectNode.removeAttribute('width');
13117
- e.item.height !== 'auto' ? selectNode.style.height = formatUnit(e.item.height) :
13120
+ }
13121
+ if (e.item.height !== 'auto') {
13122
+ selectNode.style.height = formatUnit(e.item.height);
13123
+ }
13124
+ else {
13118
13125
  selectNode.removeAttribute('height');
13126
+ }
13119
13127
  this.callBack(e);
13120
13128
  };
13121
13129
  ImageCommand.prototype.imageCaption = function (e) {
@@ -13445,7 +13453,7 @@ var TableCommand = /** @__PURE__ @class */ (function () {
13445
13453
  var currentTabElm = closest(curRow, 'table');
13446
13454
  var thTdElm = closest(curRow, 'table').querySelectorAll('th,td');
13447
13455
  for (var i = 0; i < thTdElm.length; i++) {
13448
- thTdElm[i].dataset.oldWidth = (thTdElm[i].offsetWidth / currentTabElm.offsetWidth * 100) + "%";
13456
+ thTdElm[i].dataset.oldWidth = (thTdElm[i].offsetWidth / currentTabElm.offsetWidth * 100) + '%';
13449
13457
  }
13450
13458
  for (var i = 0; i < allRows.length; i++) {
13451
13459
  curCell = allRows[i].querySelectorAll(':scope > td, :scope > th')[colIndex];
@@ -13458,11 +13466,11 @@ var TableCommand = /** @__PURE__ @class */ (function () {
13458
13466
  // eslint-disable-next-line
13459
13467
  (e.item.subCommand === 'InsertColumnLeft') ? curCell.parentElement.insertBefore(colTemplate, curCell) :
13460
13468
  this.insertAfter(colTemplate, curCell);
13461
- colTemplate.style.width = currentWidth.toFixed(4) + "%";
13469
+ colTemplate.style.width = currentWidth.toFixed(4) + '%';
13462
13470
  delete colTemplate.dataset.oldWidth;
13463
13471
  }
13464
13472
  for (var i = 0; i < thTdElm.length; i++) {
13465
- thTdElm[i].style.width = (Number(thTdElm[i].dataset.oldWidth.split('%')[0]) * currentWidth / previousWidth).toFixed(4) + "%";
13473
+ thTdElm[i].style.width = (Number(thTdElm[i].dataset.oldWidth.split('%')[0]) * currentWidth / previousWidth).toFixed(4) + '%';
13466
13474
  delete thTdElm[i].dataset.oldWidth;
13467
13475
  }
13468
13476
  e.item.selection.setSelectionText(this.parent.currentDocument, selectedCell, selectedCell, 0, 0);
@@ -14400,6 +14408,7 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
14400
14408
  * @param {Document} docElement - specifies the document
14401
14409
  * @param {string} format - specifies the string value
14402
14410
  * @param {Node} endNode - specifies the end node
14411
+ * @param {string} enterAction - specifies the enter key action
14403
14412
  * @param {string} value - specifies the string value
14404
14413
  * @param {string} selector - specifies the string
14405
14414
  * @returns {void}
@@ -14414,7 +14423,6 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
14414
14423
  if (format === 'backgroundcolor' && value === '') {
14415
14424
  value = 'transparent';
14416
14425
  }
14417
- var preventRestore = false;
14418
14426
  var domSelection = new NodeSelection();
14419
14427
  var domNode = new DOMNode(endNode, docElement);
14420
14428
  var nodeCutter = new NodeCutter();
@@ -14426,6 +14434,7 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
14426
14434
  var isCollapsed = false;
14427
14435
  var isFormat = false;
14428
14436
  var isCursor = false;
14437
+ var preventRestore = false;
14429
14438
  var isFontStyle = (['fontcolor', 'fontname', 'fontsize', 'backgroundcolor'].indexOf(format) > -1);
14430
14439
  if (range.collapsed) {
14431
14440
  if (nodes.length > 0) {
@@ -14449,6 +14458,9 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
14449
14458
  else {
14450
14459
  domSelection.endOffset = domSelection.startOffset = 1;
14451
14460
  }
14461
+ if (cursorNode.nodeName === 'BR' && cursorNode.parentNode.textContent.length === 0) {
14462
+ preventRestore = true;
14463
+ }
14452
14464
  }
14453
14465
  }
14454
14466
  isCursor = range.collapsed;
@@ -14496,7 +14508,52 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
14496
14508
  var cursorNode = null;
14497
14509
  if (cursorFormat) {
14498
14510
  cursorNode = cursorNodes[0];
14499
- InsertMethods.unwrap(cursorFormat);
14511
+ if (cursorFormat.firstChild.textContent.charCodeAt(0) === 8203) {
14512
+ var regEx = new RegExp(String.fromCharCode(8203), 'g');
14513
+ var emptySpaceNode = void 0;
14514
+ if (cursorFormat.firstChild === cursorNode) {
14515
+ cursorNode.textContent = cursorNode.textContent.replace(regEx, '');
14516
+ emptySpaceNode = cursorNode;
14517
+
14518
+ }
14519
+ else {
14520
+ cursorFormat.firstChild.textContent = cursorFormat.firstChild.textContent.replace(regEx, '');
14521
+ emptySpaceNode = cursorFormat.firstChild;
14522
+ }
14523
+ var pointer = void 0;
14524
+ if (emptySpaceNode.textContent.length === 0) {
14525
+ if (!isNullOrUndefined(emptySpaceNode.previousSibling)) {
14526
+ cursorNode = emptySpaceNode.previousSibling;
14527
+ pointer = emptySpaceNode.textContent.length - 1;
14528
+ domSelection.setCursorPoint(docElement, emptySpaceNode, pointer);
14529
+ }
14530
+ else if (!isNullOrUndefined(emptySpaceNode.parentElement) && emptySpaceNode.parentElement.textContent.length === 0) {
14531
+ var brElem = document.createElement('BR');
14532
+ emptySpaceNode.parentElement.appendChild(brElem);
14533
+ detach(emptySpaceNode);
14534
+ cursorNode = brElem;
14535
+ domSelection.setCursorPoint(docElement, cursorNode.parentElement, 0);
14536
+ }
14537
+ }
14538
+ }
14539
+ if ((['fontcolor', 'fontname', 'fontsize', 'backgroundcolor'].indexOf(format) > -1)) {
14540
+ if (format === 'fontcolor') {
14541
+ cursorFormat.style.color = value;
14542
+ }
14543
+ else if (format === 'fontname') {
14544
+ cursorFormat.style.fontFamily = value;
14545
+ }
14546
+ else if (format === 'fontsize') {
14547
+ cursorFormat.style.fontSize = value;
14548
+ }
14549
+ else {
14550
+ cursorFormat.style.backgroundColor = value;
14551
+ }
14552
+ cursorNode = cursorFormat;
14553
+ }
14554
+ else {
14555
+ InsertMethods.unwrap(cursorFormat);
14556
+ }
14500
14557
  }
14501
14558
  else {
14502
14559
  if (cursorNodes.length > 1 && range.startOffset > 0 && (cursorNodes[0].firstElementChild &&
@@ -14936,6 +14993,7 @@ var ClearFormat$1 = /** @__PURE__ @class */ (function () {
14936
14993
  *
14937
14994
  * @param {Document} docElement - specifies the document element.
14938
14995
  * @param {Node} endNode - specifies the end node
14996
+ * @param {string} enterAction - specifies the enter key action
14939
14997
  * @param {string} selector - specifies the string value
14940
14998
  * @returns {void}
14941
14999
  * @hidden
@@ -15521,6 +15579,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
15521
15579
  var imgSrc = [];
15522
15580
  var base64Src = [];
15523
15581
  var imgName = [];
15582
+ // eslint-disable-next-line
15524
15583
  var linkRegex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi);
15525
15584
  if (imgElem.length > 0) {
15526
15585
  for (var i = 0; i < imgElem.length; i++) {
@@ -16177,7 +16236,7 @@ var EditorManager = /** @__PURE__ @class */ (function () {
16177
16236
  */
16178
16237
  /* eslint-enable */
16179
16238
  EditorManager.prototype.execCommand = function (command, value, event, callBack, text, exeValue, selector, enterAction) {
16180
- switch (command.toLocaleLowerCase()) {
16239
+ switch (command.toLowerCase()) {
16181
16240
  case 'lists':
16182
16241
  this.observer.notify(LIST_TYPE, { subCommand: value, event: event, callBack: callBack,
16183
16242
  selector: selector, item: exeValue, enterAction: enterAction });
@@ -16362,8 +16421,8 @@ var ToolbarStatus = /** @__PURE__ @class */ (function () {
16362
16421
  var range = nodeSelection.getRange(docElement);
16363
16422
  for (var index = 0; index < nodes.length; index++) {
16364
16423
  while (nodes[index].nodeType === 3 && range.startContainer.nodeType === 3 && nodes[index].parentNode &&
16365
- nodes[index].parentNode.lastElementChild && nodes[index].parentNode.lastElementChild.nodeName !== "BR" &&
16366
- this.getImmediateBlockNode(nodes[index].parentNode, targetNode).textContent.replace(/\u200B/g, '').length === 0 &&
16424
+ nodes[index].parentNode.lastElementChild && nodes[index].parentNode.lastElementChild.nodeName !== 'BR' &&
16425
+ (this.getImmediateBlockNode(nodes[index].parentNode)).textContent.replace(/\u200B/g, '').length === 0 &&
16367
16426
  range.startContainer.textContent.replace(/\u200B/g, '').length === 0 &&
16368
16427
  nodeSelection.get(docElement).toString().replace(/\u200B/g, '').length === 0) {
16369
16428
  nodes[index] = nodes[index].parentNode.lastElementChild.firstChild;
@@ -16439,7 +16498,7 @@ var ToolbarStatus = /** @__PURE__ @class */ (function () {
16439
16498
  }
16440
16499
  return nodeCollection;
16441
16500
  };
16442
- ToolbarStatus.getImmediateBlockNode = function (node, editNode) {
16501
+ ToolbarStatus.getImmediateBlockNode = function (node) {
16443
16502
  do {
16444
16503
  node = node.parentNode;
16445
16504
  } while (node && BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0);
@@ -16922,22 +16981,24 @@ var XhtmlValidation = /** @__PURE__ @class */ (function () {
16922
16981
  this.ImageTags();
16923
16982
  this.removeTags();
16924
16983
  this.RemoveUnsupported();
16925
- this.currentElement.innerHTML = this.selfEncloseValidation(this.currentElement.innerHTML, this.currentElement.innerText === "\n" ? this.currentElement.innerText.length : this.currentElement.innerText.trim().length);
16984
+ this.currentElement.innerHTML = this.selfEncloseValidation(this.currentElement.innerHTML, this.currentElement.innerText === '\n' ?
16985
+ this.currentElement.innerText.length : this.currentElement.innerText.trim().length);
16926
16986
  this.parent.setProperties({ value: this.currentElement.innerHTML }, true);
16927
16987
  }
16928
16988
  };
16929
16989
  /**
16930
16990
  * @param {string} currentValue - specifies the string value.
16991
+ * @param {number} valueLength - specifies the length of the current value.
16931
16992
  * @returns {void}
16932
16993
  * @deprecated
16933
16994
  */
16934
16995
  XhtmlValidation.prototype.selfEncloseValidation = function (currentValue, valueLength) {
16935
16996
  if (valueLength === 0 && currentValue.indexOf('table') < 0 && currentValue.indexOf('img') < 0) {
16936
16997
  var arrayValue = currentValue.split('&nbsp;');
16937
- arrayValue[arrayValue.length - 1] = "&#8203;" + arrayValue[arrayValue.length - 1];
16998
+ arrayValue[arrayValue.length - 1] = '&#8203;' + arrayValue[arrayValue.length - 1];
16938
16999
  currentValue = arrayValue.join('');
16939
17000
  }
16940
- currentValue = currentValue.replace(/<br>/g, '<br/>').replace(/<hr>/g, '<hr/>').replace(/&nbsp;/gi, ' ').replace(/ /g, ' ');
17001
+ currentValue = currentValue.replace(/<br>/g, '<br/>').replace(/<hr>/g, '<hr/>').replace(/ /g, ' ');
16941
17002
  var valueTemp;
16942
17003
  var valueDupe = [];
16943
17004
  var valueOriginal = [];
@@ -17113,6 +17174,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
17113
17174
  this.parent.on(initialLoad, this.instantiateRenderer, this);
17114
17175
  this.parent.on(htmlToolbarClick, this.onToolbarClick, this);
17115
17176
  this.parent.on(keyDown, this.onKeyDown, this);
17177
+ this.parent.on(keyUp, this.onKeyUp, this);
17116
17178
  this.parent.on(renderColorPicker, this.renderColorPicker, this);
17117
17179
  this.parent.on(initialEnd, this.render, this);
17118
17180
  this.parent.on(modelChanged, this.onPropertyChanged, this);
@@ -17147,6 +17209,30 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
17147
17209
  this.saveSelection.restore();
17148
17210
  }
17149
17211
  };
17212
+ HtmlEditor.prototype.onKeyUp = function (e) {
17213
+ var args = e.args;
17214
+ var restrictKeys = [8, 9, 13, 16, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
17215
+ 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123];
17216
+ var range = this.parent.getRange();
17217
+ var regEx = new RegExp(String.fromCharCode(8203), 'g');
17218
+ var pointer;
17219
+ if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey) {
17220
+ if (range.startContainer.textContent.charCodeAt(0) === 8203) {
17221
+ pointer = range.startOffset - 1;
17222
+ range.startContainer.textContent = range.startContainer.textContent.replace(regEx, '');
17223
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), range.startContainer, pointer);
17224
+ }
17225
+ if (!isNullOrUndefined(range.startContainer.previousSibling) && !isNullOrUndefined(range.startContainer.previousSibling.parentElement) &&
17226
+ range.startContainer.parentElement === range.startContainer.previousSibling.parentElement && range.startContainer.previousSibling.textContent.charCodeAt(0) === 8203) {
17227
+ range.startContainer.previousSibling.textContent = range.startContainer.previousSibling.textContent.replace(regEx, '');
17228
+ }
17229
+ if (range.endContainer.textContent.charCodeAt(range.endOffset) === 8203) {
17230
+ pointer = range.startOffset;
17231
+ range.endContainer.textContent = range.endContainer.textContent.replace(regEx, '');
17232
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), range.startContainer, pointer);
17233
+ }
17234
+ }
17235
+ };
17150
17236
  HtmlEditor.prototype.onKeyDown = function (e) {
17151
17237
  var _this = this;
17152
17238
  var currentRange;
@@ -17357,7 +17443,12 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
17357
17443
  while (this.deleteOldRangeElement.firstChild) {
17358
17444
  this.deleteRangeElement.appendChild(this.deleteOldRangeElement.childNodes[0]);
17359
17445
  }
17360
- !isLiElement ? detach(this.deleteOldRangeElement) : detach(this.deleteOldRangeElement.parentElement);
17446
+ if (!isLiElement) {
17447
+ detach(this.deleteOldRangeElement);
17448
+ }
17449
+ else {
17450
+ detach(this.deleteOldRangeElement.parentElement);
17451
+ }
17361
17452
  this.deleteRangeElement.normalize();
17362
17453
  }
17363
17454
  else {
@@ -19401,7 +19492,8 @@ var Link = /** @__PURE__ @class */ (function () {
19401
19492
  this.contentModule = this.rendererFactory.getRenderer(RenderType.Content);
19402
19493
  var isPopupOpen = this.quickToolObj.linkQTBar.element.classList.contains('e-rte-pop');
19403
19494
  if (target.nodeName === 'A' && (target.childNodes.length > 0 && target.childNodes[0].nodeName !== 'IMG') &&
19404
- e.args.target.nodeName !== 'IMG') {
19495
+ e.args.target.nodeName !== 'IMG' &&
19496
+ !isNullOrUndefined(closest(this.parent.getRange().startContainer.parentElement, 'A')) && !isNullOrUndefined(closest(this.parent.getRange().endContainer.parentElement, 'A'))) {
19405
19497
  if (isPopupOpen) {
19406
19498
  return;
19407
19499
  }
@@ -19662,7 +19754,8 @@ var Link = /** @__PURE__ @class */ (function () {
19662
19754
  else {
19663
19755
  argsValue = this.args;
19664
19756
  }
19665
- this.selfLink.parent.formatter.process(this.selfLink.parent, argsValue, (!isNullOrUndefined(this.args) && this.args.originalEvent), value);
19757
+ this.selfLink.parent.formatter.process(this.selfLink.parent, argsValue, (!isNullOrUndefined(this.args) &&
19758
+ this.args.originalEvent), value);
19666
19759
  this.selfLink.parent.contentModule.getEditPanel().focus();
19667
19760
  };
19668
19761
  Link.prototype.isUrl = function (url) {
@@ -20081,7 +20174,7 @@ var Image = /** @__PURE__ @class */ (function () {
20081
20174
  if (width > height) {
20082
20175
  img.style.minWidth = '20px';
20083
20176
  if (this.parent.insertImageSettings.resizeByPercent) {
20084
- if (parseInt('' + img.getBoundingClientRect().width + '') !== 0 && parseInt('' + width + '') !== 0) {
20177
+ if (parseInt('' + img.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
20085
20178
  var percentageValue = this.pixToPerc((width / height * expectedY), (img.previousElementSibling || img.parentElement));
20086
20179
  img.style.width = Math.min(Math.round((percentageValue / img.getBoundingClientRect().width) * expectedX * 100) / 100, 100) + '%';
20087
20180
  }
@@ -20107,7 +20200,7 @@ var Image = /** @__PURE__ @class */ (function () {
20107
20200
  }
20108
20201
  else if (height > width) {
20109
20202
  if (this.parent.insertImageSettings.resizeByPercent) {
20110
- if (parseInt('' + img.getBoundingClientRect().width + '') !== 0 && parseInt('' + width + '') !== 0) {
20203
+ if (parseInt('' + img.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
20111
20204
  img.style.width = Math.min(Math.round((width / img.getBoundingClientRect().width) * expectedX * 100) / 100, 100) + '%';
20112
20205
  }
20113
20206
  else {
@@ -20580,7 +20673,7 @@ var Image = /** @__PURE__ @class */ (function () {
20580
20673
  var target = args.target;
20581
20674
  this.contentModule = this.rendererFactory.getRenderer(RenderType.Content);
20582
20675
  var isPopupOpen = this.quickToolObj.imageQTBar.element.classList.contains('e-rte-pop');
20583
- if (target.nodeName === 'IMG' && this.parent.quickToolbarModule) {
20676
+ if (target.nodeName === 'IMG' && this.parent.quickToolbarModule && this.parent.getRange().startOffset === this.parent.getRange().endOffset) {
20584
20677
  if (isPopupOpen) {
20585
20678
  return;
20586
20679
  }
@@ -20819,13 +20912,34 @@ var Image = /** @__PURE__ @class */ (function () {
20819
20912
  }
20820
20913
  };
20821
20914
  Image.prototype.imageRemovePost = function (src) {
20915
+ var proxy = this;
20916
+ var absoluteUrl = '';
20917
+ if (src.indexOf('http://') > -1 || src.indexOf('https://') > -1) {
20918
+ absoluteUrl = src;
20919
+ }
20920
+ else {
20921
+ absoluteUrl = new URL(src, document.baseURI).href;
20922
+ }
20923
+ this.removingImgName = absoluteUrl.replace(/^.*[\\\/]/, '');
20924
+ var xhr = new XMLHttpRequest();
20925
+ xhr.addEventListener("readystatechange", function () {
20926
+ if (this.readyState == 4 && this.status == 200) {
20927
+ proxy.triggerPost(this.response);
20928
+ }
20929
+ });
20930
+ xhr.open('GET', absoluteUrl);
20931
+ xhr.responseType = 'blob';
20932
+ xhr.send();
20933
+ };
20934
+ Image.prototype.triggerPost = function (response) {
20822
20935
  var removeUrl = this.parent.insertImageSettings.removeUrl;
20823
20936
  if (isNullOrUndefined(removeUrl) || removeUrl === '') {
20824
20937
  return;
20825
20938
  }
20939
+ var file = new File([response], this.removingImgName);
20826
20940
  var ajax = new Ajax(removeUrl, 'POST', true, null);
20827
20941
  var formData = new FormData();
20828
- formData.append(name, src);
20942
+ formData.append('UploadFiles', file);
20829
20943
  ajax.send(formData);
20830
20944
  };
20831
20945
  Image.prototype.caption = function (e) {
@@ -21065,9 +21179,15 @@ var Image = /** @__PURE__ @class */ (function () {
21065
21179
  (this.parent.getToolbarElement() && this.parent.getToolbarElement().contains(e.target) &&
21066
21180
  !closest(target, '#' + this.parent.getID() + '_toolbar_Image') &&
21067
21181
  !target.querySelector('#' + this.parent.getID() + '_toolbar_Image')))) {
21068
- this.dialogObj.hide({ returnValue: true });
21069
- this.parent.isBlur = true;
21070
- dispatchEvent(this.parent.element, 'focusout');
21182
+ /* eslint-disable */
21183
+ if (e.offsetX > e.target.clientWidth || e.offsetY > e.target.clientHeight) {
21184
+ }
21185
+ else {
21186
+ this.dialogObj.hide({ returnValue: true });
21187
+ this.parent.isBlur = true;
21188
+ dispatchEvent(this.parent.element, 'focusout');
21189
+ }
21190
+ /* eslint-enable */
21071
21191
  }
21072
21192
  if (e.target.tagName !== 'IMG' && this.imgResizeDiv && !(this.quickToolObj &&
21073
21193
  this.quickToolObj.imageQTBar && this.quickToolObj.imageQTBar.element.contains(e.target)) &&
@@ -21171,11 +21291,11 @@ var Image = /** @__PURE__ @class */ (function () {
21171
21291
  var imgWidth = this.i10n.getConstant('imageWidth');
21172
21292
  var imgSizeWrap = this.parent.createElement('div', { className: 'e-img-sizewrap' });
21173
21293
  var widthVal = isNullOrUndefined(this.changedWidthValue) && (selectNode.style.width.toString() === 'auto' ||
21174
- selectNode.style.width !== "") ? selectNode.style.width : !isNullOrUndefined(this.changedWidthValue) ?
21175
- this.changedWidthValue : (parseInt(selectNode.getClientRects()[0].width.toString())).toString();
21294
+ selectNode.style.width !== '') ? selectNode.style.width : !isNullOrUndefined(this.changedWidthValue) ?
21295
+ this.changedWidthValue : (parseInt(selectNode.getClientRects()[0].width.toString(), 10)).toString();
21176
21296
  var heightVal = isNullOrUndefined(this.changedHeightValue) && (selectNode.style.height.toString() === 'auto' ||
21177
- selectNode.style.height !== "") ? selectNode.style.height : !isNullOrUndefined(this.changedHeightValue) ?
21178
- this.changedHeightValue : (parseInt(selectNode.getClientRects()[0].height.toString())).toString();
21297
+ selectNode.style.height !== '') ? selectNode.style.height : !isNullOrUndefined(this.changedHeightValue) ?
21298
+ this.changedHeightValue : (parseInt(selectNode.getClientRects()[0].height.toString(), 10)).toString();
21179
21299
  this.changedWidthValue = null;
21180
21300
  this.changedHeightValue = null;
21181
21301
  var content = '<div class="e-rte-label"><label>' + imgWidth +
@@ -21214,7 +21334,7 @@ var Image = /** @__PURE__ @class */ (function () {
21214
21334
  return value;
21215
21335
  }
21216
21336
  else {
21217
- return "auto";
21337
+ return 'auto';
21218
21338
  }
21219
21339
  };
21220
21340
  Image.prototype.insertSize = function (e) {
@@ -22416,8 +22536,12 @@ var Table = /** @__PURE__ @class */ (function () {
22416
22536
  if (args.args && args.args.item.cssClass) {
22417
22537
  var classList = args.args.item.cssClass.split(' ');
22418
22538
  for (var i = 0; i < classList.length; i++) {
22419
- (table.classList.contains(classList[i])) ? table.classList.remove(classList[i]) :
22539
+ if (table.classList.contains(classList[i])) {
22540
+ table.classList.remove(classList[i]);
22541
+ }
22542
+ else {
22420
22543
  table.classList.add(classList[i]);
22544
+ }
22421
22545
  }
22422
22546
  }
22423
22547
  this.parent.formatter.saveData();
@@ -22573,7 +22697,9 @@ var Table = /** @__PURE__ @class */ (function () {
22573
22697
  }
22574
22698
  var range = this.parent.formatter.editorManager.nodeSelection.getRange(this.contentModule.getDocument());
22575
22699
  var closestTable = closest(target, 'table');
22576
- if (target && target.nodeName !== 'A' && target.nodeName !== 'IMG' && (target.nodeName === 'TD' || target.nodeName === 'TH' ||
22700
+ var startNode = this.parent.getRange().startContainer.parentElement;
22701
+ var endNode = this.parent.getRange().endContainer.parentElement;
22702
+ if (target && target.nodeName !== 'A' && target.nodeName !== 'IMG' && startNode === endNode && (target.nodeName === 'TD' || target.nodeName === 'TH' ||
22577
22703
  target.nodeName === 'TABLE' || (closestTable && this.parent.contentModule.getEditPanel().contains(closestTable)))
22578
22704
  && !(range.startContainer.nodeType === 3 && !range.collapsed)) {
22579
22705
  var range_1 = this.parent.formatter.editorManager.nodeSelection.getRange(this.contentModule.getDocument());
@@ -22660,7 +22786,6 @@ var Table = /** @__PURE__ @class */ (function () {
22660
22786
  tdNode : target;
22661
22787
  removeClass(this.contentModule.getEditPanel().querySelectorAll('table td, table th'), CLS_TABLE_SEL);
22662
22788
  if (target && (target.tagName === 'TD' || target.tagName === 'TH')) {
22663
- target.removeAttribute('class');
22664
22789
  addClass([target], CLS_TABLE_SEL);
22665
22790
  this.activeCell = target;
22666
22791
  this.curTable = (this.curTable) ? this.curTable : closest(target, 'table');
@@ -22759,6 +22884,7 @@ var Table = /** @__PURE__ @class */ (function () {
22759
22884
  top: 0,
22760
22885
  left: 0
22761
22886
  };
22887
+ // eslint-disable-next-line
22762
22888
  var offset = elem.getBoundingClientRect();
22763
22889
  var doc = elem.ownerDocument;
22764
22890
  var offsetParent = elem.offsetParent || doc.documentElement;
@@ -22771,6 +22897,7 @@ var Table = /** @__PURE__ @class */ (function () {
22771
22897
  offsetParent = closest(offsetParent, '.e-rte-content');
22772
22898
  }
22773
22899
  if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
22900
+ // eslint-disable-next-line
22774
22901
  parentOffset = offsetParent.getBoundingClientRect();
22775
22902
  }
22776
22903
  return {
@@ -24173,9 +24300,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24173
24300
  }
24174
24301
  else if (focusElem.textContent.length === 0) {
24175
24302
  var currentFocusElem = focusElem.previousSibling.lastChild;
24176
- var finalFocusElem = void 0;
24177
24303
  while (currentFocusElem.nodeName !== '#text') {
24178
- finalFocusElem = currentFocusElem;
24179
24304
  currentFocusElem = currentFocusElem.lastChild;
24180
24305
  }
24181
24306
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), currentFocusElem, currentFocusElem.textContent.length);
@@ -24190,9 +24315,9 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24190
24315
  _this.getRangeNode();
24191
24316
  }
24192
24317
  }
24193
- if (_this.range.startContainer === _this.range.endContainer && _this.range.startOffset === 0 &&
24194
- _this.range.startOffset == _this.range.endOffset && _this.range.startContainer === _this.parent.inputElement) {
24195
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.range.startContainer.childNodes[_this.range.startOffset], _this.range.startOffset);
24318
+ if (_this.range.startContainer === _this.range.endContainer &&
24319
+ _this.range.startOffset === _this.range.endOffset && _this.range.startContainer === _this.parent.inputElement) {
24320
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.range.startContainer.childNodes[_this.range.startOffset], 0);
24196
24321
  _this.getRangeNode();
24197
24322
  }
24198
24323
  if (_this.parent.enterKey === 'P' || _this.parent.enterKey === 'DIV' ||
@@ -24268,7 +24393,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24268
24393
  }
24269
24394
  _this.parent.formatter.editorManager.domNode.insertAfter(insertElm, newElem);
24270
24395
  detach(newElem);
24271
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), insertElm, insertElm.textContent.length >= 0 ? 0 : 1);
24396
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode) ? insertElm : _this.startNode, 0);
24272
24397
  }
24273
24398
  }
24274
24399
  e.args.preventDefault();
@@ -24308,18 +24433,14 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24308
24433
  }
24309
24434
  else {
24310
24435
  var newElem = void 0;
24311
- var focusElem = void 0;
24312
24436
  var outerBRElem = _this.parent.createElement('br');
24313
24437
  if (_this.range.startOffset === 0 && _this.range.endOffset === 0 &&
24314
24438
  !isNullOrUndefined(currentParent.previousSibling) && currentParent.previousSibling.nodeName === 'BR') {
24315
- focusElem = _this.range.startContainer;
24316
24439
  newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, currentParent, false).cloneNode(true);
24317
24440
  _this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
24318
24441
  _this.insertFocusContent();
24319
24442
  var currentFocusElem = outerBRElem.nextSibling;
24320
- var finalFocusElem = void 0;
24321
24443
  while (!isNullOrUndefined(currentFocusElem) && currentFocusElem.nodeName !== '#text') {
24322
- finalFocusElem = currentFocusElem;
24323
24444
  currentFocusElem = currentFocusElem.lastChild;
24324
24445
  }
24325
24446
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), currentFocusElem, 0);
@@ -24357,12 +24478,6 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24357
24478
  }
24358
24479
  e.args.preventDefault();
24359
24480
  }
24360
- if (_this.range.startContainer.nodeName === '#text') {
24361
- _this.range.startContainer.parentElement.scrollIntoView(false);
24362
- }
24363
- else {
24364
- _this.range.startContainer.scrollIntoView(false);
24365
- }
24366
24481
  _this.parent.trigger(actionComplete, { requestType: shiftKey_1 ? 'ShiftEnterAction' : 'EnterAction', args: e.args });
24367
24482
  }
24368
24483
  });