@syncfusion/ej2-richtexteditor 19.3.47 → 19.3.57

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 (51) hide show
  1. package/CHANGELOG.md +46 -0
  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 +133 -45
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +133 -45
  7. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  8. package/dist/global/ej2-richtexteditor.min.js +2 -2
  9. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +12 -12
  12. package/src/editor-manager/plugin/inserthtml.js +9 -1
  13. package/src/rich-text-editor/actions/dropdown-buttons.js +10 -0
  14. package/src/rich-text-editor/actions/enter-key.d.ts +1 -0
  15. package/src/rich-text-editor/actions/enter-key.js +38 -28
  16. package/src/rich-text-editor/actions/html-editor.js +2 -2
  17. package/src/rich-text-editor/actions/quick-toolbar.d.ts +1 -0
  18. package/src/rich-text-editor/actions/quick-toolbar.js +16 -1
  19. package/src/rich-text-editor/base/interface.d.ts +2 -0
  20. package/src/rich-text-editor/base/rich-text-editor.js +1 -2
  21. package/src/rich-text-editor/formatter/formatter.js +3 -3
  22. package/src/rich-text-editor/renderer/image-module.js +49 -4
  23. package/src/rich-text-editor/renderer/toolbar-renderer.js +3 -2
  24. package/src/selection/selection.js +2 -1
  25. package/styles/bootstrap-dark.css +4 -0
  26. package/styles/bootstrap.css +4 -0
  27. package/styles/bootstrap4.css +4 -0
  28. package/styles/bootstrap5-dark.css +4 -0
  29. package/styles/bootstrap5.css +4 -0
  30. package/styles/fabric-dark.css +4 -0
  31. package/styles/fabric.css +4 -0
  32. package/styles/highcontrast-light.css +4 -0
  33. package/styles/highcontrast.css +4 -0
  34. package/styles/material-dark.css +4 -0
  35. package/styles/material.css +4 -0
  36. package/styles/rich-text-editor/_layout.scss +4 -0
  37. package/styles/rich-text-editor/bootstrap-dark.css +4 -0
  38. package/styles/rich-text-editor/bootstrap.css +4 -0
  39. package/styles/rich-text-editor/bootstrap4.css +4 -0
  40. package/styles/rich-text-editor/bootstrap5-dark.css +4 -0
  41. package/styles/rich-text-editor/bootstrap5.css +4 -0
  42. package/styles/rich-text-editor/fabric-dark.css +4 -0
  43. package/styles/rich-text-editor/fabric.css +4 -0
  44. package/styles/rich-text-editor/highcontrast-light.css +4 -0
  45. package/styles/rich-text-editor/highcontrast.css +4 -0
  46. package/styles/rich-text-editor/material-dark.css +4 -0
  47. package/styles/rich-text-editor/material.css +4 -0
  48. package/styles/rich-text-editor/tailwind-dark.css +4 -0
  49. package/styles/rich-text-editor/tailwind.css +4 -0
  50. package/styles/tailwind-dark.css +4 -0
  51. package/styles/tailwind.css +4 -0
@@ -2741,7 +2741,8 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
2741
2741
  this.parent.notify(beforeDropDownItemRender, args);
2742
2742
  };
