@syncfusion/ej2-richtexteditor 20.4.51 → 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);
@@ -16842,7 +16868,10 @@ class MsWordPaste {
16842
16868
  this.checkVShape(elm);
16843
16869
  let imgElem = elm.querySelectorAll('img');
16844
16870
  for (let i = 0; i < imgElem.length; i++) {
16845
- if (!isNullOrUndefined(imgElem[i].getAttribute('v:shapes')) && imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0 && imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0) {
16871
+ if (!isNullOrUndefined(imgElem[i].getAttribute('v:shapes')) &&
16872
+ imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0 &&
16873
+ imgElem[i].getAttribute('v:shapes').indexOf('圖片') < 0 &&
16874
+ imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0) {
16846
16875
  detach(imgElem[i]);
16847
16876
  }
16848
16877
  }
@@ -17093,6 +17122,29 @@ class MsWordPaste {
17093
17122
  }
17094
17123
  fromClass = false;
17095
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
+ }
17096
17148
  }
17097
17149
  }
17098
17150
  filterStyles(elm, wordPasteStyleConfig) {
@@ -17213,12 +17265,13 @@ class MsWordPaste {
17213
17265
  let type;
17214
17266
  let listStyleType;
17215
17267
  let startAttr;
17268
+ let styleMarginLeft;
17216
17269
  if (!isNullOrUndefined(this.listContents[0])) {
17217
17270
  type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
17218
17271
  listStyleType = this.getlistStyleType(this.listContents[0], type);
17219
- if (type === 'ol' && listNodes[i - 1] === null) {
17272
+ if (type === 'ol' && (i === 0 || listNodes[i - 1] === null)) {
17220
17273
  const startString = this.listContents[0].split('.')[0];
17221
- const listTypes = ['A', 'a', 'I', 'i', 'α', '1'];
17274
+ const listTypes = ['A', 'a', 'I', 'i', 'α', '1', '1-']; // Add '1-' for rare list type.
17222
17275
  if (listTypes.indexOf(startString) === -1) {
17223
17276
  if (listStyleType === 'decimal') {
17224
17277
  // Bug in getlistStyleType() list style stype is returned as decimal for nested list with start attribute
@@ -17226,9 +17279,15 @@ class MsWordPaste {
17226
17279
  startAttr = parseInt(startString);
17227
17280
  }
17228
17281
  }
17229
- else if (listStyleType === 'upper-alpha' || listStyleType === 'lower-alpha') {
17230
- startAttr = parseInt(startString.toLowerCase()) - 96;
17282
+ else if (listStyleType === 'upper-alpha') {
17283
+ startAttr = (startString.split('.')[0].charCodeAt(0) - 64);
17231
17284
  }
17285
+ else if (listStyleType === 'lower-alpha') {
17286
+ startAttr = (startString.split('.')[0].charCodeAt(0) - 96);
17287
+ }
17288
+ }
17289
+ if (listNodes[i].style.marginLeft !== '') {
17290
+ styleMarginLeft = listNodes[i].style.marginLeft;
17232
17291
  }
17233
17292
  }
17234
17293
  const tempNode = [];
@@ -17247,7 +17306,7 @@ class MsWordPaste {
17247
17306
  }
17248
17307
  }
17249
17308
  collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
17250
- listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr });
17309
+ listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft });
17251
17310
  }
17252
17311
  }
17253
17312
  stNode = listNodes.shift();
@@ -17273,23 +17332,30 @@ class MsWordPaste {
17273
17332
  }
