@syncfusion/ej2-richtexteditor 20.4.52 → 20.4.53

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.
@@ -4992,6 +4992,11 @@ class Toolbar$2 {
4992
4992
  toolbarClickHandler(e) {
4993
4993
  const trg = closest(e.originalEvent.target, '.e-hor-nav');
4994
4994
  if (trg && this.parent.toolbarSettings.type === ToolbarType.Expand && !isNullOrUndefined(trg)) {
4995
+ let extendedTbar = this.tbElement.querySelector('.e-toolbar-extended');
4996
+ if (!isNullOrUndefined(extendedTbar)) {
4997
+ setStyleAttribute(extendedTbar, { maxHeight: '', display: 'block' });
4998
+ setStyleAttribute(extendedTbar, { maxHeight: extendedTbar.offsetHeight + 'px', display: '' });
4999
+ }
4995
5000
  if (!trg.classList.contains('e-nav-active')) {
4996
5001
  removeClass([this.tbElement], [CLS_EXPAND_OPEN]);
4997
5002
  this.parent.setContentHeight('toolbar', false);
@@ -6297,10 +6302,17 @@ class QuickToolbar {
6297
6302
  }
6298
6303
  keyUpHandler(e) {
6299
6304
  if (this.parent.inlineMode.enable && !Browser.isDevice) {
6305
+ const args = e.args;
6300
6306
  if (this.parent.inlineMode.onSelection) {
6307
+ if (this.parent.getSelection().length > 0) {
6308
+ if ((args.ctrlKey && args.keyCode === 65) || (args.shiftKey && (args.keyCode === 33 || args.keyCode === 34 ||
6309
+ args.keyCode === 35 || args.keyCode === 36 || args.keyCode === 37 || args.keyCode === 38 ||
6310
+ args.keyCode === 39 || args.keyCode === 40))) {
6311
+ this.showInlineQTBar(this.offsetX, this.offsetY, args.target);
6312
+ }
6313
+ }
6301
6314
  return;
6302
6315
  }
6303
- const args = e.args;
6304
6316
  this.deBounce(this.offsetX, this.offsetY, args.target);
6305
6317
  }
6306
6318
  }
@@ -6953,7 +6965,7 @@ function setEditFrameFocus(editableElement, selector) {
6953
6965
  * @returns {void}
6954
6966
  * @hidden
6955
6967
  */
6956
- function updateTextNode$1(value) {
6968
+ function updateTextNode$1(value, enterAction) {
6957
6969
  const tempNode = document.createElement('div');
6958
6970
  tempNode.innerHTML = value;
6959
6971
  tempNode.setAttribute('class', 'tempDiv');
@@ -6968,15 +6980,23 @@ function updateTextNode$1(value) {
6968
6980
  (tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
6969
6981
  inlineNode$1.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0) {
6970
6982
  if (!isPreviousInlineElem) {
6971
- paraElm = createElement('p');
6972
- resultElm.appendChild(paraElm);
6973
- paraElm.appendChild(tempNode.firstChild);
6983
+ if (enterAction === 'BR') {
6984
+ resultElm.appendChild(tempNode.firstChild);
6985
+ previousParent = resultElm;
6986
+ }
6987
+ else {
6988
+ paraElm = createElement('p');
6989
+ resultElm.appendChild(paraElm);
6990
+ paraElm.appendChild(tempNode.firstChild);
6991
+ previousParent = paraElm;
6992
+ isPreviousInlineElem = true;
6993
+ }
6974
6994
  }
6975
6995
  else {
6976
6996
  previousParent.appendChild(tempNode.firstChild);
6997
+ previousParent = paraElm;
6998
+ isPreviousInlineElem = true;
6977
6999
  }
6978
- previousParent = paraElm;
6979
- isPreviousInlineElem = true;
6980
7000
  }
6981
7001
  else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
6982
7002
  (tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
@@ -12621,7 +12641,7 @@ class Formats {
12621
12641
  * @deprecated
12622
12642
  */
12623
12643
  class InsertHtml {
12624
- static Insert(docElement, insertNode, editNode, isExternal) {
12644
+ static Insert(docElement, insertNode, editNode, isExternal, enterAction) {
12625
12645
  let node;
12626
12646
  if (typeof insertNode === 'string') {
12627
12647
  const divNode = document.createElement('div');
@@ -12643,7 +12663,8 @@ class InsertHtml {
12643
12663
  const nodeCutter = new NodeCutter();
12644
12664
  let range = nodeSelection.getRange(docElement);
12645
12665
  if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
12646
- range.startOffset === range.endOffset && editNode.textContent.length === 0 && editNode.children[0].tagName === 'P') {
12666
+ range.startOffset === range.endOffset && editNode.textContent.length === 0 &&
12667
+ (editNode.children[0].tagName === 'P' || (editNode.children[0].tagName === 'BR'))) {
12647
12668
  nodeSelection.setSelectionText(docElement, range.startContainer.children[0], range.startContainer.children[0], 0, 0);
12648
12669
  range = nodeSelection.getRange(docElement);
12649
12670
  }
@@ -12660,7 +12681,7 @@ class InsertHtml {
12660
12681
  const closestParentNode = (node.nodeName.toLowerCase() === 'table') ? this.closestEle(nodes[0].parentNode, editNode) : nodes[0];
12661
12682
  if (isExternal || (!isNullOrUndefined(node) && !isNullOrUndefined(node.classList) &&
12662
12683
  node.classList.contains('pasteContent'))) {
12663
- this.pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode);
12684
+ this.pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction);
12664
12685
  return;
12665
12686
  }
12666
12687
  if (editNode !== range.startContainer && ((!isCollapsed && !(closestParentNode.nodeType === Node.ELEMENT_NODE &&
@@ -12774,7 +12795,7 @@ class InsertHtml {
12774
12795
  }
12775
12796
  }
12776
12797
  }
12777
- static pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode) {
12798
+ static pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction) {
12778
12799
  const isCursor = range.startOffset === range.endOffset &&
12779
12800
  range.startContainer === range.endContainer;
12780
12801
  if (isCursor && range.startContainer === editNode && editNode.textContent === '') {
@@ -12884,7 +12905,12 @@ class InsertHtml {
12884
12905
  const firstParaElm = createElement('p');
12885
12906
  node.parentElement.insertBefore(firstParaElm, node);
12886
12907
  }
12887
- node.previousElementSibling.appendChild(node.firstChild);
12908
+ if (node.previousElementSibling.nodeName === 'BR') {
12909
+ node.parentElement.insertBefore(node.firstChild, node);
12910
+ }
12911
+ else {
12912
+ node.previousElementSibling.appendChild(node.firstChild);
12913
+ }
12888
12914
  }
12889
12915
  else {
12890
12916
  lastSelectionNode = node.firstChild;
@@ -12916,7 +12942,7 @@ class InsertHtml {
12916
12942
  this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
12917
12943
  }
12918
12944
  else {
12919
- this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode);
12945
+ this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
12920
12946
  }
12921
12947
  }
12922
12948
  static placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode) {
@@ -13031,9 +13057,9 @@ class InsertHtml {
13031
13057
  }
13032
13058
  }
13033
13059
  }
13034
- static cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode) {
13060
+ static cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction) {
13035
13061
  lastSelectionNode.classList.add('lastNode');
13036
- editNode.innerHTML = updateTextNode$1(editNode.innerHTML);
13062
+ editNode.innerHTML = updateTextNode$1(editNode.innerHTML, enterAction);
13037
13063
  lastSelectionNode = editNode.querySelector('.lastNode');
13038
13064
  if (!isNullOrUndefined(lastSelectionNode)) {
13039
13065
  this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
@@ -16205,7 +16231,7 @@ class InsertHtmlExec {
16205
16231
  this.parent.observer.on(INSERTHTML_TYPE, this.applyHtml, this);
16206
16232
  }
16207
16233
  applyHtml(e) {
16208
- InsertHtml.Insert(this.parent.currentDocument, e.value, this.parent.editableElement, true);
16234
+ InsertHtml.Insert(this.parent.currentDocument, e.value, this.parent.editableElement, true, e.enterAction);
16209
16235
  if (e.subCommand === 'pasteCleanup') {
16210
16236
  const pastedElements = this.parent.editableElement.querySelectorAll('.pasteContent_RTE');
16211
16237
  const allPastedElements = [].slice.call(pastedElements);
@@ -17096,6 +17122,29 @@ class MsWordPaste {
17096
17122
  }
17097
17123
  fromClass = false;
17098
17124
  }
17125
+ let listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
17126
+ for (let i = 0; i < listClass.length; i++) {
17127
+ if (keys.indexOf('li.' + listClass[i]) > -1) {
17128
+ let olULElems = elm.querySelectorAll('ol.' + listClass[i] + ', ul.' + listClass[i]);
17129
+ for (let j = 0; j < olULElems.length; j++) {
17130
+ const styleProperty = olULElems[j].getAttribute('style');
17131
+ if (!isNullOrUndefined(styleProperty) && styleProperty.trim() !== '' && olULElems[j].style.marginLeft !== '') {
17132
+ const valueSplit = values[keys.indexOf('li.' + listClass[i])].split(';');
17133
+ for (let k = 0; k < valueSplit.length; k++) {
17134
+ if ('margin-left'.indexOf(valueSplit[k].split(':')[0]) >= 0) {
17135
+ if (!isNullOrUndefined(valueSplit[k].split(':')[1]) &&
17136
+ valueSplit[k].split(':')[1].indexOf('in') >= 0 &&
17137
+ olULElems[j].style.marginLeft.indexOf('in') >= 0) {
17138
+ let classStyle = parseFloat(valueSplit[k].split(':')[1].split('in')[0]);
17139
+ let inlineStyle = parseFloat(olULElems[j].style.marginLeft.split('in')[0]);
17140
+ olULElems[j].style.marginLeft = (inlineStyle - classStyle) + 'in';
17141
+ }
17142
+ }
17143
+ }
17144
+ }
17145
+ }
17146
+ }
17147
+ }
17099
17148
  }
17100
17149
  }
17101
17150
  filterStyles(elm, wordPasteStyleConfig) {
@@ -17216,12 +17265,13 @@ class MsWordPaste {
17216
17265
  let type;
17217
17266
  let listStyleType;
17218
17267
  let startAttr;
17268
+ let styleMarginLeft;
17219
17269
  if (!isNullOrUndefined(this.listContents[0])) {
17220
17270
  type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
17221
17271
  listStyleType = this.getlistStyleType(this.listContents[0], type);
17222
- if (type === 'ol' && listNodes[i - 1] === null) {
17272
+ if (type === 'ol' && (i === 0 || listNodes[i - 1] === null)) {
17223
17273
  const startString = this.listContents[0].split('.')[0];
17224
- const listTypes = ['A', 'a', 'I', 'i', 'α', '1'];
17274
+ const listTypes = ['A', 'a', 'I', 'i', 'α', '1', '1-']; // Add '1-' for rare list type.
17225
17275
  if (listTypes.indexOf(startString) === -1) {
17226
17276
  if (listStyleType === 'decimal') {
17227
17277
  // Bug in getlistStyleType() list style stype is returned as decimal for nested list with start attribute
@@ -17229,10 +17279,16 @@ class MsWordPaste {
17229
17279
  startAttr = parseInt(startString);
17230
17280
  }
17231
17281
  }
17232
- else if (listStyleType === 'upper-alpha' || listStyleType === 'lower-alpha') {
17233
- startAttr = parseInt(startString.toLowerCase()) - 96;
17282
+ else if (listStyleType === 'upper-alpha') {
17283
+ startAttr = (startString.split('.')[0].charCodeAt(0) - 64);
17284
+ }
17285
+ else if (listStyleType === 'lower-alpha') {
17286
+ startAttr = (startString.split('.')[0].charCodeAt(0) - 96);
17234
17287
  }
17235
17288
  }
17289
+ if (listNodes[i].style.marginLeft !== '') {
17290
+ styleMarginLeft = listNodes[i].style.marginLeft;
17291
+ }
17236
17292
  }
17237
17293
  const tempNode = [];
17238
17294
  for (let j = 1; j < this.listContents.length; j++) {
@@ -17250,7 +17306,7 @@ class MsWordPaste {
17250
17306
  }
17251
17307
  }
17252
17308
  collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
17253
- listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr });
17309
+ listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft });
17254
17310
  }
17255
17311
  }
17256
17312
  stNode = listNodes.shift();
@@ -17276,23 +17332,30 @@ class MsWordPaste {
17276
17332
  }
17277
17333
  getlistStyleType(listContent, type) {
17278
17334
  let currentListClass;
17335
+ let upperRomanNumber = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX',
17336
+ 'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX'];
17337
+ let lowerRomanNumber = ['i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii', 'viii', 'ix',
17338
+ 'x', 'xi', 'xii', 'xiii', 'xiv', 'xv', 'xvi', 'xvii', 'xviii', 'xix', 'xx'];
17339
+ let lowerGreekNumber = ['α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ',
17340
+ 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω'];
17279
17341
  if (type === 'ol') {
17280
- switch (listContent.split('.')[0]) {
17281
- case 'A':
17282
- currentListClass = 'upper-alpha';
17283
- break;
17284
- case 'a':
17285
- currentListClass = 'lower-alpha';
17286
- break;
17287
- case 'I':
17342
+ let charCode = listContent.split('.')[0].charCodeAt(0);
17343
+ switch (true) {
17344
+ case upperRomanNumber.indexOf(listContent.split('.')[0]) > -1:
17288
17345
  currentListClass = 'upper-roman';
17289
17346
  break;
17290
- case 'i':
17347
+ case lowerRomanNumber.indexOf(listContent.split('.')[0]) > -1:
17291
17348
  currentListClass = 'lower-roman';
17292
17349
  break;
17293
- case 'α':
17350
+ case lowerGreekNumber.indexOf(listContent.split('.')[0]) > -1:
17294
17351
  currentListClass = 'lower-greek';
17295
17352
  break;
17353
+ case (charCode > 64 && charCode < 91):
17354
+ currentListClass = 'upper-alpha';
17355
+ break;
17356
+ case (charCode > 96 && charCode < 123):
17357
+ currentListClass = 'lower-alpha';
17358
+ break;
17296
17359
  default:
17297
17360
  currentListClass = 'decimal';
17298
17361
  break;
@@ -17324,11 +17387,12 @@ class MsWordPaste {
17324
17387
  const pElement = createElement('p');
17325
17388
  pElement.innerHTML = collection[index].content.join(' ');
17326
17389
  if ((collection[index].nestedLevel === 1) && listCount === 0 && collection[index].content) {
17327
- root.appendChild(temp = createElement(collection[index].listType));
17390
+ root.appendChild(temp = createElement(collection[index].listType, { className: collection[index].class }));
17328
17391
  prevList = createElement('li');
17329
17392
  prevList.appendChild(pElement);
17330
17393
  temp.appendChild(prevList);
17331
17394
  temp.setAttribute('level', collection[index].nestedLevel.toString());
17395
+ temp.style.marginLeft = collection[index].styleMarginLeft;
17332
17396
  temp.style.listStyleType = collection[index].listStyleTypeName;
17333
17397
  }
17334
17398
  else if (collection[index].nestedLevel === pLevel) {
@@ -17659,7 +17723,7 @@ class EditorManager {
17659
17723
  this.observer.notify(SELECTION_TYPE, { subCommand: value, event: event, callBack: callBack, value: text, selector: selector, enterAction: enterAction });
17660
17724
  break;
17661
17725
  case 'inserthtml':
17662
- this.observer.notify(INSERTHTML_TYPE, { subCommand: value, callBack: callBack, value: text });
17726
+ this.observer.notify(INSERTHTML_TYPE, { subCommand: value, callBack: callBack, value: text, enterAction: enterAction });
17663
17727
  break;
17664
17728
  case 'inserttext':
17665
17729
  this.observer.notify(INSERT_TEXT_TYPE, { subCommand: value, callBack: callBack, value: text });
@@ -19945,7 +20009,7 @@ class PasteCleanup {
19945
20009
  this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, (returnArgs) => {
19946
20010
  extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
19947
20011
  this.parent.formatter.onSuccess(this.parent, args);
19948
- }, clipBoardElem);
20012
+ }, clipBoardElem, null, null, this.parent.enterKey);
19949
20013
  this.removeTempClass();
19950
20014
  this.parent.notify(toolbarRefresh, {});
19951
20015
  this.imgUploading(this.parent.inputElement);
@@ -20014,7 +20078,7 @@ class PasteCleanup {
20014
20078
  this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, (returnArgs) => {
20015
20079
  extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
20016
20080
  this.parent.formatter.onSuccess(this.parent, args);
20017
- }, clipBoardElem);
20081
+ }, clipBoardElem, null, null, this.parent.enterKey);
20018
20082
  this.removeTempClass();
20019
20083
  }
20020
20084
  else {
@@ -28535,7 +28599,16 @@ class EnterKeyAction {
28535
28599
  this.parent.tableModule.removeResizeElement();
28536
28600
  }
28537
28601
  if (!(this.parent.inputElement.childNodes.length === 1 && this.parent.inputElement.childNodes[0].nodeName === 'TABLE')) {
28538
- this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), this.range.startContainer.childNodes[this.range.startOffset], 0);
28602
+ if (isNullOrUndefined(this.range.startContainer.childNodes[this.range.startOffset])) {
28603
+ let currentLastElem = this.range.startContainer.childNodes[this.range.startOffset - 1];
28604
+ while (currentLastElem.lastChild !== null && currentLastElem.nodeName !== '#text') {
28605
+ currentLastElem = currentLastElem.lastChild;
28606
+ }
28607
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), currentLastElem, (currentLastElem.nodeName === 'BR' ? 0 : currentLastElem.textContent.length));
28608
+ }
28609
+ else {
28610
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), this.range.startContainer.childNodes[this.range.startOffset], 0);
28611
+ }
28539
28612
  }
28540
28613
  this.getRangeNode();
28541
28614
  }
@@ -28757,11 +28830,13 @@ class EnterKeyAction {
28757
28830
  }
28758
28831
  const isLastNodeLength = this.range.startContainer === currentParentLastChild ?
28759
28832
  this.range.startContainer.textContent.length : currentParent.textContent.length;
28833
+ const isImageElement = (this.range.startContainer.nodeName === 'IMG' || (this.range.startContainer.childNodes.length > 0
28834
+ && this.range.startContainer.childNodes[this.range.startOffset].nodeName === 'IMG'));
28760
28835
  if (currentParent !== this.parent.inputElement &&
28761
28836
  this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
28762
28837
  this.range.startOffset === this.range.endOffset &&
28763
28838
  (this.range.startOffset === isLastNodeLength ||
28764
- (currentParent.textContent.trim().length === 0 && currentParent.lastChild.nodeName === 'IMG'))) {
28839
+ (currentParent.textContent.trim().length === 0 && isImageElement))) {
28765
28840
  let focusBRElem = this.parent.createElement('br');
28766
28841
  if (this.range.startOffset === 0 && this.range.startContainer.nodeName === 'TABLE') {
28767
28842
  this.range.startContainer.parentElement.insertBefore(focusBRElem, this.range.startContainer);
@@ -28770,10 +28845,11 @@ class EnterKeyAction {
28770
28845
  if (currentParentLastChild.nodeName === 'BR' && currentParent.textContent.length === 0) {
28771
28846
  this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, currentParentLastChild);
28772
28847
  }
28773
- else if (this.range.startOffset === 0 && this.range.endOffset === 0 &&
28774
- currentParent.lastChild && currentParent.lastChild.nodeName === 'IMG') {
28775
- currentParentLastChild.parentElement.insertBefore(focusBRElem, currentParentLastChild);
28776
- focusBRElem = currentParentLastChild;
28848
+ else if (this.range.startOffset === 0 && this.range.endOffset === 0 && isImageElement) {
28849
+ const imageElement = this.range.startContainer.nodeName === 'IMG' ? this.range.startContainer :
28850
+ this.range.startContainer.childNodes[this.range.startOffset];
28851
+ currentParent.insertBefore(focusBRElem, imageElement);
28852
+ focusBRElem = imageElement;
28777
28853
  }
28778
28854
  else {
28779
28855
  const lineBreakBRElem = this.parent.createElement('br');
@@ -29457,15 +29533,16 @@ let RichTextEditor = class RichTextEditor extends Component {
29457
29533
  const currentEndContainer = range.endContainer;
29458
29534
  const currentStartOffset = range.startOffset;
29459
29535
  const isSameContainer = currentStartContainer === currentEndContainer ? true : false;
29460
- const currentEndOffset = currentEndContainer.textContent.length;
29461
29536
  const endNode = range.endContainer.nodeName === '#text' ? range.endContainer.parentElement :
29462
29537
  range.endContainer;
29463
29538
  const closestLI = closest(endNode, 'LI');
29539
+ let isDetached = false;
29464
29540
  if (!isNullOrUndefined(closestLI) && endNode.textContent.length === range.endOffset &&
29465
29541
  !range.collapsed && isNullOrUndefined(endNode.nextElementSibling)) {
29466
29542
  for (let i = 0; i < closestLI.childNodes.length; i++) {
29467
29543
  if (closestLI.childNodes[i].nodeName === '#text' && closestLI.childNodes[i].textContent.trim().length === 0) {
29468
29544
  detach(closestLI.childNodes[i]);
29545
+ isDetached = true;
29469
29546
  i--;
29470
29547
  }
29471
29548
  }
@@ -29473,7 +29550,11 @@ let RichTextEditor = class RichTextEditor extends Component {
29473
29550
  while (currentLastElem.lastChild !== null && currentLastElem.nodeName !== '#text') {
29474
29551
  currentLastElem = currentLastElem.lastChild;
29475
29552
  }
29476
- this.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), isSameContainer ? currentStartContainer : (currentLastElem.nodeName === 'BR' && !isNullOrUndefined(currentLastElem.previousSibling) ? currentLastElem.previousSibling : currentStartContainer), currentEndContainer, currentStartOffset, (currentLastElem.nodeName === 'BR' ? 0 : currentEndOffset));
29553
+ if (isDetached) {
29554
+ let currentLast = currentLastElem.nodeName === 'BR' && !isNullOrUndefined(currentLastElem.previousSibling) ?
29555
+ currentLastElem.previousSibling : currentLastElem;
29556
+ this.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), isSameContainer ? currentLast : currentStartContainer, currentLast, currentStartOffset, (currentLast.nodeName === 'BR' ? 0 : currentLast.textContent.length));
29557
+ }
29477
29558
  }
29478
29559
  }
29479
29560
  /**