@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
@@ -2739,7 +2739,8 @@ class ToolbarRenderer {
2739
2739
  this.parent.notify(beforeDropDownItemRender, args);
2740
2740
  }
2741
2741
  dropDownOpen(args) {
2742
- if (args.element.parentElement.getAttribute('id').indexOf('TableCell') > -1) {
2742
+ if (args.element.parentElement.getAttribute('id').indexOf('TableCell') > -1 && !isNullOrUndefined(args.element.parentElement.querySelector('.e-cell-merge')) &&
2743
+ (!isNullOrUndefined(args.element.parentElement.querySelector('.e-cell-horizontal-split')) || !isNullOrUndefined(args.element.parentElement.querySelector('.e-cell-vertical-split')))) {
2743
2744
  const listEle = args.element.querySelectorAll('li');
2744
2745
  if (this.parent.inputElement.querySelectorAll('.e-cell-select').length === 1) {
2745
2746
  addClass([listEle[0]], 'e-disabled');
@@ -3591,6 +3592,11 @@ class DropDownButtons {
3591
3592
  for (const prop of Object.keys(newProp)) {
3592
3593
  switch (prop) {
3593
3594
  case 'fontFamily':
3595
+ if (this.parent.inlineMode.enable) {
3596
+ if (!isNullOrUndefined(this.parent.fontFamily.default)) {
3597
+ this.getEditNode().style.fontFamily = this.parent.fontFamily.default;
3598
+ }
3599
+ }
3594
3600
  if (this.fontNameDropDown) {
3595
3601
  for (const fontFamily$$1 of Object.keys(newProp.fontFamily)) {
3596
3602
  switch (fontFamily$$1) {
@@ -3621,6 +3627,11 @@ class DropDownButtons {
3621
3627
  }
3622
3628
  break;
3623
3629
  case 'fontSize':
3630
+ if (this.parent.inlineMode) {
3631
+ if (!isNullOrUndefined(this.parent.fontSize.default)) {
3632
+ this.getEditNode().style.fontSize = this.parent.fontSize.default;
3633
+ }
3634
+ }
3624
3635
  if (this.fontSizeDropDown) {
3625
3636
  for (const fontSize$$1 of Object.keys(newProp.fontSize)) {
3626
3637
  switch (fontSize$$1) {
@@ -5649,6 +5660,11 @@ class QuickToolbar {
5649
5660
  this.parent.isBlur = false;
5650
5661
  this.parent.isRTE = true;
5651
5662
  }
5663
+ keyUpQT(e) {
5664
+ if (e.which == 27) {
5665
+ this.hideQuickToolbars();
5666
+ }
5667
+ }
5652
5668
  renderQuickToolbars() {
5653
5669
  if (this.linkQTBar || this.imageQTBar || this.textQTBar || this.tableQTBar) {
5654
5670
  return;
@@ -5663,15 +5679,19 @@ class QuickToolbar {
5663
5679
  this.renderFactory.addRenderer(RenderType.TableToolbar, this.tableQTBar);
5664
5680
  if (this.linkQTBar) {
5665
5681
  EventHandler.add(this.linkQTBar.element, 'mousedown', this.onMouseDown, this);
5682
+ EventHandler.add(this.linkQTBar.element, 'keyup', this.keyUpQT, this);
5666
5683
  }
5667
5684
  if (this.imageQTBar) {
5668
5685
  EventHandler.add(this.imageQTBar.element, 'mousedown', this.onMouseDown, this);
5686
+ EventHandler.add(this.imageQTBar.element, 'keyup', this.keyUpQT, this);
5669
5687
  }
5670
5688
  if (this.textQTBar) {
5671
5689
  EventHandler.add(this.textQTBar.element, 'mousedown', this.onMouseDown, this);
5690
+ EventHandler.add(this.textQTBar.element, 'keyup', this.keyUpQT, this);
5672
5691
  }
5673
5692
  if (this.tableQTBar) {
5674
5693
  EventHandler.add(this.tableQTBar.element, 'mousedown', this.onMouseDown, this);
5694
+ EventHandler.add(this.tableQTBar.element, 'keyup', this.keyUpQT, this);
5675
5695
  }
5676
5696
  }
5677
5697
  renderInlineQuickToolbar() {
@@ -5680,6 +5700,7 @@ class QuickToolbar {
5680
5700
  this.inlineQTBar = this.createQTBar('Inline', 'MultiRow', this.parent.toolbarSettings.items, RenderType.InlineToolbar);
5681
5701
  this.renderFactory.addRenderer(RenderType.InlineToolbar, this.inlineQTBar);
5682
5702
  EventHandler.add(this.inlineQTBar.element, 'mousedown', this.onMouseDown, this);
5703
+ EventHandler.add(this.inlineQTBar.element, 'keyup', this.keyUpQT, this);
5683
5704
  }
5684
5705
  }
5685
5706
  /**
@@ -5693,7 +5714,7 @@ class QuickToolbar {
5693
5714
  * @deprecated
5694
5715
  */
5695
5716
  showInlineQTBar(x, y, target) {
5696
- if (this.parent.readonly) {
5717
+ if (this.parent.readonly || target.tagName.toLowerCase() === "img") {
5697
5718
  return;
5698
5719
  }
5699
5720
  this.inlineQTBar.showPopup(x, y, target);
@@ -5832,22 +5853,27 @@ class QuickToolbar {
5832
5853
  destroy() {
5833
5854
  if (this.linkQTBar) {
5834
5855
  EventHandler.remove(this.linkQTBar.element, 'mousedown', this.onMouseDown);
5856
+ EventHandler.remove(this.linkQTBar.element, 'keyup', this.keyUpQT);
5835
5857
  this.linkQTBar.destroy();
5836
5858
  }
5837
5859
  if (this.textQTBar) {
5838
5860
  EventHandler.remove(this.textQTBar.element, 'mousedown', this.onMouseDown);
5861
+ EventHandler.remove(this.textQTBar.element, 'keyup', this.keyUpQT);
5839
5862
  this.textQTBar.destroy();
5840
5863
  }
5841
5864
  if (this.imageQTBar) {
5842
5865
  EventHandler.remove(this.imageQTBar.element, 'mousedown', this.onMouseDown);
5866
+ EventHandler.remove(this.imageQTBar.element, 'keyup', this.keyUpQT);
5843
5867
  this.imageQTBar.destroy();
5844
5868
  }
5845
5869
  if (this.tableQTBar) {
5846
5870
  EventHandler.remove(this.tableQTBar.element, 'mousedown', this.onMouseDown);
5871
+ EventHandler.remove(this.tableQTBar.element, 'keyup', this.keyUpQT);
5847
5872
  this.tableQTBar.destroy();
5848
5873
  }
5849
5874
  if (this.inlineQTBar) {
5850
5875
  EventHandler.remove(this.inlineQTBar.element, 'mousedown', this.onMouseDown);
5876
+ EventHandler.remove(this.inlineQTBar.element, 'keyup', this.keyUpQT);
5851
5877
  if (isIDevice()) {
5852
5878
  EventHandler.remove(document, 'selectionchange', this.selectionChangeHandler);
5853
5879
  }
@@ -6827,7 +6853,7 @@ class Formatter {
6827
6853
  || ((args.item.subCommand === 'FontName' || args.item.subCommand === 'FontSize') && args.name === 'dropDownSelect')
6828
6854
  || ((args.item.subCommand === 'BackgroundColor' || args.item.subCommand === 'FontColor')
6829
6855
  && args.name === 'colorPickerChanged'))) {
6830
- extend(args, args, { requestType: args.item.subCommand, cancel: false, itemCollection: value }, true);
6856
+ extend(args, args, { requestType: args.item.subCommand, cancel: false, itemCollection: value, selectType: args.name }, true);
6831
6857
  self.trigger(actionBegin, args, (actionBeginArgs) => {
6832
6858
  if (!actionBeginArgs.cancel) {
6833
6859
  if (this.getUndoRedoStack().length === 0 && actionBeginArgs.item.command !== 'Links'
@@ -6845,8 +6871,8 @@ class Formatter {
6845
6871
  }
6846
6872
  else {
6847
6873
  this.editorManager.observer.notify(checkUndo, { subCommand: actionBeginArgs.item.subCommand });
6848
- 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' ?
6849
- { name: args.name } : value, ('#' + self.getID() + ' iframe'), self.enterKey);
6874
+ 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' ?
6875
+ { name: actionBeginArgs.selectType } : value, ('#' + self.getID() + ' iframe'), self.enterKey);
6850
6876
  }
6851
6877
  }
6852
6878
  });
@@ -9317,7 +9343,8 @@ class NodeSelection {
9317
9343
  || range.startContainer;
9318
9344
  const endNode = range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) : range.endOffset]
9319
9345
  || range.endContainer;
9320
- if (startNode === endNode && startNode.childNodes.length === 0) {
9346
+ if ((startNode === endNode || (startNode.nodeName === 'BR' && startNode === range.endContainer.childNodes[range.endOffset])) &&
9347
+ startNode.childNodes.length === 0) {
9321
9348
  return [startNode];
9322
9349
  }
9323
9350
  if (range.startOffset === range.endOffset && range.startOffset !== 0 && range.startContainer.nodeName === 'PRE') {
@@ -12171,7 +12198,15 @@ class InsertHtml {
12171
12198
  tempSpan.parentNode.replaceChild(node, tempSpan);
12172
12199
  }
12173
12200
  else {
12174
- const splitedElm = nodeCutter.GetSpliceNode(range, blockNode);
12201
+ let currentNode = nodes[nodes.length - 1];
12202
+ let splitedElm;
12203
+ if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR') && !isNullOrUndefined(currentNode.parentElement) &&
12204
+ currentNode.parentElement.textContent.trim().length === 0 && !node.classList.contains('pasteContent')) {
12205
+ splitedElm = currentNode;
12206
+ }
12207
+ else {
12208
+ splitedElm = nodeCutter.GetSpliceNode(range, blockNode);
12209
+ }
12175
12210
  splitedElm.parentNode.replaceChild(node, splitedElm);
12176
12211
  }
12177
12212
  }
@@ -17188,7 +17223,7 @@ class HtmlEditor {
17188
17223
  e.args.action === 'enter' ||
17189
17224
  e.args.keyCode === 13) {
17190
17225
  this.spaceLink(e.args);
17191
- if (this.parent.editorMode === 'HTML' && !((this.parent.shiftEnterKey === 'BR' && e.args.shiftKey))) {
17226
+ if (this.parent.editorMode === 'HTML') {
17192
17227
  this.parent.notify(enterHandler, { args: e.args });
17193
17228
  }
17194
17229
  }
@@ -17465,7 +17500,7 @@ class HtmlEditor {
17465
17500
  const divElement = this.parent.createElement('div');
17466
17501
  divElement.setAttribute('class', 'pasteContent');
17467
17502
  divElement.style.display = 'inline';
17468
- divElement.innerHTML = contentInnerElem;
17503
+ divElement.innerHTML = contentInnerElem.replace('&para', '&para');
17469
17504
  const paraElem = divElement.querySelectorAll('span, p');
17470
17505
  for (let i = 0; i < paraElem.length; i++) {
17471
17506
  const splitTextContent = paraElem[i].innerHTML.split(' ');
@@ -20089,10 +20124,14 @@ class Image {
20089
20124
  img.style.height = expectedY + 'px';
20090
20125
  }
20091
20126
  else if (img.style.width !== '' && img.style.height === '') {
20092
- img.style.width = ((width / height * expectedY) + width / height).toString() + 'px';
20127
+ let currentWidth = ((width / height * expectedY) + width / height) < (this.parent.inputElement.getBoundingClientRect().right - 32) ?
20128
+ ((width / height * expectedY) + width / height) : (this.parent.inputElement.getBoundingClientRect().right - 32);
20129
+ img.style.width = currentWidth.toString() + 'px';
20093
20130
  }
20094
20131
  else if (img.style.width !== '') {
20095
- img.style.width = (width / height * expectedY) + 'px';
20132
+ let currentWidth = (width / height * expectedY) < (this.parent.inputElement.getBoundingClientRect().right - 32) ?
20133
+ (width / height * expectedY) : (this.parent.inputElement.getBoundingClientRect().right - 32);
20134
+ img.style.width = currentWidth + 'px';
20096
20135
  img.style.height = expectedY + 'px';
20097
20136
  }
20098
20137
  else {
@@ -20200,7 +20239,7 @@ class Image {
20200
20239
  }
20201
20240
  resizeImgDupPos(e) {
20202
20241
  this.imgDupPos = {
20203
- width: (e.style.height !== '') ? this.imgEle.style.width : e.width + 'px',
20242
+ width: (e.style.width !== '') ? this.imgEle.style.width : e.width + 'px',
20204
20243
  height: (e.style.height !== '') ? this.imgEle.style.height : e.height + 'px'
20205
20244
  };
20206
20245
  }
@@ -20368,6 +20407,27 @@ class Image {
20368
20407
  const src = this.deletedImg[i].src;
20369
20408
  this.imageRemovePost(src);
20370
20409
  }
20410
+ if (range.startContainer.nodeType === 3) {
20411
+ if (originalEvent.code === 'Backspace') {
20412
+ if (range.startContainer.previousElementSibling && range.startOffset === 0 &&
20413
+ range.startContainer.previousElementSibling.classList.contains(CLS_CAPTION) &&
20414
+ range.startContainer.previousElementSibling.classList.contains(CLS_CAPINLINE)) {
20415
+ detach(range.startContainer.previousElementSibling);
20416
+ }
20417
+ }
20418
+ else {
20419
+ if (range.startContainer.nextElementSibling &&
20420
+ range.endContainer.textContent.length === range.endOffset &&
20421
+ range.startContainer.nextElementSibling.classList.contains(CLS_CAPTION) &&
20422
+ range.startContainer.nextElementSibling.classList.contains(CLS_CAPINLINE)) {
20423
+ detach(range.startContainer.nextElementSibling);
20424
+ }
20425
+ }
20426
+ }
20427
+ else if ((range.startContainer.nodeType === 1 &&
20428
+ range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE))) {
20429
+ detach(range.startContainer.querySelector('.' + CLS_CAPTION + '.' + CLS_CAPINLINE));
20430
+ }
20371
20431
  break;
20372
20432
  case 'insert-image':
20373
20433
  this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
@@ -20572,7 +20632,7 @@ class Image {
20572
20632
  const target = args.target;
20573
20633
  this.contentModule = this.rendererFactory.getRenderer(RenderType.Content);
20574
20634
  const isPopupOpen = this.quickToolObj.imageQTBar.element.classList.contains('e-rte-pop');
20575
- if (target.nodeName === 'IMG' && this.parent.quickToolbarModule && this.parent.getRange().startOffset === this.parent.getRange().endOffset) {
20635
+ if (target.nodeName === 'IMG' && this.parent.quickToolbarModule) {
20576
20636
  if (isPopupOpen) {
20577
20637
  return;
20578
20638
  }
@@ -20811,6 +20871,9 @@ class Image {
20811
20871
  imageRemovePost(src) {
20812
20872
  const proxy = this;
20813
20873
  let absoluteUrl = '';
20874
+ if (isNullOrUndefined(this.parent.insertImageSettings.removeUrl) || this.parent.insertImageSettings.removeUrl === '') {
20875
+ return;
20876
+ }
20814
20877
  if (src.indexOf('http://') > -1 || src.indexOf('https://') > -1) {
20815
20878
  absoluteUrl = src;
20816
20879
  }
@@ -21647,6 +21710,7 @@ class Image {
21647
21710
  imageTag.addEventListener('load', () => {
21648
21711
  this.parent.trigger(actionComplete, e);
21649
21712
  });
21713
+ detach(parentElement);
21650
21714
  }
21651
21715
  /**
21652
21716
  * Rendering uploader and popup for drag and drop
@@ -21681,6 +21745,9 @@ class Image {
21681
21745
  this.popupObj.destroy();
21682
21746
  detach(this.popupObj.element);
21683
21747
  this.popupObj = null;
21748
+ if (!this.parent.inlineMode.enable) {
21749
+ this.parent.toolbarModule.baseToolbar.toolbarObj.disable(false);
21750
+ }
21684
21751
  }
21685
21752
  });
21686
21753
  this.popupObj.element.style.display = 'none';
@@ -21712,6 +21779,10 @@ class Image {
21712
21779
  isUploading = false;
21713
21780
  detach(imageElement);
21714
21781
  this.popupObj.close();
21782
+ this.quickToolObj.imageQTBar.hidePopup();
21783
+ setTimeout(() => {
21784
+ this.uploadObj.destroy();
21785
+ }, 900);
21715
21786
  },
21716
21787
  beforeUpload: (args) => {
21717
21788
  if (this.parent.isServerRendered) {
@@ -21723,6 +21794,9 @@ class Image {
21723
21794
  if (beforeUploadArgs.cancel) {
21724
21795
  return;
21725
21796
  }
21797
+ if (!this.parent.inlineMode.enable) {
21798
+ this.parent.toolbarModule.baseToolbar.toolbarObj.disable(true);
21799
+ }
21726
21800
  /* eslint-disable */
21727
21801
  this.uploadObj.currentRequestHeader = beforeUploadArgs.currentRequest ?
21728
21802
  beforeUploadArgs.currentRequest : this.uploadObj.currentRequestHeader;
@@ -21735,6 +21809,9 @@ class Image {
21735
21809
  }
21736
21810
  else {
21737
21811
  this.parent.trigger(beforeImageUpload, args);
21812
+ if (!this.parent.inlineMode.enable) {
21813
+ this.parent.toolbarModule.baseToolbar.toolbarObj.disable(true);
21814
+ }
21738
21815
  }
21739
21816
  },
21740
21817
  uploading: (e) => {
@@ -21777,6 +21854,9 @@ class Image {
21777
21854
  }, 900);
21778
21855
  },
21779
21856
  success: (e) => {
21857
+ if (e.operation === "cancel") {
21858
+ return;
21859
+ }
21780
21860
  isUploading = false;
21781
21861
  this.parent.inputElement.contentEditable = 'true';
21782
21862
  const args = {
@@ -24076,12 +24156,13 @@ class EnterKeyAction {
24076
24156
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), this.range.startContainer.childNodes[this.range.startOffset], 0);
24077
24157
  this.getRangeNode();
24078
24158
  }
24079
- if (this.parent.enterKey === 'P' || this.parent.enterKey === 'DIV' ||
24159
+ if ((this.parent.enterKey === 'P' && !shiftKey) || (this.parent.enterKey === 'DIV' && !shiftKey) ||
24080
24160
  (this.parent.shiftEnterKey === 'P' && shiftKey) ||
24081
24161
  (this.parent.shiftEnterKey === 'DIV' && shiftKey)) {
24082
24162
  const nearBlockNode = this.parent.formatter.editorManager.domNode.blockParentNode(this.startNode);
24083
24163
  let isImageNode = false;
24084
- if (this.range.startOffset === 0 && this.range.endOffset === 0 && !(!isNullOrUndefined(this.range.startContainer.previousSibling) && this.range.startContainer.previousSibling.nodeName === 'IMG')) {
24164
+ if (this.range.startOffset === 0 && this.range.endOffset === 0 && !(!isNullOrUndefined(this.range.startContainer.previousSibling) &&
24165
+ (this.range.startContainer.previousSibling.nodeName === 'IMG' || this.range.startContainer.previousSibling.nodeName === 'BR'))) {
24085
24166
  let isNearBlockLengthZero;
24086
24167
  let newElem;
24087
24168
  if (this.range.startContainer.nodeName === 'IMG') {
@@ -24116,6 +24197,7 @@ class EnterKeyAction {
24116
24197
  detach(nearBlockNode);
24117
24198
  }
24118
24199
  }
24200
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), insertElem.nextElementSibling, 0);
24119
24201
  }
24120
24202
  else if (nearBlockNode.textContent.length === 0 && !(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG')) {
24121
24203
  if (!isNullOrUndefined(nearBlockNode.children[0]) && nearBlockNode.children[0].tagName !== 'BR') {
@@ -24154,7 +24236,7 @@ class EnterKeyAction {
24154
24236
  }
24155
24237
  e.args.preventDefault();
24156
24238
  }
24157
- if (this.parent.enterKey === 'BR' && !shiftKey) {
24239
+ if ((this.parent.enterKey === 'BR' && !shiftKey) || (this.parent.shiftEnterKey === 'BR' && shiftKey)) {
24158
24240
  let currentParent;
24159
24241
  if (!this.parent.formatter.editorManager.domNode.isBlockNode(this.startNode)) {
24160
24242
  let currentNode = this.startNode;
@@ -24169,11 +24251,16 @@ class EnterKeyAction {
24169
24251
  else {
24170
24252
  currentParent = this.startNode;
24171
24253
  }
24172
- let isEmptyBrInserted = false;
24254
+ let currentParentLastChild = currentParent.lastChild;
24255
+ while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text')) {
24256
+ currentParentLastChild = currentParentLastChild.lastChild;
24257
+ }
24258
+ const isLastNodeLength = this.range.startContainer === currentParentLastChild ?
24259
+ this.range.startContainer.textContent.length : currentParent.textContent.length;
24173
24260
  if (currentParent !== this.parent.inputElement &&
24174
24261
  this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
24175
24262
  this.range.startOffset === this.range.endOffset &&
24176
- this.range.startOffset === currentParent.textContent.length) {
24263
+ this.range.startOffset === isLastNodeLength) {
24177
24264
  const outerBRElem = this.parent.createElement('br');
24178
24265
  this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
24179
24266
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), outerBRElem, 0);
@@ -24200,37 +24287,15 @@ class EnterKeyAction {
24200
24287
  currentFocusElem = currentFocusElem.lastChild;
24201
24288
  }
24202
24289
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), currentFocusElem, 0);
24203
- isEmptyBrInserted = true;
24290
+
24204
24291
  }
24205
24292
  else {
24206
- newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, currentParent, true);
24207
- newElem.parentElement.insertBefore(outerBRElem, newElem);
24208
- this.insertFocusContent();
24293
+ this.insertBRElement();
24209
24294
  }
24210
24295
  }
24211
24296
  }
24212
24297
  else {
24213
- const brElm = this.parent.createElement('br');
24214
- if (this.startNode.nodeName === 'BR' && this.endNode.nodeName === 'BR' && this.range.startOffset === 0 && this.range.startOffset === this.range.endOffset) {
24215
- this.parent.formatter.editorManager.domNode.insertAfter(brElm, this.startNode);
24216
- isEmptyBrInserted = true;
24217
- }
24218
- else {
24219
- if (this.startNode === this.parent.inputElement && !isNullOrUndefined(this.range.startContainer.previousSibling) &&
24220
- this.range.startContainer.previousSibling.nodeName === 'BR' && this.range.startContainer.textContent.length === 0) {
24221
- isEmptyBrInserted = true;
24222
- }
24223
- this.range.insertNode(brElm);
24224
- }
24225
- if (isEmptyBrInserted || (!isNullOrUndefined(brElm.nextElementSibling) && brElm.nextElementSibling.tagName === 'BR') || (!isNullOrUndefined(brElm.nextSibling) && brElm.nextSibling.textContent.length > 0)) {
24226
- this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), !isNullOrUndefined(brElm.nextSibling) ? brElm.nextSibling : brElm, 0);
24227
- isEmptyBrInserted = false;
24228
- }
24229
- else {
24230
- const brElm2 = this.parent.createElement('br');
24231
- this.range.insertNode(brElm2);
24232
- this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), brElm, 0);
24233
- }
24298
+ this.insertBRElement();
24234
24299
  }
24235
24300
  e.args.preventDefault();
24236
24301
  }
@@ -24240,6 +24305,30 @@ class EnterKeyAction {
24240
24305
  }
24241
24306
  }
24242
24307
  }
24308
+ insertBRElement() {
24309
+ let isEmptyBrInserted = false;
24310
+ const brElm = this.parent.createElement('br');
24311
+ if (this.startNode.nodeName === 'BR' && this.endNode.nodeName === 'BR' && this.range.startOffset === 0 && this.range.startOffset === this.range.endOffset) {
24312
+ this.parent.formatter.editorManager.domNode.insertAfter(brElm, this.startNode);
24313
+ isEmptyBrInserted = true;
24314
+ }
24315
+ else {
24316
+ if (this.startNode === this.parent.inputElement && !isNullOrUndefined(this.range.startContainer.previousSibling) &&
24317
+ this.range.startContainer.previousSibling.nodeName === 'BR' && this.range.startContainer.textContent.length === 0) {
24318
+ isEmptyBrInserted = true;
24319
+ }
24320
+ this.range.insertNode(brElm);
24321
+ }
24322
+ if (isEmptyBrInserted || (!isNullOrUndefined(brElm.nextElementSibling) && brElm.nextElementSibling.tagName === 'BR') || (!isNullOrUndefined(brElm.nextSibling) && brElm.nextSibling.textContent.length > 0)) {
24323
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), !isNullOrUndefined(brElm.nextSibling) ? brElm.nextSibling : brElm, 0);
24324
+ isEmptyBrInserted = false;
24325
+ }
24326
+ else {
24327
+ const brElm2 = this.parent.createElement('br');
24328
+ this.range.insertNode(brElm2);
24329
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), brElm, 0);
24330
+ }
24331
+ }
24243
24332
  insertFocusContent() {
24244
24333
  if (this.range.startContainer.textContent.length === 0) {
24245
24334
  if (this.range.startContainer.nodeName === '#text') {
@@ -25637,8 +25726,7 @@ let RichTextEditor = class RichTextEditor extends Component {
25637
25726
  this.setProperties({ value: this.valueTemplate });
25638
25727
  }
25639
25728
  else {
25640
- const compiledString = compile(this.valueTemplate);
25641
- const compiledTemplate = compiledString({});
25729
+ const compiledTemplate = compile(this.valueTemplate)('', this, 'valueTemplate');
25642
25730
  for (let i = 0; i < compiledTemplate.length; i++) {
25643
25731
  const item = compiledTemplate[i];
25644
25732
  append([item], this.element);