@syncfusion/ej2-richtexteditor 28.1.38 → 28.1.41

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.
@@ -1,4 +1,4 @@
1
- import { isNullOrUndefined, Browser, addClass, removeClass, selectAll as selectAll$1, createElement, detach, SanitizeHtmlHelper, extend, EventHandler, closest, getInstance, formatUnit, select, Ajax, Base, Property, Event as Event$1, NotifyPropertyChanges, ChildProperty, KeyboardEvents as KeyboardEvents$1, setStyleAttribute, getUniqueID, append, debounce, Observer, prepend, attributes, getComponent, getEnumValue, Complex, Component, print, L10n, compile, Touch } from '@syncfusion/ej2-base';
1
+ import { isNullOrUndefined, Browser, addClass, removeClass, selectAll as selectAll$1, createElement, detach, SanitizeHtmlHelper, extend, EventHandler, closest, getInstance, formatUnit, select, Ajax, Base, Property, Event as Event$1, NotifyPropertyChanges, getComponent, ChildProperty, KeyboardEvents as KeyboardEvents$1, setStyleAttribute, getUniqueID, append, debounce, Observer, prepend, attributes, getEnumValue, Complex, Component, print, L10n, compile, Touch } from '@syncfusion/ej2-base';
2
2
  import { Toolbar as Toolbar$1 } from '@syncfusion/ej2-navigations';
3
3
  import { DropDownButton } from '@syncfusion/ej2-splitbuttons';
4
4
  import { Tooltip, Popup, Dialog, isCollide, getScrollableParent } from '@syncfusion/ej2-popups';