17274
17333
  getlistStyleType(listContent, type) {
17275
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
+ 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω'];
17276
17341
  if (type === 'ol') {
17277
- switch (listContent.split('.')[0]) {
17278
- case 'A':
17279
- currentListClass = 'upper-alpha';
17280
- break;
17281
- case 'a':
17282
- currentListClass = 'lower-alpha';
17283
- break;
17284
- case 'I':
17342
+ let charCode = listContent.split('.')[0].charCodeAt(0);
17343
+ switch (true) {
17344
+ case upperRomanNumber.indexOf(listContent.split('.')[0]) > -1:
17285
17345
  currentListClass = 'upper-roman';
17286
17346
  break;
17287
- case 'i':
17347
+ case lowerRomanNumber.indexOf(listContent.split('.')[0]) > -1:
17288
17348
  currentListClass = 'lower-roman';
17289
17349
  break;
17290
- case 'α':
17350
+ case lowerGreekNumber.indexOf(listContent.split('.')[0]) > -1:
17291
17351
  currentListClass = 'lower-greek';
17292
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;
17293
17359
  default:
17294
17360
  currentListClass = 'decimal';
17295
17361
  break;
@@ -17321,11 +17387,12 @@ class MsWordPaste {
17321
17387
  const pElement = createElement('p');
17322
17388
  pElement.innerHTML = collection[index].content.join(' ');
17323
17389
  if ((collection[index].nestedLevel === 1) && listCount === 0 && collection[index].content) {
17324
- root.appendChild(temp = createElement(collection[index].listType));
17390
+ root.appendChild(temp = createElement(collection[index].listType, { className: collection[index].class }));
17325
17391
  prevList = createElement('li');
17326
17392
  prevList.appendChild(pElement);
17327
17393
  temp.appendChild(prevList);
17328
17394
  temp.setAttribute('level', collection[index].nestedLevel.toString());
17395
+ temp.style.marginLeft = collection[index].styleMarginLeft;
17329
17396
  temp.style.listStyleType = collection[index].listStyleTypeName;
17330
17397
  }
17331
17398
  else if (collection[index].nestedLevel === pLevel) {
@@ -17656,7 +17723,7 @@ class EditorManager {
17656
17723
  this.observer.notify(SELECTION_TYPE, { subCommand: value, event: event, callBack: callBack, value: text, selector: selector, enterAction: enterAction });
17657
17724
  break;
17658
17725
  case 'inserthtml':
17659
- 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 });
17660
17727
  break;
17661
17728
  case 'inserttext':
17662
17729
  this.observer.notify(INSERT_TEXT_TYPE, { subCommand: value, callBack: callBack, value: text });
@@ -17862,7 +17929,7 @@ class ToolbarStatus {
17862
17929
  formatCollection.fontname = this.isFontName(docElement, node, fontName);
17863
17930
  }
17864
17931
  if (!formatCollection.fontsize) {
17865
- formatCollection.fontsize = this.isFontSize(node, fontSize);
17932
+ formatCollection.fontsize = this.isFontSize(docElement, node, fontSize);
17866
17933
  }
17867
17934
  if (!formatCollection.backgroundcolor) {
17868
17935
  formatCollection.backgroundcolor = this.isBackgroundColor(node);
@@ -17922,8 +17989,12 @@ class ToolbarStatus {
17922
17989
  return null;
17923
17990
  }
17924
17991
  }
17925
- static isFontSize(node, fontSize) {
17926
- const size = node.style && node.style.fontSize;
17992
+ static isFontSize(docElement, node, fontSize) {
17993
+ let size = node.style && node.style.fontSize;
17994
+ if ((size === null || size === undefined || size === '') && node.nodeType !== 3 &&
17995
+ node.parentElement.classList.contains('e-content')) {
17996
+ size = this.getComputedStyle(docElement, node, 'font-size');
17997
+ }
17927
17998
  if ((size !== null && size !== '' && size !== undefined)
17928
17999
  && (fontSize === null || fontSize === undefined || (fontSize.indexOf(size) > -1))) {
17929
18000
  return size;
@@ -19938,7 +20009,7 @@ class PasteCleanup {
19938
20009
  this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, (returnArgs) => {
19939
20010
  extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
19940
20011
  this.parent.formatter.onSuccess(this.parent, args);
19941
- }, clipBoardElem);
20012
+ }, clipBoardElem, null, null, this.parent.enterKey);
19942
20013
  this.removeTempClass();
19943
20014
  this.parent.notify(toolbarRefresh, {});
19944
20015
  this.imgUploading(this.parent.inputElement);
@@ -20007,7 +20078,7 @@ class PasteCleanup {
20007
20078
  this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, (returnArgs) => {
20008
20079
  extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
20009
20080
  this.parent.formatter.onSuccess(this.parent, args);
20010
- }, clipBoardElem);
20081
+ }, clipBoardElem, null, null, this.parent.enterKey);
20011
20082
  this.removeTempClass();
20012
20083
  }
20013
20084
  else {
@@ -27214,12 +27285,14 @@ class Table {
27214
27285
  if ((totalwid - actualwid) > 20 && actualwid > 20) {
27215
27286
  const leftColumnWidth = totalwid - actualwid;
27216
27287
  const rightColWidth = actualwid;
27217
- if (!isNullOrUndefined(this.curTable.rows[i].cells[this.colIndex - 1])) {
27218
- this.curTable.rows[i].cells[this.colIndex - 1].style.width =
27288
+ const index = this.curTable.rows[i].cells[i].hasAttribute('colspan') ?
27289
+ parseInt(this.curTable.rows[i].cells[i].getAttribute('colspan'), 10) - 1 : this.colIndex;
27290
+ if (!isNullOrUndefined(this.curTable.rows[i].cells[index - 1])) {
27291
+ this.curTable.rows[i].cells[index - 1].style.width =
27219
27292
  this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
27220
27293
  }
27221
- if (!isNullOrUndefined(this.curTable.rows[i].cells[this.colIndex])) {
27222
- this.curTable.rows[i].cells[this.colIndex].style.width =
27294
+ if (!isNullOrUndefined(this.curTable.rows[i].cells[index])) {
27295
+ this.curTable.rows[i].cells[index].style.width =
27223
27296
  this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
27224
27297
  }
27225
27298
  }
@@ -28526,7 +28599,16 @@ class EnterKeyAction {
28526
28599
  this.parent.tableModule.removeResizeElement();
28527
28600
  }
28528
28601
  if (!(this.parent.inputElement.childNodes.length === 1 && this.parent.inputElement.childNodes[0].nodeName === 'TABLE')) {
28529
- 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
+ }
28530
28612
  }
28531
28613
  this.getRangeNode();
28532
28614
  }
@@ -28742,16 +28824,20 @@ class EnterKeyAction {
28742
28824
  }
28743
28825
  this.removeBRElement(currentParent);
28744
28826
  let currentParentLastChild = currentParent.lastChild;
28745
- while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text' || currentParentLastChild.nodeName === 'BR')) {
28827
+ while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text' || currentParentLastChild.nodeName === 'BR'
28828
+ || currentParentLastChild.nodeName === 'IMG')) {
28746
28829
  currentParentLastChild = currentParentLastChild.lastChild;
28747
28830
  }
28748
28831
  const isLastNodeLength = this.range.startContainer === currentParentLastChild ?
28749
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'));
28750
28835
  if (currentParent !== this.parent.inputElement &&
28751
28836
  this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
28752
28837
  this.range.startOffset === this.range.endOffset &&
28753
- this.range.startOffset === isLastNodeLength) {
28754
- const focusBRElem = this.parent.createElement('br');
28838
+ (this.range.startOffset === isLastNodeLength ||
28839
+ (currentParent.textContent.trim().length === 0 && isImageElement))) {
28840
+ let focusBRElem = this.parent.createElement('br');
28755
28841
  if (this.range.startOffset === 0 && this.range.startContainer.nodeName === 'TABLE') {
28756
28842
  this.range.startContainer.parentElement.insertBefore(focusBRElem, this.range.startContainer);
28757
28843
  }
@@ -28759,6 +28845,12 @@ class EnterKeyAction {
28759
28845
  if (currentParentLastChild.nodeName === 'BR' && currentParent.textContent.length === 0) {
28760
28846
  this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, currentParentLastChild);
28761
28847
  }
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;
28853
+ }
28762
28854
  else {
28763
28855
  const lineBreakBRElem = this.parent.createElement('br');
28764
28856
  this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, this.range.startContainer);
@@ -29441,15 +29533,16 @@ let RichTextEditor = class RichTextEditor extends Component {
29441
29533
  const currentEndContainer = range.endContainer;
29442
29534
  const currentStartOffset = range.startOffset;
29443
29535
  const isSameContainer = currentStartContainer === currentEndContainer ? true : false;
29444
- const currentEndOffset = currentEndContainer.textContent.length;
29445
29536
  const endNode = range.endContainer.nodeName === '#text' ? range.endContainer.parentElement :
29446
29537
  range.endContainer;
29447
29538
  const closestLI = closest(endNode, 'LI');
29539
+ let isDetached = false;
29448
29540
  if (!isNullOrUndefined(closestLI) && endNode.textContent.length === range.endOffset &&
29449
29541
  !range.collapsed && isNullOrUndefined(endNode.nextElementSibling)) {
29450
29542
  for (let i = 0; i < closestLI.childNodes.length; i++) {
29451
29543
  if (closestLI.childNodes[i].nodeName === '#text' && closestLI.childNodes[i].textContent.trim().length === 0) {
29452
29544
  detach(closestLI.childNodes[i]);
29545
+ isDetached = true;
29453
29546
  i--;
29454
29547
  }
29455
29548
  }
@@ -29457,7 +29550,11 @@ let RichTextEditor = class RichTextEditor extends Component {
29457
29550
  while (currentLastElem.lastChild !== null && currentLastElem.nodeName !== '#text') {
29458
29551
  currentLastElem = currentLastElem.lastChild;
29459
29552
  }
29460
- 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
+ }
29461
29558
  }
29462
29559
  }
29463
29560
  /**
@@ -30813,7 +30910,9 @@ let RichTextEditor = class RichTextEditor extends Component {
30813
30910
  this.notify(windowResize, null);
30814
30911
  }
30815
30912
  scrollHandler(e) {
30816
- this.notify(scroll, { args: e });
30913
+ if (this.element) {
30914
+ this.notify(scroll, { args: e });
30915
+ }
30817
30916
  }
30818
30917
  contentScrollHandler(e) {
30819
30918
  this.notify(contentscroll, { args: e });