2743
2743
  ToolbarRenderer.prototype.dropDownOpen = function (args) {
2744
- if (args.element.parentElement.getAttribute('id').indexOf('TableCell') > -1) {
2744
+ if (args.element.parentElement.getAttribute('id').indexOf('TableCell') > -1 && !isNullOrUndefined(args.element.parentElement.querySelector('.e-cell-merge')) &&
2745
+ (!isNullOrUndefined(args.element.parentElement.querySelector('.e-cell-horizontal-split')) || !isNullOrUndefined(args.element.parentElement.querySelector('.e-cell-vertical-split')))) {
2745
2746
  var listEle = args.element.querySelectorAll('li');
2746
2747
  if (this.parent.inputElement.querySelectorAll('.e-cell-select').length === 1) {
2747
2748
  addClass([listEle[0]], 'e-disabled');
@@ -3605,6 +3606,11 @@ var DropDownButtons = /** @__PURE__ @class */ (function () {
3605
3606
  var prop = _a[_i];
3606
3607
  switch (prop) {
3607
3608
  case 'fontFamily':
3609
+ if (this.parent.inlineMode.enable) {
3610
+ if (!isNullOrUndefined(this.parent.fontFamily.default)) {
3611
+ this.getEditNode().style.fontFamily = this.parent.fontFamily.default;
3612
+ }
3613
+ }
3608
3614
  if (this.fontNameDropDown) {
3609
3615
  for (var _b = 0, _c = Object.keys(newProp.fontFamily); _b < _c.length; _b++) {
3610
3616
  var fontFamily$$1 = _c[_b];
@@ -3636,6 +3642,11 @@ var DropDownButtons = /** @__PURE__ @class */ (function () {
3636
3642
  }
3637
3643
  break;
3638
3644
  case 'fontSize':
3645
+ if (this.parent.inlineMode) {
3646
+ if (!isNullOrUndefined(this.parent.fontSize.default)) {
3647
+ this.getEditNode().style.fontSize = this.parent.fontSize.default;
3648
+ }
3649
+ }
3639
3650
  if (this.fontSizeDropDown) {
3640
3651
  for (var _d = 0, _e = Object.keys(newProp.fontSize); _d < _e.length; _d++) {
3641
3652
  var fontSize$$1 = _e[_d];
@@ -5700,6 +5711,11 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
5700
5711
  this.parent.isBlur = false;
5701
5712
  this.parent.isRTE = true;
5702
5713
  };
5714
+ QuickToolbar.prototype.keyUpQT = function (e) {
5715
+ if (e.which == 27) {
5716
+ this.hideQuickToolbars();
5717
+ }
5718
+ };
5703
5719
  QuickToolbar.prototype.renderQuickToolbars = function () {
5704
5720
  if (this.linkQTBar || this.imageQTBar || this.textQTBar || this.tableQTBar) {
5705
5721
  return;
@@ -5714,15 +5730,19 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
5714
5730
  this.renderFactory.addRenderer(RenderType.TableToolbar, this.tableQTBar);
5715
5731
  if (this.linkQTBar) {
5716
5732
  EventHandler.add(this.linkQTBar.element, 'mousedown', this.onMouseDown, this);
5733
+ EventHandler.add(this.linkQTBar.element, 'keyup', this.keyUpQT, this);
5717
5734
  }
5718
5735
  if (this.imageQTBar) {
5719
5736
  EventHandler.add(this.imageQTBar.element, 'mousedown', this.onMouseDown, this);
5737
+ EventHandler.add(this.imageQTBar.element, 'keyup', this.keyUpQT, this);
5720
5738
  }
5721
5739
  if (this.textQTBar) {
5722
5740
  EventHandler.add(this.textQTBar.element, 'mousedown', this.onMouseDown, this);
5741
+ EventHandler.add(this.textQTBar.element, 'keyup', this.keyUpQT, this);
5723
5742
  }
5724
5743
  if (this.tableQTBar) {
5725
5744
  EventHandler.add(this.tableQTBar.element, 'mousedown', this.onMouseDown, this);
5745
+ EventHandler.add(this.tableQTBar.element, 'keyup', this.keyUpQT, this);
5726
5746
  }
5727
5747
  };
5728
5748
  QuickToolbar.prototype.renderInlineQuickToolbar = function () {
@@ -5731,6 +5751,7 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
5731
5751
  this.inlineQTBar = this.createQTBar('Inline', 'MultiRow', this.parent.toolbarSettings.items, RenderType.InlineToolbar);
5732
5752
  this.renderFactory.addRenderer(RenderType.InlineToolbar, this.inlineQTBar);
5733
5753
  EventHandler.add(this.inlineQTBar.element, 'mousedown', this.onMouseDown, this);
5754
+ EventHandler.add(this.inlineQTBar.element, 'keyup', this.keyUpQT, this);
5734
5755
  }
5735
5756
  };
5736
5757
  /**
@@ -5744,7 +5765,7 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
5744
5765
  * @deprecated
5745
5766
  */
5746
5767
  QuickToolbar.prototype.showInlineQTBar = function (x, y, target) {
5747
- if (this.parent.readonly) {
5768
+ if (this.parent.readonly || target.tagName.toLowerCase() === "img") {
5748
5769
  return;
5749
5770
  }
5750
5771
  this.inlineQTBar.showPopup(x, y, target);
@@ -5885,22 +5906,27 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
5885
5906
  QuickToolbar.prototype.destroy = function () {
5886
5907
  if (this.linkQTBar) {
5887
5908
  EventHandler.remove(this.linkQTBar.element, 'mousedown', this.onMouseDown);
5909
+ EventHandler.remove(this.linkQTBar.element, 'keyup', this.keyUpQT);
5888
5910
  this.linkQTBar.destroy();
5889
5911
  }
5890
5912
  if (this.textQTBar) {
5891
5913
  EventHandler.remove(this.textQTBar.element, 'mousedown', this.onMouseDown);
5914
+ EventHandler.remove(this.textQTBar.element, 'keyup', this.keyUpQT);
5892
5915
  this.textQTBar.destroy();
5893
5916
  }
5894
5917
  if (this.imageQTBar) {
5895
5918
  EventHandler.remove(this.imageQTBar.element, 'mousedown', this.onMouseDown);
5919
+ EventHandler.remove(this.imageQTBar.element, 'keyup', this.keyUpQT);
5896
5920
  this.imageQTBar.destroy();
5897
5921
  }
5898
5922
  if (this.tableQTBar) {
5899
5923
  EventHandler.remove(this.tableQTBar.element, 'mousedown', this.onMouseDown);
5924
+ EventHandler.remove(this.tableQTBar.element, 'keyup', this.keyUpQT);
5900
5925
  this.tableQTBar.destroy();
5901
5926
  }
5902
5927
  if (this.inlineQTBar) {
5903
5928
  EventHandler.remove(this.inlineQTBar.element, 'mousedown', this.onMouseDown);
5929
+ EventHandler.remove(this.inlineQTBar.element, 'keyup', this.keyUpQT);
5904
5930
  if (isIDevice()) {
5905
5931
  EventHandler.remove(document, 'selectionchange', this.selectionChangeHandler);
5906
5932
  }
@@ -6891,7 +6917,7 @@ var Formatter = /** @__PURE__ @class */ (function () {
6891
6917
  || ((args.item.subCommand === 'FontName' || args.item.subCommand === 'FontSize') && args.name === 'dropDownSelect')
6892
6918
  || ((args.item.subCommand === 'BackgroundColor' || args.item.subCommand === 'FontColor')
6893
6919
  && args.name === 'colorPickerChanged'))) {
6894
- extend(args, args, { requestType: args.item.subCommand, cancel: false, itemCollection: value }, true);
6920
+ extend(args, args, { requestType: args.item.subCommand, cancel: false, itemCollection: value, selectType: args.name }, true);
6895
6921
  self.trigger(actionBegin, args, function (actionBeginArgs) {
6896
6922
  if (!actionBeginArgs.cancel) {
6897
6923
  if (_this.getUndoRedoStack().length === 0 && actionBeginArgs.item.command !== 'Links'
@@ -6909,8 +6935,8 @@ var Formatter = /** @__PURE__ @class */ (function () {
6909
6935
  }
6910
6936
  else {
6911
6937
  _this.editorManager.observer.notify(checkUndo, { subCommand: actionBeginArgs.item.subCommand });
6912
- _this.editorManager.execCommand(actionBeginArgs.item.command, actionBeginArgs.item.subCommand, event, _this.onSuccess.bind(_this, self), actionBeginArgs.item.value, actionBeginArgs.item.subCommand === 'Pre' && args.name === 'dropDownSelect' ?
6913
- { name: args.name } : value, ('#' + self.getID() + ' iframe'), self.enterKey);
6938
+ _this.editorManager.execCommand(actionBeginArgs.item.command, actionBeginArgs.item.subCommand, event, _this.onSuccess.bind(_this, self), actionBeginArgs.item.value, actionBeginArgs.item.subCommand === 'Pre' && actionBeginArgs.selectType === 'dropDownSelect' ?
6939
+ { name: actionBeginArgs.selectType } : value, ('#' + self.getID() + ' iframe'), self.enterKey);
6914
6940
  }
6915
6941
  }
6916
6942
  });
@@ -9410,7 +9436,8 @@ var NodeSelection = /** @__PURE__ @class */ (function () {
9410
9436
  || range.startContainer;
9411
9437
  var endNode = range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) : range.endOffset]
9412
9438
  || range.endContainer;
9413
- if (startNode === endNode && startNode.childNodes.length === 0) {
9439
+ if ((startNode === endNode || (startNode.nodeName === 'BR' && startNode === range.endContainer.childNodes[range.endOffset])) &&
9440
+ startNode.childNodes.length === 0) {
9414
9441
  return [startNode];
9415
9442
  }
9416
9443
  if (range.startOffset === range.endOffset && range.startOffset !== 0 && range.startContainer.nodeName === 'PRE') {
@@ -12274,7 +12301,15 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
12274
12301
  tempSpan.parentNode.replaceChild(node, tempSpan);
12275
12302
  }
12276
12303
  else {
12277
- var splitedElm = nodeCutter.GetSpliceNode(range, blockNode);
12304
+ var currentNode = nodes[nodes.length - 1];
12305
+ var splitedElm = void 0;
12306
+ if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR') && !isNullOrUndefined(currentNode.parentElement) &&
12307
+ currentNode.parentElement.textContent.trim().length === 0 && !node.classList.contains('pasteContent')) {
12308
+ splitedElm = currentNode;
12309
+ }
12310
+ else {
12311
+ splitedElm = nodeCutter.GetSpliceNode(range, blockNode);
12312
+ }
12278
12313
  splitedElm.parentNode.replaceChild(node, splitedElm);
12279
12314
  }
12280
12315
  }
@@ -17267,7 +17302,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
17267
17302
  e.args.action === 'enter' ||
17268
17303
  e.args.keyCode === 13) {
17269
17304
  this.spaceLink(e.args);
17270
- if (this.parent.editorMode === 'HTML' && !((this.parent.shiftEnterKey === 'BR' && e.args.shiftKey))) {
17305
+ if (this.parent.editorMode === 'HTML') {
17271
17306
  this.parent.notify(enterHandler, { args: e.args });
17272
17307
  }
17273
17308
  }
@@ -17544,7 +17579,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
17544
17579
  var divElement = this.parent.createElement('div');
17545
17580
  divElement.setAttribute('class', 'pasteContent');
17546
17581
  divElement.style.display = 'inline';
17547
- divElement.innerHTML = contentInnerElem;
17582
+ divElement.innerHTML = contentInnerElem.replace('&para', '&amp;para');
17548
17583
  var paraElem = divElement.querySelectorAll('span, p');
17549
17584
  for (var i = 0; i < paraElem.length; i++) {
17550
17585
  var splitTextContent = paraElem[i].innerHTML.split(' ');
@@ -20188,10 +20223,14 @@ var Image = /** @__PURE__ @class */ (function () {
20188
20223
  img.style.height = expectedY + 'px';
20189
20224
  }
20190
20225
  else if (img.style.width !== '' && img.style.height === '') {
20191
- img.style.width = ((width / height * expectedY) + width / height).toString() + 'px';
20226
+ var currentWidth = ((width / height * expectedY) + width / height) < (this.parent.inputElement.getBoundingClientRect().right - 32) ?
20227
+ ((width / height * expectedY) + width / height) : (this.parent.inputElement.getBoundingClientRect().right - 32);
20228
+ img.style.width = currentWidth.toString() + 'px';
20192
20229
  }
20193
20230
  else if (img.style.width !== '') {
20194
- img.style.width = (width / height * expectedY) + 'px';
20231
+ var currentWidth = (width / height * expectedY) < (this.parent.inputElement.getBoundingClientRect().right - 32) ?
20232
+ (width / height * expectedY) : (this.parent.inputElement.getBoundingClientRect().right - 32);
20233
+ img.style.width = currentWidth + 'px';
20195
20234
  img.style.height = expectedY + 'px';
20196
20235
  }
20197
20236
  else {
@@ -20300,7 +20339,7 @@ var Image = /** @__PURE__ @class */ (function () {
20300
20339
  };
20301
20340
  Image.prototype.resizeImgDupPos = function (e) {
20302
20341
  this.imgDupPos = {
20303
- width: (e.style.height !== '') ? this.imgEle.style.width : e.width + 'px',
20342
+ width: (e.style.width !== '') ? this.imgEle.style.width : e.width + 'px',
20304
20343
  height: (e.style.height !== '') ? this.imgEle.style.height : e.height + 'px'
20305
20344
  };
20306
20345
  };
@@ -20468,6 +20507,27 @@ var Image = /** @__PURE__ @class */ (function () {
20468
20507
  var src = this.deletedImg[i].src;
20469
20508
  this.imageRemovePost(src);
20470
20509
  }
20510
+ if (range.startContainer.nodeType === 3) {
20511
+ if (originalEvent.code === 'Backspace') {
20512
+ if (range.startContainer.previousElementSibling && range.startOffset === 0 &&
20513
+ range.startContainer.previousElementSibling.classList.contains(CLS_CAPTION) &&
20514
+ range.startContainer.previousElementSibling.classList.contains(CLS_CAPINLINE)) {
20515
+ detach(range.startContainer.previousElementSibling);
20516
+ }
20517
+ }
20518
+ else {
20519
+ if (range.startContainer.nextElementSibling &&
20520
+ range.endContainer.textContent.length === range.endOffset &&
20521
+ range.startContainer.nextElementSibling.classList.contains(CLS_CAPTION) &&
20522
+ range.startContainer.nextElementSibling.classList.contains(CLS_CAPINLINE)) {
20523
+ detach(range.startContainer.nextElementSibling);
20524
+ }
20525
+ }
20526
+ }
20527
+ else if ((range.startContainer.nodeType === 1 &&
20528
+ range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE))) {
20529
+ detach(range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE));
20530
+ }
20471
20531
  break;
20472
20532
  case 'insert-image':
20473
20533
  this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
@@ -20673,7 +20733,7 @@ var Image = /** @__PURE__ @class */ (function () {
20673
20733
  var target = args.target;
20674
20734
  this.contentModule = this.rendererFactory.getRenderer(RenderType.Content);
20675
20735
  var isPopupOpen = this.quickToolObj.imageQTBar.element.classList.contains('e-rte-pop');
20676
- if (target.nodeName === 'IMG' && this.parent.quickToolbarModule && this.parent.getRange().startOffset === this.parent.getRange().endOffset) {
20736
+ if (target.nodeName === 'IMG' && this.parent.quickToolbarModule) {
20677
20737
  if (isPopupOpen) {
20678
20738
  return;
20679
20739
  }
@@ -20914,6 +20974,9 @@ var Image = /** @__PURE__ @class */ (function () {
20914
20974
  Image.prototype.imageRemovePost = function (src) {
20915
20975
  var proxy = this;
20916
20976
  var absoluteUrl = '';
20977
+ if (isNullOrUndefined(this.parent.insertImageSettings.removeUrl) || this.parent.insertImageSettings.removeUrl === '') {
20978
+ return;
20979
+ }
20917
20980
  if (src.indexOf('http://') > -1 || src.indexOf('https://') > -1) {
20918
20981
  absoluteUrl = src;
20919
20982
  }
@@ -21758,6 +21821,7 @@ var Image = /** @__PURE__ @class */ (function () {
21758
21821
  imageTag.addEventListener('load', function () {
21759
21822
  _this.parent.trigger(actionComplete, e);
21760
21823
  });
21824
+ detach(parentElement);
21761
21825
  };
21762
21826
  /**
21763
21827
  * Rendering uploader and popup for drag and drop
@@ -21793,6 +21857,9 @@ var Image = /** @__PURE__ @class */ (function () {
21793
21857
  _this.popupObj.destroy();
21794
21858
  detach(_this.popupObj.element);
21795
21859
  _this.popupObj = null;
21860
+ if (!_this.parent.inlineMode.enable) {
21861
+ _this.parent.toolbarModule.baseToolbar.toolbarObj.disable(false);
21862
+ }
21796
21863
  }
21797
21864
  });
21798
21865
  this.popupObj.element.style.display = 'none';
@@ -21824,6 +21891,10 @@ var Image = /** @__PURE__ @class */ (function () {
21824
21891
  isUploading = false;
21825
21892
  detach(imageElement);
21826
21893
  _this.popupObj.close();
21894
+ _this.quickToolObj.imageQTBar.hidePopup();
21895
+ setTimeout(function () {
21896
+ _this.uploadObj.destroy();
21897
+ }, 900);
21827
21898
  },
21828
21899
  beforeUpload: function (args) {
21829
21900
  if (_this.parent.isServerRendered) {
@@ -21835,6 +21906,9 @@ var Image = /** @__PURE__ @class */ (function () {
21835
21906
  if (beforeUploadArgs.cancel) {
21836
21907
  return;
21837
21908
  }
21909
+ if (!_this.parent.inlineMode.enable) {
21910
+ _this.parent.toolbarModule.baseToolbar.toolbarObj.disable(true);
21911
+ }
21838
21912
  /* eslint-disable */
21839
21913
  _this.uploadObj.currentRequestHeader = beforeUploadArgs.currentRequest ?
21840
21914
  beforeUploadArgs.currentRequest : _this.uploadObj.currentRequestHeader;
@@ -21847,6 +21921,9 @@ var Image = /** @__PURE__ @class */ (function () {
21847
21921
  }
21848
21922
  else {
21849
21923
  _this.parent.trigger(beforeImageUpload, args);
21924
+ if (!_this.parent.inlineMode.enable) {
21925
+ _this.parent.toolbarModule.baseToolbar.toolbarObj.disable(true);
21926
+ }
21850
21927
  }
21851
21928
  },
21852
21929
  uploading: function (e) {
@@ -21889,6 +21966,9 @@ var Image = /** @__PURE__ @class */ (function () {
21889
21966
  }, 900);
21890
21967
  },
21891
21968
  success: function (e) {
21969
+ if (e.operation === "cancel") {
21970
+ return;
21971
+ }
21892
21972
  isUploading = false;
21893
21973
  _this.parent.inputElement.contentEditable = 'true';
21894
21974
  var args = {
@@ -24320,12 +24400,13 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24320
24400
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.range.startContainer.childNodes[_this.range.startOffset], 0);
24321
24401
  _this.getRangeNode();
24322
24402
  }
24323
- if (_this.parent.enterKey === 'P' || _this.parent.enterKey === 'DIV' ||
24403
+ if ((_this.parent.enterKey === 'P' && !shiftKey_1) || (_this.parent.enterKey === 'DIV' && !shiftKey_1) ||
24324
24404
  (_this.parent.shiftEnterKey === 'P' && shiftKey_1) ||
24325
24405
  (_this.parent.shiftEnterKey === 'DIV' && shiftKey_1)) {
24326
24406
  var nearBlockNode = _this.parent.formatter.editorManager.domNode.blockParentNode(_this.startNode);
24327
24407
  var isImageNode = false;
24328
- if (_this.range.startOffset === 0 && _this.range.endOffset === 0 && !(!isNullOrUndefined(_this.range.startContainer.previousSibling) && _this.range.startContainer.previousSibling.nodeName === 'IMG')) {
24408
+ if (_this.range.startOffset === 0 && _this.range.endOffset === 0 && !(!isNullOrUndefined(_this.range.startContainer.previousSibling) &&
24409
+ (_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
24329
24410
  var isNearBlockLengthZero = void 0;
24330
24411
  var newElem = void 0;
24331
24412
  if (_this.range.startContainer.nodeName === 'IMG') {
@@ -24360,6 +24441,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24360
24441
  detach(nearBlockNode);
24361
24442
  }
24362
24443
  }
24444
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), insertElem.nextElementSibling, 0);
24363
24445
  }
24364
24446
  else if (nearBlockNode.textContent.length === 0 && !(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG')) {
24365
24447
  if (!isNullOrUndefined(nearBlockNode.children[0]) && nearBlockNode.children[0].tagName !== 'BR') {
@@ -24398,7 +24480,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24398
24480
  }
24399
24481
  e.args.preventDefault();
24400
24482
  }
24401
- if (_this.parent.enterKey === 'BR' && !shiftKey_1) {
24483
+ if ((_this.parent.enterKey === 'BR' && !shiftKey_1) || (_this.parent.shiftEnterKey === 'BR' && shiftKey_1)) {
24402
24484
  var currentParent = void 0;
24403
24485
  if (!_this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode)) {
24404
24486
  var currentNode = _this.startNode;
@@ -24413,11 +24495,16 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24413
24495
  else {
24414
24496
  currentParent = _this.startNode;
24415
24497
  }
24416
- var isEmptyBrInserted = false;
24498
+ var currentParentLastChild = currentParent.lastChild;
24499
+ while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text')) {
24500
+ currentParentLastChild = currentParentLastChild.lastChild;
24501
+ }
24502
+ var isLastNodeLength = _this.range.startContainer === currentParentLastChild ?
24503
+ _this.range.startContainer.textContent.length : currentParent.textContent.length;
24417
24504
  if (currentParent !== _this.parent.inputElement &&
24418
24505
  _this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
24419
24506
  _this.range.startOffset === _this.range.endOffset &&
24420
- _this.range.startOffset === currentParent.textContent.length) {
24507
+ _this.range.startOffset === isLastNodeLength) {
24421
24508
  var outerBRElem = _this.parent.createElement('br');
24422
24509
  _this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
24423
24510
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), outerBRElem, 0);
@@ -24444,37 +24531,15 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24444
24531
  currentFocusElem = currentFocusElem.lastChild;
24445
24532
  }
24446
24533
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), currentFocusElem, 0);
24447
- isEmptyBrInserted = true;
24534
+
24448
24535
  }
24449
24536
  else {
24450
- newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, currentParent, true);
24451
- newElem.parentElement.insertBefore(outerBRElem, newElem);
24452
- _this.insertFocusContent();
24537
+ _this.insertBRElement();
24453
24538
  }
24454
24539
  }
24455
24540
  }
24456
24541
  else {
24457
- var brElm = _this.parent.createElement('br');
24458
- if (_this.startNode.nodeName === 'BR' && _this.endNode.nodeName === 'BR' && _this.range.startOffset === 0 && _this.range.startOffset === _this.range.endOffset) {
24459
- _this.parent.formatter.editorManager.domNode.insertAfter(brElm, _this.startNode);
24460
- isEmptyBrInserted = true;
24461
- }
24462
- else {
24463
- if (_this.startNode === _this.parent.inputElement && !isNullOrUndefined(_this.range.startContainer.previousSibling) &&
24464
- _this.range.startContainer.previousSibling.nodeName === 'BR' && _this.range.startContainer.textContent.length === 0) {
24465
- isEmptyBrInserted = true;
24466
- }
24467
- _this.range.insertNode(brElm);
24468
- }
24469
- if (isEmptyBrInserted || (!isNullOrUndefined(brElm.nextElementSibling) && brElm.nextElementSibling.tagName === 'BR') || (!isNullOrUndefined(brElm.nextSibling) && brElm.nextSibling.textContent.length > 0)) {
24470
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), !isNullOrUndefined(brElm.nextSibling) ? brElm.nextSibling : brElm, 0);
24471
- isEmptyBrInserted = false;
24472
- }
24473
- else {
24474
- var brElm2 = _this.parent.createElement('br');
24475
- _this.range.insertNode(brElm2);
24476
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), brElm, 0);
24477
- }
24542
+ _this.insertBRElement();
24478
24543
  }
24479
24544
  e.args.preventDefault();
24480
24545
  }
@@ -24484,6 +24549,30 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24484
24549
  }
24485
24550
  }
24486
24551
  };
24552
+ EnterKeyAction.prototype.insertBRElement = function () {
24553
+ var isEmptyBrInserted = false;
24554
+ var brElm = this.parent.createElement('br');
24555
+ if (this.startNode.nodeName === 'BR' && this.endNode.nodeName === 'BR' && this.range.startOffset === 0 && this.range.startOffset === this.range.endOffset) {
24556
+ this.parent.formatter.editorManager.domNode.insertAfter(brElm, this.startNode);
24557
+ isEmptyBrInserted = true;
24558
+ }
24559
+ else {
24560
+ if (this.startNode === this.parent.inputElement && !isNullOrUndefined(this.range.startContainer.previousSibling) &&
24561
+ this.range.startContainer.previousSibling.nodeName === 'BR' && this.range.startContainer.textContent.length === 0) {
24562
+ isEmptyBrInserted = true;
24563
+ }
24564
+ this.range.insertNode(brElm);
24565
+ }
24566
+ if (isEmptyBrInserted || (!isNullOrUndefined(brElm.nextElementSibling) && brElm.nextElementSibling.tagName === 'BR') || (!isNullOrUndefined(brElm.nextSibling) && brElm.nextSibling.textContent.length > 0)) {
24567
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), !isNullOrUndefined(brElm.nextSibling) ? brElm.nextSibling : brElm, 0);
24568
+ isEmptyBrInserted = false;
24569
+ }
24570
+ else {
24571
+ var brElm2 = this.parent.createElement('br');
24572
+ this.range.insertNode(brElm2);
24573
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), brElm, 0);
24574
+ }
24575
+ };
24487
24576
  EnterKeyAction.prototype.insertFocusContent = function () {
24488
24577
  if (this.range.startContainer.textContent.length === 0) {
24489
24578
  if (this.range.startContainer.nodeName === '#text') {
@@ -25911,8 +26000,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
25911
26000
  this.setProperties({ value: this.valueTemplate });
25912
26001
  }
25913
26002
  else {
25914
- var compiledString = compile(this.valueTemplate);
25915
- var compiledTemplate = compiledString({});
26003
+ var compiledTemplate = compile(this.valueTemplate)('', this, 'valueTemplate');
25916
26004
  for (var i = 0; i < compiledTemplate.length; i++) {
25917
26005
  var item = compiledTemplate[i];
25918
26006
  append([item], this.element);