@@ -4793,11 +4793,6 @@ class NodeSelection {
4793
4793
  /**
4794
4794
  * Defines common util methods used by Rich Text Editor.
4795
4795
  */
4796
- const inlineNode$1 = ['a', 'abbr', 'acronym', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button',
4797
- 'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'font', 'i', 'iframe', 'img', 'input',
4798
- 'ins', 'kbd', 'label', 'map', 'mark', 'meter', 'noscript', 'object', 'output', 'picture', 'progress',
4799
- 'q', 'ruby', 's', 'samp', 'script', 'select', 'slot', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'svg',
4800
- 'template', 'textarea', 'time', 'u', 'tt', 'var', 'video', 'wbr'];
4801
4796
  /**
4802
4797
  * @returns {void}
4803
4798
  * @hidden
@@ -4825,109 +4820,68 @@ function setEditFrameFocus(editableElement, selector) {
4825
4820
  }
4826
4821
  /**
4827
4822
  * @param {string} value - specifies the string value
4828
- * @param {string} enterAction - specifies the enter key action API
4829
4823
  * @returns {void}
4830
4824
  * @hidden
4831
4825
  */
4832
- function updateTextNode$1(value, enterAction) {
4833
- const tempNode = document.createElement('div');
4834
- tempNode.innerHTML = value;
4835
- tempNode.setAttribute('class', 'tempDiv');
4826
+ function updateTextNode$1(value) {
4836
4827
  const resultElm = document.createElement('div');
4837
- const childNodes = tempNode.childNodes;
4838
- if (childNodes.length > 0) {
4839
- let isPreviousInlineElem;
4840
- let previousParent;
4841
- let paraElm;
4842
- while (tempNode.firstChild) {
4843
- if ((tempNode.firstChild.nodeName === '#text' &&
4844
- (tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
4845
- inlineNode$1.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0) {
4846
- if (!isPreviousInlineElem) {
4847
- if (enterAction === 'BR') {
4848
- resultElm.appendChild(tempNode.firstChild);
4849
- previousParent = resultElm;
4850
- }
4851
- else {
4852
- paraElm = createElement('p');
4853
- resultElm.appendChild(paraElm);
4854
- paraElm.appendChild(tempNode.firstChild);
4855
- previousParent = paraElm;
4856
- isPreviousInlineElem = true;
4857
- }
4858
- }
4859
- else {
4860
- previousParent.appendChild(tempNode.firstChild);
4861
- previousParent = paraElm;
4862
- isPreviousInlineElem = true;
4863
- }
4864
- }
4865
- else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
4866
- (tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
4867
- detach(tempNode.firstChild);
4828
+ resultElm.innerHTML = value;
4829
+ const tableElm = resultElm.querySelectorAll('table');
4830
+ for (let i = 0; i < tableElm.length; i++) {
4831
+ if (tableElm[i].classList.length > 0 &&
4832
+ !tableElm[i].classList.contains('e-rte-table') && !tableElm[i].classList.contains('e-rte-custom-table')) {
4833
+ tableElm[i].classList.add('e-rte-paste-table');
4834
+ if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
4835
+ tableElm[i].classList.remove('e-rte-paste-word-table');
4836
+ continue; // Skiping the removal of the border if the source is from word.
4868
4837
  }
4869
- else {
4870
- resultElm.appendChild(tempNode.firstChild);
4871
- isPreviousInlineElem = false;
4872
- }
4873
- }
4874
- const tableElm = resultElm.querySelectorAll('table');
4875
- for (let i = 0; i < tableElm.length; i++) {
4876
- if (tableElm[i].classList.length > 0 &&
4877
- !tableElm[i].classList.contains('e-rte-table') && !tableElm[i].classList.contains('e-rte-custom-table')) {
4878
- tableElm[i].classList.add('e-rte-paste-table');
4879
- if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
4880
- tableElm[i].classList.remove('e-rte-paste-word-table');
4881
- continue; // Skiping the removal of the border if the source is from word.
4838
+ else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
4839
+ tableElm[i].classList.remove('e-rte-paste-excel-table');
4840
+ if (tableElm[i].getAttribute('border') === '0') {
4841
+ tableElm[i].removeAttribute('border');
4882
4842
  }
4883
- else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
4884
- tableElm[i].classList.remove('e-rte-paste-excel-table');
4885
- if (tableElm[i].getAttribute('border') === '0') {
4886
- tableElm[i].removeAttribute('border');
4843
+ const tdElm = tableElm[i].querySelectorAll('td');
4844
+ for (let j = 0; j < tdElm.length; j++) {
4845
+ if (tdElm[j].style.borderLeft === 'none') {
4846
+ tdElm[j].style.removeProperty('border-left');
4887
4847
  }
4888
- const tdElm = tableElm[i].querySelectorAll('td');
4889
- for (let j = 0; j < tdElm.length; j++) {
4890
- if (tdElm[j].style.borderLeft === 'none') {
4891
- tdElm[j].style.removeProperty('border-left');
4892
- }
4893
- if (tdElm[j].style.borderRight === 'none') {
4894
- tdElm[j].style.removeProperty('border-right');
4895
- }
4896
- if (tdElm[j].style.borderBottom === 'none') {
4897
- tdElm[j].style.removeProperty('border-bottom');
4898
- }
4899
- if (tdElm[j].style.borderTop === 'none') {
4900
- tdElm[j].style.removeProperty('border-top');
4901
- }
4902
- if (tdElm[j].style.border === 'none') {
4903
- tdElm[j].style.removeProperty('border');
4904
- }
4848
+ if (tdElm[j].style.borderRight === 'none') {
4849
+ tdElm[j].style.removeProperty('border-right');
4850
+ }
4851
+ if (tdElm[j].style.borderBottom === 'none') {
4852
+ tdElm[j].style.removeProperty('border-bottom');
4853
+ }
4854
+ if (tdElm[j].style.borderTop === 'none') {
4855
+ tdElm[j].style.removeProperty('border-top');
4856
+ }
4857
+ if (tdElm[j].style.border === 'none') {
4858
+ tdElm[j].style.removeProperty('border');
4905
4859
  }
4906
- }
4907
- else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
4908
- tableElm[i].classList.remove('e-rte-paste-onenote-table');
4909
- continue;
4910
- }
4911
- else if (tableElm[i].classList.contains('e-rte-paste-html-table')) {
4912
- tableElm[i].classList.remove('e-rte-paste-html-table');
4913
- continue;
4914
4860
  }
4915
4861
  }
4916
- }
4917
- const imageElm = resultElm.querySelectorAll('img');
4918
- for (let i = 0; i < imageElm.length; i++) {
4919
- if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
4920
- continue; // Should not add the class if the image is Broken.
4921
- }
4922
- if (!imageElm[i].classList.contains('e-rte-image')) {
4923
- imageElm[i].classList.add('e-rte-image');
4862
+ else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
4863
+ tableElm[i].classList.remove('e-rte-paste-onenote-table');
4864
+ continue;
4924
4865
  }
4925
- if (!(imageElm[i].classList.contains('e-imginline') ||
4926
- imageElm[i].classList.contains('e-imgbreak'))) {
4927
- imageElm[i].classList.add('e-imginline');
4866
+ else if (tableElm[i].classList.contains('e-rte-paste-html-table')) {
4867
+ tableElm[i].classList.remove('e-rte-paste-html-table');
4868
+ continue;
4928
4869
  }
4929
4870
  }
4930
4871
  }
4872
+ const imageElm = resultElm.querySelectorAll('img');
4873
+ for (let i = 0; i < imageElm.length; i++) {
4874
+ if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
4875
+ continue; // Should not add the class if the image is Broken.
4876
+ }
4877
+ if (!imageElm[i].classList.contains('e-rte-image')) {
4878
+ imageElm[i].classList.add('e-rte-image');
4879
+ }
4880
+ if (!(imageElm[i].classList.contains('e-imginline') ||
4881
+ imageElm[i].classList.contains('e-imgbreak'))) {
4882
+ imageElm[i].classList.add('e-imginline');
4883
+ }
4884
+ }
4931
4885
  return resultElm.innerHTML;
4932
4886
  }
4933
4887
  /**
@@ -6143,7 +6097,6 @@ class ToolbarRenderer {
6143
6097
  let proxy = this;
6144
6098
  let value;
6145
6099
  const colorPicker = new ColorPicker({
6146
- enablePersistence: this.parent.enablePersistence,
6147
6100
  enableRtl: this.parent.enableRtl,
6148
6101
  inline: true,
6149
6102
  value: null,
@@ -6654,10 +6607,10 @@ class Link {
6654
6607
  }
6655
6608
  if (!this.selfLink.isUrl(linkUrl)) {
6656
6609
  if (this.selfLink.parent.editorMode === 'Markdown') {
6657
- linkText = (linkText !== '') ? linkText : '';
6610
+ linkText = (linkText.trim() !== '') ? linkText : '';
6658
6611
  }
6659
6612
  else {
6660
- linkText = (linkText === '') ? linkUrl : linkText;
6613
+ linkText = (linkText.trim() === '') ? linkUrl : linkText;
6661
6614
  }
6662
6615
  if (!this.selfLink.parent.enableAutoUrl) {
6663
6616
  linkUrl = linkUrl.indexOf('http') > -1 ? linkUrl : 'http://' + linkUrl;
@@ -12488,7 +12441,6 @@ class Table {
12488
12441
  this.parent.on(tableToolbarAction, this.onToolbarAction, this);
12489
12442
  this.parent.on(dropDownSelect, this.dropdownSelect, this);
12490
12443
  this.parent.on(keyDown, this.keyDown, this);
12491
- this.parent.on(keyUp, this.keyUp, this);
12492
12444
  this.parent.on(tableModulekeyUp, this.tableModulekeyUp, this);
12493
12445
  this.parent.on(bindCssClass, this.setCssClass, this);
12494
12446
  this.parent.on(destroy, this.destroy, this);
@@ -12509,7 +12461,6 @@ class Table {
12509
12461
  this.parent.off(mouseDown, this.cellSelect);
12510
12462
  this.parent.off(tableColorPickerChanged, this.setBGColor);
12511
12463
  this.parent.off(keyDown, this.keyDown);
12512
- this.parent.off(keyUp, this.keyUp);
12513
12464
  this.parent.off(tableModulekeyUp, this.tableModulekeyUp);
12514
12465
  this.parent.off(bindCssClass, this.setCssClass);
12515
12466
  this.parent.off(destroy, this.destroy);
@@ -12606,20 +12557,6 @@ class Table {
12606
12557
  this.parent.formatter.process(this.parent, e, e, { selection: selectCell, subCommand: e.item.subCommand });
12607
12558
  this.hideTableQuickToolbar();
12608
12559
  }
12609
- keyUp(e) {
12610
- const target = e.args.target;
12611
- if (e.args.key.toLocaleLowerCase() === 'escape' && target && target.classList && (this.popupObj && !closest(target, '[id=' + '\'' + this.popupObj.element.id + '\'' + ']')) && this.popupObj) {
12612
- let createTableToolbarBtn = this.popupObj.relateTo;
12613
- if (createTableToolbarBtn.nodeName !== 'BUTTON') {
12614
- createTableToolbarBtn = createTableToolbarBtn.querySelector('span.e-create-table');
12615
- createTableToolbarBtn = createTableToolbarBtn.parentElement;
12616
- }
12617
- this.popupObj.hide();
12618
- if (createTableToolbarBtn) {
12619
- createTableToolbarBtn.focus();
12620
- }
12621
- }
12622
- }
12623
12560
  keyDown(e) {
12624
12561
  const event = e.args;
12625
12562
  // eslint-disable-next-line
@@ -14191,6 +14128,8 @@ class Table {
14191
14128
  const header = '1X1';
14192
14129
  const insertbtn = this.l10n.getConstant('inserttablebtn');
14193
14130
  this.dlgDiv = this.parent.createElement('div', { className: 'e-rte-table-popup' + this.parent.getCssClass(true), id: this.rteID + '_table' });
14131
+ this.createTablePopupBoundFn = this.createTablePopupKeyDown.bind(this);
14132
+ this.dlgDiv.addEventListener('keydown', this.createTablePopupBoundFn);
14194
14133
  this.tblHeader = this.parent.createElement('div', { className: 'e-rte-popup-header' + this.parent.getCssClass(true) });
14195
14134
  this.tblHeader.innerHTML = header;
14196
14135
  this.dlgDiv.appendChild(this.tblHeader);
@@ -14228,6 +14167,7 @@ class Table {
14228
14167
  // eslint-disable-next-line
14229
14168
  close: (event) => {
14230
14169
  EventHandler.remove(btnEle, 'click', this.insertTableDialog);
14170
+ this.dlgDiv.removeEventListener('keydown', this.createTablePopupBoundFn);
14231
14171
  detach(btnEle);
14232
14172
  if (this.createTableButton && !this.createTableButton.isDestroyed) {
14233
14173
  this.createTableButton.destroy();
@@ -14609,6 +14549,7 @@ class Table {
14609
14549
  this.createTableButton.destroy();
14610
14550
  this.createTableButton = null;
14611
14551
  }
14552
+ this.createTablePopupBoundFn = null;
14612
14553
  this.isDestroyed = true;
14613
14554
  }
14614
14555
  /**
@@ -14634,6 +14575,15 @@ class Table {
14634
14575
  'px; left:' + (tablePosition.left + parseInt(getComputedStyle(this.curTable).width, 10) - 4) + 'px;';
14635
14576
  }
14636
14577
  }
14578
+ createTablePopupKeyDown(e) {
14579
+ if (e.key === 'Escape') {
14580
+ const popupRootElem = e.target.closest('.e-rte-table-popup');
14581
+ const popup = getComponent(popupRootElem, 'popup');
14582
+ const tableToolbarButton = popup.relateTo;
14583
+ popup.hide();
14584
+ tableToolbarButton.focus({ preventScroll: true });
14585
+ }
14586
+ }
14637
14587
  }
14638
14588
 
14639
14589
  /**
@@ -22303,7 +22253,7 @@ class InsertHtml {
22303
22253
  nodeSelection.setSelectionText(docElement, lastSelectionNode, lastSelectionNode, 0, 0);
22304
22254
  }
22305
22255
  else {
22306
- this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
22256
+ this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode);
22307
22257
  }
22308
22258
  this.alignCheck(editNode);
22309
22259
  this.listCleanUp(nodeSelection, docElement);
@@ -22563,9 +22513,9 @@ class InsertHtml {
22563
22513
  }
22564
22514
  }
22565
22515
  }
22566
- static cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction) {
22516
+ static cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode) {
22567
22517
  lastSelectionNode.classList.add('lastNode');
22568
- editNode.innerHTML = updateTextNode$1(editNode.innerHTML, enterAction);
22518
+ editNode.innerHTML = updateTextNode$1(editNode.innerHTML);
22569
22519
  lastSelectionNode = editNode.querySelector('.lastNode');
22570
22520
  if (!isNullOrUndefined(lastSelectionNode)) {
22571
22521
  this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
@@ -24044,6 +23994,17 @@ class Lists {
24044
23994
  }
24045
23995
  return false;
24046
23996
  }
23997
+ createAutoList(enterKey, shiftEnterKey) {
23998
+ const autoListRules = {
23999
+ BR: { BR: true, P: true, DIV: true },
24000
+ P: { BR: false, P: true, DIV: true },
24001
+ DIV: { BR: false, P: true, DIV: true }
24002
+ };
24003
+ if (autoListRules[enterKey] && autoListRules[enterKey][shiftEnterKey] !== undefined) {
24004
+ return autoListRules[enterKey][shiftEnterKey];
24005
+ }
24006
+ return false;
24007
+ }
24047
24008
  spaceList(e) {
24048
24009
  const range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
24049
24010
  this.saveSelection = this.parent.nodeSelection.save(range, this.parent.currentDocument);
@@ -24059,7 +24020,8 @@ class Lists {
24059
24020
  const startElementOLTest = this.testCurrentList(range);
24060
24021
  const preElementOLTest = this.testList(preElement);
24061
24022
  const nextElementOLTest = this.testList(nextElement);
24062
- if (!preElementOLTest && !nextElementOLTest && preElemULStart !== '*' && nextElemULStart !== '*') {
24023
+ const nextElementBRTest = range.startContainer.previousElementSibling && range.startContainer.previousElementSibling.tagName === 'BR';
24024
+ if (!preElementOLTest && !nextElementOLTest && preElemULStart !== '*' && nextElemULStart !== '*' && (this.createAutoList(e.enterKey, e.shiftEnterKey) || !nextElementBRTest)) {
24063
24025
  const brElement = createElement('br');
24064
24026
  if (startElementOLTest) {
24065
24027
  range.startContainer.textContent = range.startContainer.textContent.slice(range.startOffset, range.startContainer.textContent.length);
@@ -33007,7 +32969,9 @@ class HtmlEditor {
33007
32969
  const eventArgs = {
33008
32970
  callBack: null,
33009
32971
  event: e.args,
33010
- name: 'keydown-handler'
32972
+ name: 'keydown-handler',
32973
+ enterKey: this.parent.enterKey,
32974
+ shiftEnterKey: this.parent.shiftEnterKey
33011
32975
  };
33012
32976
  const actionBeginArgs = {
33013
32977
  cancel: false,
@@ -33143,6 +33107,26 @@ class HtmlEditor {
33143
33107
  if (isNullOrUndefined(this.oldRangeElement)) {
33144
33108
  return;
33145
33109
  }
33110
+ else if (findBlockElement[0].previousSibling) {
33111
+ const prevSibling = findBlockElement[0].previousSibling;
33112
+ const currentElement = findBlockElement[0];
33113
+ if (prevSibling.textContent.trim()) {
33114
+ if (prevSibling.lastChild.nodeName === 'BR') {
33115
+ prevSibling.removeChild(prevSibling.lastChild);
33116
+ }
33117
+ const cursorpointer = prevSibling.lastChild.textContent.length;
33118
+ const lastChild = prevSibling.lastChild;
33119
+ const childNodes = Array.from(currentElement.childNodes);
33120
+ for (let i = 0; i < childNodes.length; i++) {
33121
+ prevSibling.appendChild(childNodes[i].cloneNode(true));
33122
+ }
33123
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), lastChild, cursorpointer);
33124
+ currentElement.parentNode.removeChild(currentElement);
33125
+ }
33126
+ else {
33127
+ prevSibling.parentNode.removeChild(prevSibling);
33128
+ }
33129
+ }
33146
33130
  else {
33147
33131
  if (this.oldRangeElement.tagName === 'OL' || this.oldRangeElement.tagName === 'UL') {
33148
33132
  this.oldRangeElement = this.oldRangeElement.lastElementChild.lastElementChild
@@ -35035,13 +35019,24 @@ class Resize {
35035
35019
  this.iframeElement = this.parent.contentModule.getDocument().querySelectorAll('iframe');
35036
35020
  if (!isNullOrUndefined(this.iframeElement)) {
35037
35021
  this.iframeElement.forEach((iframe) => {
35038
- EventHandler.add(iframe.contentDocument, 'mouseup', this.stopResize, this);
35022
+ EventHandler.add(iframe, 'load', this.onIFrameLoad, this);
35039
35023
  });
35040
35024
  }
35041
35025
  this.touchStartEvent = (Browser.info.name === 'msie') ? 'pointerdown' : 'touchstart';
35042
35026
  EventHandler.add(this.resizer, 'mousedown', this.resizeStart, this);
35043
35027
  EventHandler.add(this.resizer, this.touchStartEvent, this.resizeStart, this);
35044
35028
  }
35029
+ onIFrameLoad(e) {
35030
+ const iframe = e.target;
35031
+ if (iframe.nodeName === 'IFRAME' && iframe.contentDocument) {
35032
+ EventHandler.add(iframe.contentDocument, 'mouseup', this.stopResize, this);
35033
+ }
35034
+ }
35035
+ removeMouseUpEventListener(iframe) {
35036
+ if (iframe.contentDocument) {
35037
+ EventHandler.remove(iframe.contentDocument, 'mouseup', this.stopResize);
35038
+ }
35039
+ }
35045
35040
  resizeStart(e) {
35046
35041
  this.isResizing = false;
35047
35042
  if (e.cancelable) {
@@ -35145,7 +35140,7 @@ class Resize {
35145
35140
  }
35146
35141
  if (!isNullOrUndefined(this.iframeElement)) {
35147
35142
  this.iframeElement.forEach((iframe) => {
35148
- EventHandler.remove(iframe.contentDocument, 'mouseup', this.stopResize);
35143
+ this.removeMouseUpEventListener(iframe);
35149
35144
  });
35150
35145
  }
35151
35146
  if (this.resizer) {
@@ -37726,7 +37721,7 @@ class EnterKeyAction {
37726
37721
  if ((this.parent.enterKey === 'P' && !shiftKey) || (this.parent.enterKey === 'DIV' && !shiftKey) ||
37727
37722
  (this.parent.shiftEnterKey === 'P' && shiftKey) ||
37728
37723
  (this.parent.shiftEnterKey === 'DIV' && shiftKey)) {
37729
- if ((this.range.startOffset === 1 && this.parent.inputElement.childNodes.length === 1 && this.parent.inputElement.childNodes[0].nodeName === 'TABLE') || (this.parent.enterKey === 'BR' && shiftKey)) {
37724
+ if ((this.range.startOffset === 1 && this.parent.inputElement.childNodes.length === 1 && this.parent.inputElement.childNodes[0].nodeName === 'TABLE')) {
37730
37725
  const newElem = this.createInsertElement(shiftKey);
37731
37726
  newElem.appendChild(this.parent.createElement('BR'));
37732
37727
  this.parent.inputElement.appendChild(newElem);
@@ -37785,8 +37780,9 @@ class EnterKeyAction {
37785
37780
  (this.range.startContainer.nodeName === '#text' && !isNullOrUndefined(this.range.startContainer.textContent[this.range.startOffset]) &&
37786
37781
  this.range.startContainer.textContent[this.range.startOffset].includes('\u200B') && this.range.startContainer.textContent[this.range.startOffset] === '\u200B' &&
37787
37782
  this.parent.inputElement.textContent[0] !== '\u200B'));
37783
+ const preventEnterkeyShiftKey = (this.range.startContainer.nodeName === '#text' || this.range.startContainer.nodeName === 'BR') && (this.range.startOffset === 0 && this.range.endOffset === 0) && this.range.startContainer.parentElement === this.parent.inputElement && this.parent.enterKey === 'BR' && shiftKey;
37788
37784
  // eslint-disable-next-line max-len
37789
- if (!preventZeroWithSpace && !fireFoxEnterAtMiddle && ((this.range.startOffset === 0 && this.range.endOffset === 0) || isFocusedFirst) &&
37785
+ if (!preventEnterkeyShiftKey && !preventZeroWithSpace && !fireFoxEnterAtMiddle && ((this.range.startOffset === 0 && this.range.endOffset === 0) || isFocusedFirst) &&
37790
37786
  !(!isNullOrUndefined(this.range.startContainer.previousSibling) &&
37791
37787
  (this.range.startContainer.previousSibling.nodeName === 'IMG' || this.range.startContainer.previousSibling.nodeName === 'BR'))) {
37792
37788
  let isNearBlockLengthZero;
@@ -37851,7 +37847,7 @@ class EnterKeyAction {
37851
37847
  }
37852
37848
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), insertElem.nextElementSibling, 0);
37853
37849
  }
37854
- else if (nearBlockNode.textContent.length === 0 && !(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG' ||
37850
+ else if (nearBlockNode !== this.parent.inputElement && nearBlockNode.textContent.length === 0 && !(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG' ||
37855
37851
  (nearBlockNode.querySelectorAll('video').length > 0) || (nearBlockNode.querySelectorAll('audio').length > 0) || (nearBlockNode.querySelectorAll('img').length > 0))) {
37856
37852
  if (!isNullOrUndefined(nearBlockNode.children[0]) && nearBlockNode.children[0].tagName !== 'BR') {
37857
37853
  const newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, false).cloneNode(true);
@@ -37907,6 +37903,36 @@ class EnterKeyAction {
37907
37903
  this.parent.videoModule.hideVideoQuickToolbar();
37908
37904
  }
37909
37905
  }
37906
+ else if (this.parent.enterKey === 'BR' && shiftKey && this.range.startContainer.nodeType === Node.TEXT_NODE && this.range.startContainer.parentElement && this.range.startContainer.parentElement === this.parent.inputElement) {
37907
+ const range = this.range;
37908
+ const startContainer = range.startContainer;
37909
+ const startOffset = range.startOffset;
37910
+ const newElement = this.parent.createElement(this.parent.shiftEnterKey);
37911
+ if (startContainer.nodeType === Node.TEXT_NODE && range.endOffset !== 0 && range.startOffset !== 0) {
37912
+ const textNode = startContainer;
37913
+ if (startOffset < textNode.length) {
37914
+ const newTextNode = textNode.splitText(startOffset);
37915
+ newElement.appendChild(newTextNode);
37916
+ }
37917
+ else {
37918
+ newElement.innerHTML = '<br>';
37919
+ }
37920
+ textNode.parentNode.insertBefore(newElement, textNode.nextSibling);
37921
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), newElement, 0);
37922
+ }
37923
+ else if (startOffset === 0 && range.endOffset === 0) {
37924
+ newElement.innerHTML = '<br>';
37925
+ if (range.endOffset === startContainer.textContent.length) {
37926
+ const brElement = this.parent.createElement('br');
37927
+ startContainer.parentNode.insertBefore(brElement, startContainer);
37928
+ }
37929
+ startContainer.parentNode.insertBefore(newElement, startContainer);
37930
+ const cursorTarget = (range.endOffset === startContainer.textContent.length)
37931
+ ? newElement : newElement.nextSibling;
37932
+ startContainer.parentNode.insertBefore(newElement, startContainer);
37933
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), cursorTarget, 0);
37934
+ }
37935
+ }
37910
37936
  else {
37911
37937
  const newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, true);
37912
37938
  if (!isNullOrUndefined(newElem.childNodes[0]) && newElem.childNodes[0].nodeName === '#text' &&
@@ -39769,7 +39795,7 @@ let RichTextEditor = class RichTextEditor extends Component {
39769
39795
  this.placeHolderWrapper.innerHTML = this.placeholder;
39770
39796
  if (this.inputElement.textContent.length === 0 && this.inputElement.childNodes.length < 2 && !isNullOrUndefined(this.inputElement.firstChild) && (this.inputElement.firstChild.nodeName === 'BR' ||
39771
39797
  ((this.inputElement.firstChild.nodeName === 'P' || this.inputElement.firstChild.nodeName === 'DIV') && !isNullOrUndefined(this.inputElement.firstChild.firstChild) &&
39772
- this.inputElement.firstChild.firstChild.nodeName === 'BR'))) {
39798
+ this.inputElement.firstChild.childNodes.length < 2 && this.inputElement.firstChild.firstChild.nodeName === 'BR'))) {
39773
39799
  this.placeHolderWrapper.classList.add('enabled');
39774
39800
  }
39775
39801
  else {
@@ -40503,7 +40529,6 @@ let RichTextEditor = class RichTextEditor extends Component {
40503
40529
  const value = this.getUpdatedValue();
40504
40530
  this.setProperties({ value: value });
40505
40531
  this.valueContainer.value = this.value;
40506
- this.notify(toolbarRefresh, { args: e, documentNode: document });
40507
40532
  this.isValueChangeBlurhandler = true;
40508
40533
  this.invokeChangeEvent();
40509
40534
  this.isFocusOut = true;