@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.
@@ -5007,6 +5007,11 @@ var Toolbar$2 = /** @__PURE__ @class */ (function () {
5007
5007
  Toolbar$$1.prototype.toolbarClickHandler = function (e) {
5008
5008
  var trg = closest(e.originalEvent.target, '.e-hor-nav');
5009
5009
  if (trg && this.parent.toolbarSettings.type === ToolbarType.Expand && !isNullOrUndefined(trg)) {
5010
+ var extendedTbar = this.tbElement.querySelector('.e-toolbar-extended');
5011
+ if (!isNullOrUndefined(extendedTbar)) {
5012
+ setStyleAttribute(extendedTbar, { maxHeight: '', display: 'block' });
5013
+ setStyleAttribute(extendedTbar, { maxHeight: extendedTbar.offsetHeight + 'px', display: '' });
5014
+ }
5010
5015
  if (!trg.classList.contains('e-nav-active')) {
5011
5016
  removeClass([this.tbElement], [CLS_EXPAND_OPEN]);
5012
5017
  this.parent.setContentHeight('toolbar', false);
@@ -6343,10 +6348,17 @@ var QuickToolbar = /** @__PURE__ @class */ (function () {
6343
6348
  };
6344
6349
  QuickToolbar.prototype.keyUpHandler = function (e) {
6345
6350
  if (this.parent.inlineMode.enable && !Browser.isDevice) {
6351
+ var args = e.args;
6346
6352
  if (this.parent.inlineMode.onSelection) {
6353
+ if (this.parent.getSelection().length > 0) {
6354
+ if ((args.ctrlKey && args.keyCode === 65) || (args.shiftKey && (args.keyCode === 33 || args.keyCode === 34 ||
6355
+ args.keyCode === 35 || args.keyCode === 36 || args.keyCode === 37 || args.keyCode === 38 ||
6356
+ args.keyCode === 39 || args.keyCode === 40))) {
6357
+ this.showInlineQTBar(this.offsetX, this.offsetY, args.target);
6358
+ }
6359
+ }
6347
6360
  return;
6348
6361
  }
6349
- var args = e.args;
6350
6362
  this.deBounce(this.offsetX, this.offsetY, args.target);
6351
6363
  }
6352
6364
  };
@@ -7006,7 +7018,7 @@ function setEditFrameFocus(editableElement, selector) {
7006
7018
  * @returns {void}
7007
7019
  * @hidden
7008
7020
  */
7009
- function updateTextNode$1(value) {
7021
+ function updateTextNode$1(value, enterAction) {
7010
7022
  var tempNode = document.createElement('div');
7011
7023
  tempNode.innerHTML = value;
7012
7024
  tempNode.setAttribute('class', 'tempDiv');
@@ -7021,15 +7033,23 @@ function updateTextNode$1(value) {
7021
7033
  (tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
7022
7034
  inlineNode$1.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0) {
7023
7035
  if (!isPreviousInlineElem) {
7024
- paraElm = createElement('p');
7025
- resultElm.appendChild(paraElm);
7026
- paraElm.appendChild(tempNode.firstChild);
7036
+ if (enterAction === 'BR') {
7037
+ resultElm.appendChild(tempNode.firstChild);
7038
+ previousParent = resultElm;
7039
+ }
7040
+ else {
7041
+ paraElm = createElement('p');
7042
+ resultElm.appendChild(paraElm);
7043
+ paraElm.appendChild(tempNode.firstChild);
7044
+ previousParent = paraElm;
7045
+ isPreviousInlineElem = true;
7046
+ }
7027
7047
  }
7028
7048
  else {
7029
7049
  previousParent.appendChild(tempNode.firstChild);
7050
+ previousParent = paraElm;
7051
+ isPreviousInlineElem = true;
7030
7052
  }
7031
- previousParent = paraElm;
7032
- isPreviousInlineElem = true;
7033
7053
  }
7034
7054
  else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
7035
7055
  (tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
@@ -12719,7 +12739,7 @@ var Formats = /** @__PURE__ @class */ (function () {
12719
12739
  var InsertHtml = /** @__PURE__ @class */ (function () {
12720
12740
  function InsertHtml() {
12721
12741
  }
12722
- InsertHtml.Insert = function (docElement, insertNode, editNode, isExternal) {
12742
+ InsertHtml.Insert = function (docElement, insertNode, editNode, isExternal, enterAction) {
12723
12743
  var node;
12724
12744
  if (typeof insertNode === 'string') {
12725
12745
  var divNode = document.createElement('div');
@@ -12741,7 +12761,8 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
12741
12761
  var nodeCutter = new NodeCutter();
12742
12762
  var range = nodeSelection.getRange(docElement);
12743
12763
  if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
12744
- range.startOffset === range.endOffset && editNode.textContent.length === 0 && editNode.children[0].tagName === 'P') {
12764
+ range.startOffset === range.endOffset && editNode.textContent.length === 0 &&
12765
+ (editNode.children[0].tagName === 'P' || (editNode.children[0].tagName === 'BR'))) {
12745
12766
  nodeSelection.setSelectionText(docElement, range.startContainer.children[0], range.startContainer.children[0], 0, 0);
12746
12767
  range = nodeSelection.getRange(docElement);
12747
12768
  }
@@ -12758,7 +12779,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
12758
12779
  var closestParentNode = (node.nodeName.toLowerCase() === 'table') ? this.closestEle(nodes[0].parentNode, editNode) : nodes[0];
12759
12780
  if (isExternal || (!isNullOrUndefined(node) && !isNullOrUndefined(node.classList) &&
12760
12781
  node.classList.contains('pasteContent'))) {
12761
- this.pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode);
12782
+ this.pasteInsertHTML(nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction);
12762
12783
  return;
12763
12784
  }
12764
12785
  if (editNode !== range.startContainer && ((!isCollapsed && !(closestParentNode.nodeType === Node.ELEMENT_NODE &&
@@ -12872,7 +12893,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
12872
12893
  }
12873
12894
  }
12874
12895
  };
12875
- InsertHtml.pasteInsertHTML = function (nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode) {
12896
+ InsertHtml.pasteInsertHTML = function (nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction) {
12876
12897
  var isCursor = range.startOffset === range.endOffset &&
12877
12898
  range.startContainer === range.endContainer;
12878
12899
  if (isCursor && range.startContainer === editNode && editNode.textContent === '') {
@@ -12982,7 +13003,12 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
12982
13003
  var firstParaElm = createElement('p');
12983
13004
  node.parentElement.insertBefore(firstParaElm, node);
12984
13005
  }
12985
- node.previousElementSibling.appendChild(node.firstChild);
13006
+ if (node.previousElementSibling.nodeName === 'BR') {
13007
+ node.parentElement.insertBefore(node.firstChild, node);
13008
+ }
13009
+ else {
13010
+ node.previousElementSibling.appendChild(node.firstChild);
13011
+ }
12986
13012
  }
12987
13013
  else {
12988
13014
  lastSelectionNode = node.firstChild;
@@ -13014,7 +13040,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
13014
13040
  this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
13015
13041
  }
13016
13042
  else {
13017
- this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode);
13043
+ this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
13018
13044
  }
13019
13045
  };
13020
13046
  InsertHtml.placeCursorEnd = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
@@ -13129,9 +13155,9 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
13129
13155
  }
13130
13156
  }
13131
13157
  };
13132
- InsertHtml.cursorPos = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
13158
+ InsertHtml.cursorPos = function (lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction) {
13133
13159
  lastSelectionNode.classList.add('lastNode');
13134
- editNode.innerHTML = updateTextNode$1(editNode.innerHTML);
13160
+ editNode.innerHTML = updateTextNode$1(editNode.innerHTML, enterAction);
13135
13161
  lastSelectionNode = editNode.querySelector('.lastNode');
13136
13162
  if (!isNullOrUndefined(lastSelectionNode)) {
13137
13163
  this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
@@ -16324,7 +16350,7 @@ var InsertHtmlExec = /** @__PURE__ @class */ (function () {
16324
16350
  this.parent.observer.on(INSERTHTML_TYPE, this.applyHtml, this);
16325
16351
  };
16326
16352
  InsertHtmlExec.prototype.applyHtml = function (e) {
16327
- InsertHtml.Insert(this.parent.currentDocument, e.value, this.parent.editableElement, true);
16353
+ InsertHtml.Insert(this.parent.currentDocument, e.value, this.parent.editableElement, true, e.enterAction);
16328
16354
  if (e.subCommand === 'pasteCleanup') {
16329
16355
  var pastedElements = this.parent.editableElement.querySelectorAll('.pasteContent_RTE');
16330
16356
  var allPastedElements = [].slice.call(pastedElements);
@@ -16968,7 +16994,10 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
16968
16994
  this.checkVShape(elm);
16969
16995
  var imgElem = elm.querySelectorAll('img');
16970
16996
  for (var i = 0; i < imgElem.length; i++) {
16971
- if (!isNullOrUndefined(imgElem[i].getAttribute('v:shapes')) && imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0 && imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0) {
16997
+ if (!isNullOrUndefined(imgElem[i].getAttribute('v:shapes')) &&
16998
+ imgElem[i].getAttribute('v:shapes').indexOf('Picture') < 0 &&
16999
+ imgElem[i].getAttribute('v:shapes').indexOf('圖片') < 0 &&
17000
+ imgElem[i].getAttribute('v:shapes').indexOf('Image') < 0) {
16972
17001
  detach(imgElem[i]);
16973
17002
  }
16974
17003
  }
@@ -17219,6 +17248,29 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
17219
17248
  }
17220
17249
  fromClass = false;
17221
17250
  }
17251
+ var listClass = ['MsoListParagraphCxSpFirst', 'MsoListParagraphCxSpMiddle', 'MsoListParagraphCxSpLast'];
17252
+ for (var i = 0; i < listClass.length; i++) {
17253
+ if (keys.indexOf('li.' + listClass[i]) > -1) {
17254
+ var olULElems = elm.querySelectorAll('ol.' + listClass[i] + ', ul.' + listClass[i]);
17255
+ for (var j = 0; j < olULElems.length; j++) {
17256
+ var styleProperty = olULElems[j].getAttribute('style');
17257
+ if (!isNullOrUndefined(styleProperty) && styleProperty.trim() !== '' && olULElems[j].style.marginLeft !== '') {
17258
+ var valueSplit = values[keys.indexOf('li.' + listClass[i])].split(';');
17259
+ for (var k = 0; k < valueSplit.length; k++) {
17260
+ if ('margin-left'.indexOf(valueSplit[k].split(':')[0]) >= 0) {
17261
+ if (!isNullOrUndefined(valueSplit[k].split(':')[1]) &&
17262
+ valueSplit[k].split(':')[1].indexOf('in') >= 0 &&
17263
+ olULElems[j].style.marginLeft.indexOf('in') >= 0) {
17264
+ var classStyle = parseFloat(valueSplit[k].split(':')[1].split('in')[0]);
17265
+ var inlineStyle = parseFloat(olULElems[j].style.marginLeft.split('in')[0]);
17266
+ olULElems[j].style.marginLeft = (inlineStyle - classStyle) + 'in';
17267
+ }
17268
+ }
17269
+ }
17270
+ }
17271
+ }
17272
+ }
17273
+ }
17222
17274
  }
17223
17275
  };
17224
17276
  MsWordPaste.prototype.filterStyles = function (elm, wordPasteStyleConfig) {
@@ -17339,12 +17391,13 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
17339
17391
  var type = void 0;
17340
17392
  var listStyleType = void 0;
17341
17393
  var startAttr = void 0;
17394
+ var styleMarginLeft = void 0;
17342
17395
  if (!isNullOrUndefined(this.listContents[0])) {
17343
17396
  type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
17344
17397
  listStyleType = this.getlistStyleType(this.listContents[0], type);
17345
- if (type === 'ol' && listNodes[i - 1] === null) {
17398
+ if (type === 'ol' && (i === 0 || listNodes[i - 1] === null)) {
17346
17399
  var startString = this.listContents[0].split('.')[0];
17347
- var listTypes = ['A', 'a', 'I', 'i', 'α', '1'];
17400
+ var listTypes = ['A', 'a', 'I', 'i', 'α', '1', '1-']; // Add '1-' for rare list type.
17348
17401
  if (listTypes.indexOf(startString) === -1) {
17349
17402
  if (listStyleType === 'decimal') {
17350
17403
  // Bug in getlistStyleType() list style stype is returned as decimal for nested list with start attribute
@@ -17352,9 +17405,15 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
17352
17405
  startAttr = parseInt(startString);
17353
17406
  }
17354
17407
  }
17355
- else if (listStyleType === 'upper-alpha' || listStyleType === 'lower-alpha') {
17356
- startAttr = parseInt(startString.toLowerCase()) - 96;
17408
+ else if (listStyleType === 'upper-alpha') {
17409
+ startAttr = (startString.split('.')[0].charCodeAt(0) - 64);
17357
17410
  }
17411
+ else if (listStyleType === 'lower-alpha') {
17412
+ startAttr = (startString.split('.')[0].charCodeAt(0) - 96);
17413
+ }
17414
+ }
17415
+ if (listNodes[i].style.marginLeft !== '') {
17416
+ styleMarginLeft = listNodes[i].style.marginLeft;
17358
17417
  }
17359
17418
  }
17360
17419
  var tempNode = [];
@@ -17373,7 +17432,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
17373
17432
  }
17374
17433
  }
17375
17434
  collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
17376
- listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr });
17435
+ listStyle: currentListStyle, listStyleTypeName: listStyleType, start: startAttr, styleMarginLeft: styleMarginLeft });
17377
17436
  }
17378
17437
  }
17379
17438
  stNode = listNodes.shift();
@@ -17399,23 +17458,30 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
17399
17458
  };
17400
17459
  MsWordPaste.prototype.getlistStyleType = function (listContent, type) {
17401
17460
  var currentListClass;
17461
+ var upperRomanNumber = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX',
17462
+ 'X', 'XI', 'XII', 'XIII', 'XIV', 'XV', 'XVI', 'XVII', 'XVIII', 'XIX', 'XX'];
17463
+ var lowerRomanNumber = ['i', 'ii', 'iii', 'iv', 'v', 'vi', 'vii', 'viii', 'ix',
17464
+ 'x', 'xi', 'xii', 'xiii', 'xiv', 'xv', 'xvi', 'xvii', 'xviii', 'xix', 'xx'];
17465
+ var lowerGreekNumber = ['α', 'β', 'γ', 'δ', 'ε', 'ζ', 'η', 'θ', 'ι', 'κ', 'λ',
17466
+ 'μ', 'ν', 'ξ', 'ο', 'π', 'ρ', 'σ', 'τ', 'υ', 'φ', 'χ', 'ψ', 'ω'];
17402
17467
  if (type === 'ol') {
17403
- switch (listContent.split('.')[0]) {
17404
- case 'A':
17405
- currentListClass = 'upper-alpha';
17406
- break;
17407
- case 'a':
17408
- currentListClass = 'lower-alpha';
17409
- break;
17410
- case 'I':
17468
+ var charCode = listContent.split('.')[0].charCodeAt(0);
17469
+ switch (true) {
17470
+ case upperRomanNumber.indexOf(listContent.split('.')[0]) > -1:
17411
17471
  currentListClass = 'upper-roman';
17412
17472
  break;
17413
- case 'i':
17473
+ case lowerRomanNumber.indexOf(listContent.split('.')[0]) > -1:
17414
17474
  currentListClass = 'lower-roman';
17415
17475
  break;
17416
- case 'α':
17476
+ case lowerGreekNumber.indexOf(listContent.split('.')[0]) > -1:
17417
17477
  currentListClass = 'lower-greek';
17418
17478
  break;
17479
+ case (charCode > 64 && charCode < 91):
17480
+ currentListClass = 'upper-alpha';
17481
+ break;
17482
+ case (charCode > 96 && charCode < 123):
17483
+ currentListClass = 'lower-alpha';
17484
+ break;
17419
17485
  default:
17420
17486
  currentListClass = 'decimal';
17421
17487
  break;
@@ -17447,11 +17513,12 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
17447
17513
  var pElement = createElement('p');
17448
17514
  pElement.innerHTML = collection[index].content.join(' ');
17449
17515
  if ((collection[index].nestedLevel === 1) && listCount === 0 && collection[index].content) {
17450
- root.appendChild(temp = createElement(collection[index].listType));
17516
+ root.appendChild(temp = createElement(collection[index].listType, { className: collection[index].class }));
17451
17517
  prevList = createElement('li');
17452
17518
  prevList.appendChild(pElement);
17453
17519
  temp.appendChild(prevList);
17454
17520
  temp.setAttribute('level', collection[index].nestedLevel.toString());
17521
+ temp.style.marginLeft = collection[index].styleMarginLeft;
17455
17522
  temp.style.listStyleType = collection[index].listStyleTypeName;
17456
17523
  }
17457
17524
  else if (collection[index].nestedLevel === pLevel) {
@@ -17784,7 +17851,7 @@ var EditorManager = /** @__PURE__ @class */ (function () {
17784
17851
  this.observer.notify(SELECTION_TYPE, { subCommand: value, event: event, callBack: callBack, value: text, selector: selector, enterAction: enterAction });
17785
17852
  break;
17786
17853
  case 'inserthtml':
17787
- this.observer.notify(INSERTHTML_TYPE, { subCommand: value, callBack: callBack, value: text });
17854
+ this.observer.notify(INSERTHTML_TYPE, { subCommand: value, callBack: callBack, value: text, enterAction: enterAction });
17788
17855
  break;
17789
17856
  case 'inserttext':
17790
17857
  this.observer.notify(INSERT_TEXT_TYPE, { subCommand: value, callBack: callBack, value: text });
@@ -18009,7 +18076,7 @@ var ToolbarStatus = /** @__PURE__ @class */ (function () {
18009
18076
  formatCollection.fontname = this.isFontName(docElement, node, fontName);
18010
18077
  }
18011
18078
  if (!formatCollection.fontsize) {
18012
- formatCollection.fontsize = this.isFontSize(node, fontSize);
18079
+ formatCollection.fontsize = this.isFontSize(docElement, node, fontSize);
18013
18080
  }
18014
18081
  if (!formatCollection.backgroundcolor) {
18015
18082
  formatCollection.backgroundcolor = this.isBackgroundColor(node);
@@ -18069,8 +18136,12 @@ var ToolbarStatus = /** @__PURE__ @class */ (function () {
18069
18136
  return null;
18070
18137
  }
18071
18138
  };
18072
- ToolbarStatus.isFontSize = function (node, fontSize) {
18139
+ ToolbarStatus.isFontSize = function (docElement, node, fontSize) {
18073
18140
  var size = node.style && node.style.fontSize;
18141
+ if ((size === null || size === undefined || size === '') && node.nodeType !== 3 &&
18142
+ node.parentElement.classList.contains('e-content')) {
18143
+ size = this.getComputedStyle(docElement, node, 'font-size');
18144
+ }
18074
18145
  if ((size !== null && size !== '' && size !== undefined)
18075
18146
  && (fontSize === null || fontSize === undefined || (fontSize.indexOf(size) > -1))) {
18076
18147
  return size;
@@ -20018,7 +20089,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
20018
20089
  this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, function (returnArgs) {
20019
20090
  extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
20020
20091
  _this.parent.formatter.onSuccess(_this.parent, args);
20021
- }, clipBoardElem);
20092
+ }, clipBoardElem, null, null, this.parent.enterKey);
20022
20093
  this.removeTempClass();
20023
20094
  this.parent.notify(toolbarRefresh, {});
20024
20095
  this.imgUploading(this.parent.inputElement);
@@ -20088,7 +20159,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
20088
20159
  this.parent.formatter.editorManager.execCommand('inserthtml', 'pasteCleanup', args, function (returnArgs) {
20089
20160
  extend(args, { elements: returnArgs.elements, imageElements: returnArgs.imgElem }, true);
20090
20161
  _this.parent.formatter.onSuccess(_this.parent, args);
20091
- }, clipBoardElem);
20162
+ }, clipBoardElem, null, null, this.parent.enterKey);
20092
20163
  this.removeTempClass();
20093
20164
  }
20094
20165
  else {
@@ -27342,12 +27413,14 @@ var Table = /** @__PURE__ @class */ (function () {
27342
27413
  if ((totalwid - actualwid) > 20 && actualwid > 20) {
27343
27414
  var leftColumnWidth = totalwid - actualwid;
27344
27415
  var rightColWidth = actualwid;
27345
- if (!isNullOrUndefined(_this.curTable.rows[i].cells[_this.colIndex - 1])) {
27346
- _this.curTable.rows[i].cells[_this.colIndex - 1].style.width =
27416
+ var index = _this.curTable.rows[i].cells[i].hasAttribute('colspan') ?
27417
+ parseInt(_this.curTable.rows[i].cells[i].getAttribute('colspan'), 10) - 1 : _this.colIndex;
27418
+ if (!isNullOrUndefined(_this.curTable.rows[i].cells[index - 1])) {
27419
+ _this.curTable.rows[i].cells[index - 1].style.width =
27347
27420
  _this.convertPixelToPercentage(leftColumnWidth, tableWidth) + '%';
27348
27421
  }
27349
- if (!isNullOrUndefined(_this.curTable.rows[i].cells[_this.colIndex])) {
27350
- _this.curTable.rows[i].cells[_this.colIndex].style.width =
27422
+ if (!isNullOrUndefined(_this.curTable.rows[i].cells[index])) {
27423
+ _this.curTable.rows[i].cells[index].style.width =
27351
27424
  _this.convertPixelToPercentage(rightColWidth, tableWidth) + '%';
27352
27425
  }
27353
27426
  }
@@ -28789,7 +28862,16 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
28789
28862
  _this.parent.tableModule.removeResizeElement();
28790
28863
  }
28791
28864
  if (!(_this.parent.inputElement.childNodes.length === 1 && _this.parent.inputElement.childNodes[0].nodeName === 'TABLE')) {
28792
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.range.startContainer.childNodes[_this.range.startOffset], 0);
28865
+ if (isNullOrUndefined(_this.range.startContainer.childNodes[_this.range.startOffset])) {
28866
+ var currentLastElem = _this.range.startContainer.childNodes[_this.range.startOffset - 1];
28867
+ while (currentLastElem.lastChild !== null && currentLastElem.nodeName !== '#text') {
28868
+ currentLastElem = currentLastElem.lastChild;
28869
+ }
28870
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), currentLastElem, (currentLastElem.nodeName === 'BR' ? 0 : currentLastElem.textContent.length));
28871
+ }
28872
+ else {
28873
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.range.startContainer.childNodes[_this.range.startOffset], 0);
28874
+ }
28793
28875
  }
28794
28876
  _this.getRangeNode();
28795
28877
  }
@@ -29005,15 +29087,19 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
29005
29087
  }
29006
29088
  _this.removeBRElement(currentParent);
29007
29089
  var currentParentLastChild = currentParent.lastChild;
29008
- while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text' || currentParentLastChild.nodeName === 'BR')) {
29090
+ while (!isNullOrUndefined(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text' || currentParentLastChild.nodeName === 'BR'
29091
+ || currentParentLastChild.nodeName === 'IMG')) {
29009
29092
  currentParentLastChild = currentParentLastChild.lastChild;
29010
29093
  }
29011
29094
  var isLastNodeLength = _this.range.startContainer === currentParentLastChild ?
29012
29095
  _this.range.startContainer.textContent.length : currentParent.textContent.length;
29096
+ var isImageElement = (_this.range.startContainer.nodeName === 'IMG' || (_this.range.startContainer.childNodes.length > 0
29097
+ && _this.range.startContainer.childNodes[_this.range.startOffset].nodeName === 'IMG'));
29013
29098
  if (currentParent !== _this.parent.inputElement &&
29014
29099
  _this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
29015
29100
  _this.range.startOffset === _this.range.endOffset &&
29016
- _this.range.startOffset === isLastNodeLength) {
29101
+ (_this.range.startOffset === isLastNodeLength ||
29102
+ (currentParent.textContent.trim().length === 0 && isImageElement))) {
29017
29103
  var focusBRElem = _this.parent.createElement('br');
29018
29104
  if (_this.range.startOffset === 0 && _this.range.startContainer.nodeName === 'TABLE') {
29019
29105
  _this.range.startContainer.parentElement.insertBefore(focusBRElem, _this.range.startContainer);
@@ -29022,6 +29108,12 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
29022
29108
  if (currentParentLastChild.nodeName === 'BR' && currentParent.textContent.length === 0) {
29023
29109
  _this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, currentParentLastChild);
29024
29110
  }
29111
+ else if (_this.range.startOffset === 0 && _this.range.endOffset === 0 && isImageElement) {
29112
+ var imageElement = _this.range.startContainer.nodeName === 'IMG' ? _this.range.startContainer :
29113
+ _this.range.startContainer.childNodes[_this.range.startOffset];
29114
+ currentParent.insertBefore(focusBRElem, imageElement);
29115
+ focusBRElem = imageElement;
29116
+ }
29025
29117
  else {
29026
29118
  var lineBreakBRElem = _this.parent.createElement('br');
29027
29119
  _this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, _this.range.startContainer);
@@ -29732,15 +29824,16 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
29732
29824
  var currentEndContainer = range.endContainer;
29733
29825
  var currentStartOffset = range.startOffset;
29734
29826
  var isSameContainer = currentStartContainer === currentEndContainer ? true : false;
29735
- var currentEndOffset = currentEndContainer.textContent.length;
29736
29827
  var endNode = range.endContainer.nodeName === '#text' ? range.endContainer.parentElement :
29737
29828
  range.endContainer;
29738
29829
  var closestLI = closest(endNode, 'LI');
29830
+ var isDetached = false;
29739
29831
  if (!isNullOrUndefined(closestLI) && endNode.textContent.length === range.endOffset &&
29740
29832
  !range.collapsed && isNullOrUndefined(endNode.nextElementSibling)) {
29741
29833
  for (var i = 0; i < closestLI.childNodes.length; i++) {
29742
29834
  if (closestLI.childNodes[i].nodeName === '#text' && closestLI.childNodes[i].textContent.trim().length === 0) {
29743
29835
  detach(closestLI.childNodes[i]);
29836
+ isDetached = true;
29744
29837
  i--;
29745
29838
  }
29746
29839
  }
@@ -29748,7 +29841,11 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
29748
29841
  while (currentLastElem.lastChild !== null && currentLastElem.nodeName !== '#text') {
29749
29842
  currentLastElem = currentLastElem.lastChild;
29750
29843
  }
29751
- 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));
29844
+ if (isDetached) {
29845
+ var currentLast = currentLastElem.nodeName === 'BR' && !isNullOrUndefined(currentLastElem.previousSibling) ?
29846
+ currentLastElem.previousSibling : currentLastElem;
29847
+ this.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), isSameContainer ? currentLast : currentStartContainer, currentLast, currentStartOffset, (currentLast.nodeName === 'BR' ? 0 : currentLast.textContent.length));
29848
+ }
29752
29849
  }
29753
29850
  };
29754
29851
  /**
@@ -31108,7 +31205,9 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
31108
31205
  this.notify(windowResize, null);
31109
31206
  };
31110
31207
  RichTextEditor.prototype.scrollHandler = function (e) {
31111
- this.notify(scroll, { args: e });
31208
+ if (this.element) {
31209
+ this.notify(scroll, { args: e });
31210
+ }
31112
31211
  };
31113
31212
  RichTextEditor.prototype.contentScrollHandler = function (e) {
31114
31213
  this.notify(contentscroll, { args: e });