@syncfusion/ej2-richtexteditor 19.3.57 → 19.4.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +41 -0
  2. package/.github/PULL_REQUEST_TEMPLATE/Feature.md +27 -0
  3. package/CHANGELOG.md +24 -12
  4. package/README.md +1 -1
  5. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  6. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es2015.js +150 -62
  8. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  9. package/dist/es6/ej2-richtexteditor.es5.js +149 -61
  10. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  11. package/dist/global/ej2-richtexteditor.min.js +2 -2
  12. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  13. package/dist/global/index.d.ts +1 -1
  14. package/package.json +12 -12
  15. package/src/editor-manager/plugin/lists.js +4 -2
  16. package/src/editor-manager/plugin/ms-word-clean-up.d.ts +1 -1
  17. package/src/editor-manager/plugin/ms-word-clean-up.js +54 -20
  18. package/src/editor-manager/plugin/selection-commands.js +10 -5
  19. package/src/editor-manager/plugin/undo.js +10 -1
  20. package/src/rich-text-editor/actions/color-picker.d.ts +1 -0
  21. package/src/rich-text-editor/actions/color-picker.js +2 -1
  22. package/src/rich-text-editor/actions/dropdown-buttons.js +0 -10
  23. package/src/rich-text-editor/actions/enter-key.js +55 -11
  24. package/src/rich-text-editor/actions/html-editor.js +3 -2
  25. package/src/rich-text-editor/actions/xhtml-validation.js +1 -1
  26. package/src/rich-text-editor/base/interface.d.ts +1 -1
  27. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +1 -1
  28. package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -1
  29. package/src/rich-text-editor/base/rich-text-editor.js +2 -2
  30. package/src/rich-text-editor/models/toolbar-settings-model.d.ts +1 -1
  31. package/src/rich-text-editor/models/toolbar-settings.d.ts +1 -1
  32. package/src/rich-text-editor/models/toolbar-settings.js +1 -1
  33. package/src/rich-text-editor/renderer/image-module.js +5 -4
  34. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +1 -1
  35. package/src/rich-text-editor/renderer/toolbar-renderer.js +3 -2
  36. package/styles/rich-text-editor/_fluent-definition.scss +168 -0
  37. package/styles/rich-text-editor/_layout.scss +1 -1
  38. package/styles/rich-text-editor/icons/_fluent.scss +303 -0
@@ -2968,7 +2968,7 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
2968
2968
  * @hidden
2969
2969
  * @deprecated
2970
2970
  */
2971
- ToolbarRenderer.prototype.renderColorPickerDropDown = function (args, item, colorPicker) {
2971
+ ToolbarRenderer.prototype.renderColorPickerDropDown = function (args, item, colorPicker, defaultColor) {
2972
2972
  var _this = this;
2973
2973
  // eslint-disable-next-line
2974
2974
  var proxy = this;
@@ -2977,8 +2977,9 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
2977
2977
  var content = proxy.parent.createElement('span', { className: CLS_COLOR_CONTENT });
2978
2978
  var inlineEle = proxy.parent.createElement('span', { className: args.cssClass });
2979
2979
  var range;
2980
+ var initialBackgroundColor = (isNullOrUndefined(defaultColor)) ? proxy.parent.backgroundColor.default : defaultColor;
2980
2981
  inlineEle.style.borderBottomColor = (item === 'backgroundcolor') ?
2981
- proxy.parent.backgroundColor.default : proxy.parent.fontColor.default;
2982
+ initialBackgroundColor : proxy.parent.fontColor.default;
2982
2983
  content.appendChild(inlineEle);
2983
2984
  var dropDown = new DropDownButton({
2984
2985
  target: colorPicker.element.parentElement, cssClass: css,
@@ -3606,11 +3607,6 @@ var DropDownButtons = /** @__PURE__ @class */ (function () {
3606
3607
  var prop = _a[_i];
3607
3608
  switch (prop) {
3608
3609
  case 'fontFamily':
3609
- if (this.parent.inlineMode.enable) {
3610
- if (!isNullOrUndefined(this.parent.fontFamily.default)) {
3611
- this.getEditNode().style.fontFamily = this.parent.fontFamily.default;
3612
- }
3613
- }
3614
3610
  if (this.fontNameDropDown) {
3615
3611
  for (var _b = 0, _c = Object.keys(newProp.fontFamily); _b < _c.length; _b++) {
3616
3612
  var fontFamily$$1 = _c[_b];
@@ -3642,11 +3638,6 @@ var DropDownButtons = /** @__PURE__ @class */ (function () {
3642
3638
  }
3643
3639
  break;
3644
3640
  case 'fontSize':
3645
- if (this.parent.inlineMode) {
3646
- if (!isNullOrUndefined(this.parent.fontSize.default)) {
3647
- this.getEditNode().style.fontSize = this.parent.fontSize.default;
3648
- }
3649
- }
3650
3641
  if (this.fontSizeDropDown) {
3651
3642
  for (var _d = 0, _e = Object.keys(newProp.fontSize); _d < _e.length; _d++) {
3652
3643
  var fontSize$$1 = _e[_d];
@@ -5040,7 +5031,7 @@ var ColorPickerInput = /** @__PURE__ @class */ (function () {
5040
5031
  target: (targetID)
5041
5032
  };
5042
5033
  _this.backgroundColorPicker = _this.toolbarRenderer.renderColorPicker(options, 'backgroundcolor');
5043
- _this.backgroundColorDropDown = _this.toolbarRenderer.renderColorPickerDropDown(options, 'backgroundcolor', _this.backgroundColorPicker);
5034
+ _this.backgroundColorDropDown = _this.toolbarRenderer.renderColorPickerDropDown(options, 'backgroundcolor', _this.backgroundColorPicker, _this.defaultColorPicker);
5044
5035
  break;
5045
5036
  }
5046
5037
  }
@@ -5075,6 +5066,7 @@ var ColorPickerInput = /** @__PURE__ @class */ (function () {
5075
5066
  if (this.backgroundColorDropDown && !this.backgroundColorDropDown.isDestroyed) {
5076
5067
  var innerEle = this.backgroundColorDropDown.element.querySelector('.e-rte-color-content');
5077
5068
  if (innerEle) {
5069
+ this.defaultColorPicker = innerEle.children[0].style.borderBottomColor;
5078
5070
  detach(innerEle);
5079
5071
  }
5080
5072
  this.backgroundColorDropDown.destroy();
@@ -10571,8 +10563,9 @@ var Lists = /** @__PURE__ @class */ (function () {
10571
10563
  Lists.prototype.testCurrentList = function (range) {
10572
10564
  var olListStartRegex = [/^[1]+[.]+$/, /^[i]+[.]+$/, /^[a]+[.]+$/];
10573
10565
  if (!isNullOrUndefined(range.startContainer.textContent.slice(0, range.startOffset))) {
10566
+ var currentContent = range.startContainer.textContent.replace(/\u200B/g, '').slice(0, range.startOffset).trim();
10574
10567
  for (var i = 0; i < olListStartRegex.length; i++) {
10575
- if (olListStartRegex[i].test(range.startContainer.textContent.replace(/\u200B/g, '').slice(0, range.startOffset).trim())) {
10568
+ if (olListStartRegex[i].test(currentContent) && currentContent.length === 2) {
10576
10569
  return true;
10577
10570
  }
10578
10571
  }
@@ -10614,7 +10607,8 @@ var Lists = /** @__PURE__ @class */ (function () {
10614
10607
  range.startContainer.parentElement.closest('LI');
10615
10608
  var endNode = range.endContainer.nodeName === 'LI' ? range.endContainer :
10616
10609
  range.endContainer.parentElement.closest('LI');
10617
- if (!isNullOrUndefined(startNode) && !isNullOrUndefined(endNode) && startNode === endNode && startNode.tagName === 'LI' && startNode.textContent.trim() === '') {
10610
+ if (!isNullOrUndefined(startNode) && !isNullOrUndefined(endNode) && startNode === endNode && startNode.tagName === 'LI' &&
10611
+ startNode.textContent.trim() === '' && startNode.querySelectorAll('IMG').length === 0) {
10618
10612
  if (startNode.textContent.charCodeAt(0) === 65279) {
10619
10613
  startNode.textContent = '';
10620
10614
  }
@@ -14613,6 +14607,9 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
14613
14607
  };
14614
14608
  SelectionCommands.removeFormat = function (nodes, index, formatNode, isCursor, isFormat, isFontStyle, range, nodeCutter, format, value, domSelection, endNode, domNode) {
14615
14609
  var splitNode = null;
14610
+ var startText = range.startContainer.nodeName === '#text' ?
14611
+ range.startContainer.textContent.substring(range.startOffset, range.startContainer.textContent.length) :
14612
+ range.startContainer.textContent;
14616
14613
  if (!(range.startContainer === range.endContainer && range.startOffset === 0
14617
14614
  && range.endOffset === range.startContainer.length)) {
14618
14615
  var nodeIndex = [];
@@ -14712,11 +14709,13 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
14712
14709
  for (var num = 0; num < child.length; num++) {
14713
14710
  if (child[num].nodeType !== 3 || (child[num].textContent && child[num].textContent.trim().length > 0)) {
14714
14711
  child[num] = InsertMethods.Wrap(child[num], this.GetFormatNode(format, value, formatNodeTagName, formatNodeStyles));
14715
- if (num === 0) {
14716
- range.setStartBefore(child[num]);
14717
- }
14718
- else if (num === child.length - 1) {
14719
- range.setEndAfter(child[num]);
14712
+ if (child[num].textContent === startText) {
14713
+ if (num === 0) {
14714
+ range.setStartBefore(child[num]);
14715
+ }
14716
+ else if (num === child.length - 1) {
14717
+ range.setEndAfter(child[num]);
14718
+ }
14720
14719
  }
14721
14720
  }
14722
14721
  }
@@ -15397,6 +15396,15 @@ var UndoRedoManager = /** @__PURE__ @class */ (function () {
15397
15396
  */
15398
15397
  UndoRedoManager.prototype.saveData = function (e) {
15399
15398
  var range = new NodeSelection().getRange(this.parent.currentDocument);
15399
+ var currentContainer = range.startContainer;
15400
+ for (var i = currentContainer.childNodes.length - 1; i >= 0; i--) {
15401
+ if (!isNullOrUndefined(currentContainer.childNodes[i]) && currentContainer.childNodes[i].nodeName === '#text' &&
15402
+ currentContainer.childNodes[i].textContent.length === 0 && currentContainer.childNodes[i].nodeName !== 'IMG' &&
15403
+ currentContainer.childNodes[i].nodeName !== 'BR' && currentContainer.childNodes[i].nodeName && 'HR') {
15404
+ detach(currentContainer.childNodes[i]);
15405
+ }
15406
+ }
15407
+ range = new NodeSelection().getRange(this.parent.currentDocument);
15400
15408
  var save = new NodeSelection().save(range, this.parent.currentDocument);
15401
15409
  var htmlText = this.parent.editableElement.innerHTML;
15402
15410
  var changEle = { text: htmlText, range: save };
@@ -15547,7 +15555,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
15547
15555
  this.parent.observer.on(MS_WORD_CLEANUP_PLUGIN, this.wordCleanup, this);
15548
15556
  };
15549
15557
  MsWordPaste.prototype.wordCleanup = function (e) {
15550
- var wordPasteStyleConfig = e.allowedStylePropertiesArray;
15558
+ var wordPasteStyleConfig = !isNullOrUndefined(e.allowedStylePropertiesArray) ? e.allowedStylePropertiesArray : [];
15551
15559
  var listNodes = [];
15552
15560
  var tempHTMLContent = e.args.clipboardData.getData('text/HTML');
15553
15561
  var rtfData = e.args.clipboardData.getData('text/rtf');
@@ -15971,8 +15979,10 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
15971
15979
  this.listContents = [];
15972
15980
  this.getListContent(listNodes[i]);
15973
15981
  var type = void 0;
15982
+ var listStyleType = void 0;
15974
15983
  if (!isNullOrUndefined(this.listContents[0])) {
15975
15984
  type = this.listContents[0].trim().length > 1 ? 'ol' : 'ul';
15985
+ listStyleType = this.getlistStyleType(this.listContents[0], type);
15976
15986
  var tempNode = [];
15977
15987
  for (var j = 1; j < this.listContents.length; j++) {
15978
15988
  tempNode.push(this.listContents[j]);
@@ -15989,7 +15999,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
15989
15999
  }
15990
16000
  }
15991
16001
  collection.push({ listType: type, content: tempNode, nestedLevel: level, class: currentClassName,
15992
- listStyle: currentListStyle });
16002
+ listStyle: currentListStyle, listStyleTypeName: listStyleType });
15993
16003
  }
15994
16004
  }
15995
16005
  stNode = listNodes.shift();
@@ -16013,6 +16023,45 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
16013
16023
  }
16014
16024
  }
16015
16025
  };
16026
+ MsWordPaste.prototype.getlistStyleType = function (listContent, type) {
16027
+ var currentListClass;
16028
+ if (type === 'ol') {
16029
+ switch (listContent.split('.')[0]) {
16030
+ case "A":
16031
+ currentListClass = "upper-alpha";
16032
+ break;
16033
+ case "a":
16034
+ currentListClass = "lower-alpha";
16035
+ break;
16036
+ case "I":
16037
+ currentListClass = "upper-roman";
16038
+ break;
16039
+ case "i":
16040
+ currentListClass = "lower-roman";
16041
+ break;
16042
+ case "α":
16043
+ currentListClass = "lower-greek";
16044
+ break;
16045
+ default:
16046
+ currentListClass = "decimal";
16047
+ break;
16048
+ }
16049
+ }
16050
+ else {
16051
+ switch (listContent.split('.')[0]) {
16052
+ case "o":
16053
+ currentListClass = "circle";
16054
+ break;
16055
+ case "§":
16056
+ currentListClass = "square";
16057
+ break;
16058
+ default:
16059
+ currentListClass = "disc";
16060
+ break;
16061
+ }
16062
+ }
16063
+ return currentListClass;
16064
+ };
16016
16065
  MsWordPaste.prototype.makeConversion = function (collection) {
16017
16066
  var root = createElement('div');
16018
16067
  var temp;
@@ -16029,7 +16078,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
16029
16078
  prevList.appendChild(pElement);
16030
16079
  temp.appendChild(prevList);
16031
16080
  temp.setAttribute('level', collection[index].nestedLevel.toString());
16032
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
16081
+ temp.style.listStyleType = collection[index].listStyleTypeName;
16033
16082
  }
16034
16083
  else if (collection[index].nestedLevel === pLevel) {
16035
16084
  if (prevList.parentElement.tagName.toLowerCase() === collection[index].listType) {
@@ -16038,6 +16087,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
16038
16087
  }
16039
16088
  else {
16040
16089
  temp = createElement(collection[index].listType);
16090
+ temp.style.listStyleType = collection[index].listStyleTypeName;
16041
16091
  prevList.parentElement.parentElement.appendChild(temp);
16042
16092
  prevList = createElement('li');
16043
16093
  prevList.appendChild(pElement);
@@ -16049,14 +16099,15 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
16049
16099
  if (!isNullOrUndefined(prevList)) {
16050
16100
  for (var j = 0; j < collection[index].nestedLevel - pLevel; j++) {
16051
16101
  prevList.appendChild(temp = createElement(collection[index].listType));
16052
- prevList = createElement('li', { styles: 'list-style-type: none;' });
16102
+ prevList = createElement('li');
16103
+ if (j != collection[index].nestedLevel - pLevel - 1 && collection[index].nestedLevel - pLevel > 1) {
16104
+ prevList.style.listStyleType = "none";
16105
+ }
16053
16106
  temp.appendChild(prevList);
16054
16107
  }
16055
16108
  prevList.appendChild(pElement);
16056
16109
  temp.setAttribute('level', collection[index].nestedLevel.toString());
16057
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
16058
- temp.childNodes[0].style.listStyle =
16059
- this.getListStyle(collection[index].listType, collection[index].nestedLevel);
16110
+ temp.style.listStyleType = collection[index].listStyleTypeName;
16060
16111
  }
16061
16112
  else {
16062
16113
  root.appendChild(temp = createElement(collection[index].listType));
@@ -16064,7 +16115,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
16064
16115
  prevList.appendChild(pElement);
16065
16116
  temp.appendChild(prevList);
16066
16117
  temp.setAttribute('level', collection[index].nestedLevel.toString());
16067
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
16118
+ temp.style.listStyleType = collection[index].listStyleTypeName;
16068
16119
  }
16069
16120
  }
16070
16121
  else if (collection[index].nestedLevel === 1) {
@@ -16073,12 +16124,12 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
16073
16124
  }
16074
16125
  else {
16075
16126
  root.appendChild(temp = createElement(collection[index].listType));
16127
+ temp.style.listStyleType = collection[index].listStyleTypeName;
16076
16128
  }
16077
16129
  prevList = createElement('li');
16078
16130
  prevList.appendChild(pElement);
16079
16131
  temp.appendChild(prevList);
16080
16132
  temp.setAttribute('level', collection[index].nestedLevel.toString());
16081
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
16082
16133
  }
16083
16134
  else {
16084
16135
  elem = prevList;
@@ -16099,7 +16150,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
16099
16150
  prevList.appendChild(pElement);
16100
16151
  temp.appendChild(prevList);
16101
16152
  temp.setAttribute('level', collection[index].nestedLevel.toString());
16102
- temp.style.listStyle = this.getListStyle(collection[index].listType, collection[index].nestedLevel);
16153
+ temp.style.listStyleType = collection[index].listStyleTypeName;
16103
16154
  break;
16104
16155
  }
16105
16156
  }
@@ -16108,21 +16159,12 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
16108
16159
  }
16109
16160
  prevList.setAttribute('class', collection[index].class);
16110
16161
  var currentStyle = prevList.getAttribute('style');
16111
- prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : '') + collection[index].listStyle);
16162
+ prevList.setAttribute('style', (!isNullOrUndefined(currentStyle) ? currentStyle : ''));
16112
16163
  pLevel = collection[index].nestedLevel;
16113
16164
  listCount++;
16114
16165
  }
16115
16166
  return root;
16116
16167
  };
16117
- MsWordPaste.prototype.getListStyle = function (listType, nestedLevel) {
16118
- nestedLevel = (nestedLevel > 0) ? nestedLevel - 1 : nestedLevel;
16119
- if (listType === 'ol') {
16120
- return (nestedLevel < this.olData.length ? this.olData[nestedLevel] : this.olData[0]);
16121
- }
16122
- else {
16123
- return (nestedLevel < this.ulData.length ? this.ulData[nestedLevel] : this.ulData[0]);
16124
- }
16125
- };
16126
16168
  MsWordPaste.prototype.getListContent = function (elem) {
16127
16169
  var pushContent = '';
16128
16170
  var firstChild = elem.firstElementChild;
@@ -17016,7 +17058,7 @@ var XhtmlValidation = /** @__PURE__ @class */ (function () {
17016
17058
  this.ImageTags();
17017
17059
  this.removeTags();
17018
17060
  this.RemoveUnsupported();
17019
- this.currentElement.innerHTML = this.selfEncloseValidation(this.currentElement.innerHTML, this.currentElement.innerText === '\n' ?
17061
+ this.currentElement.innerHTML = this.selfEncloseValidation(this.currentElement.innerHTML, this.currentElement.innerText === "\n" ?
17020
17062
  this.currentElement.innerText.length : this.currentElement.innerText.trim().length);
17021
17063
  this.parent.setProperties({ value: this.currentElement.innerHTML }, true);
17022
17064
  }
@@ -17302,7 +17344,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
17302
17344
  e.args.action === 'enter' ||
17303
17345
  e.args.keyCode === 13) {
17304
17346
  this.spaceLink(e.args);
17305
- if (this.parent.editorMode === 'HTML') {
17347
+ if (this.parent.editorMode === 'HTML' && !this.parent.readonly) {
17306
17348
  this.parent.notify(enterHandler, { args: e.args });
17307
17349
  }
17308
17350
  }
@@ -17382,7 +17424,8 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
17382
17424
  if (this.rangeElement.tagName === 'OL' || this.rangeElement.tagName === 'UL') {
17383
17425
  var liElement = this.getRangeLiNode(currentRange.startContainer);
17384
17426
  if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
17385
- this.oldRangeElement = liElement.previousElementSibling.lastElementChild;
17427
+ this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
17428
+ liElement.previousElementSibling : liElement.previousElementSibling.lastElementChild;
17386
17429
  if (!isNullOrUndefined(liElement.lastElementChild)) {
17387
17430
  this.rangeElement = liElement.lastElementChild;
17388
17431
  isLiElement = true;
@@ -20199,7 +20242,7 @@ var Image = /** @__PURE__ @class */ (function () {
20199
20242
  left: elem.offsetLeft
20200
20243
  };
20201
20244
  };
20202
- Image.prototype.setAspectRatio = function (img, expectedX, expectedY) {
20245
+ Image.prototype.setAspectRatio = function (img, expectedX, expectedY, e) {
20203
20246
  if (isNullOrUndefined(img.width)) {
20204
20247
  return;
20205
20248
  }
@@ -20253,7 +20296,7 @@ var Image = /** @__PURE__ @class */ (function () {
20253
20296
  img.style.height = (height / width * expectedX) + 'px';
20254
20297
  }
20255
20298
  else {
20256
- img.setAttribute('width', expectedX.toString());
20299
+ img.setAttribute('width', this.resizeBtnStat.botRight ? (this.getPointX(e.event) - img.getBoundingClientRect().left).toString() : expectedX.toString());
20257
20300
  }
20258
20301
  }
20259
20302
  else {
@@ -20294,7 +20337,7 @@ var Image = /** @__PURE__ @class */ (function () {
20294
20337
  return;
20295
20338
  }
20296
20339
  _this.imgEle.parentElement.style.cursor = 'pointer';
20297
- _this.setAspectRatio(_this.imgEle, parseInt(width, 10), parseInt(height, 10));
20340
+ _this.setAspectRatio(_this.imgEle, parseInt(width, 10), parseInt(height, 10), args);
20298
20341
  _this.resizeImgDupPos(_this.imgEle);
20299
20342
  _this.imgResizePos(_this.imgEle, _this.imgResizeDiv);
20300
20343
  _this.parent.setContentHeight('', false);
@@ -20339,7 +20382,8 @@ var Image = /** @__PURE__ @class */ (function () {
20339
20382
  };
20340
20383
  Image.prototype.resizeImgDupPos = function (e) {
20341
20384
  this.imgDupPos = {
20342
- width: (e.style.width !== '') ? this.imgEle.style.width : e.width + 'px',
20385
+ width: (e.style.width !== '' && (this.parent.insertImageSettings &&
20386
+ !this.parent.insertImageSettings.resizeByPercent)) ? this.imgEle.style.width : e.width + 'px',
20343
20387
  height: (e.style.height !== '') ? this.imgEle.style.height : e.height + 'px'
20344
20388
  };
20345
20389
  };
@@ -24073,7 +24117,7 @@ var PasteCleanupSettings = /** @__PURE__ @class */ (function (_super) {
24073
24117
  Property(null)
24074
24118
  ], PasteCleanupSettings.prototype, "deniedAttrs", void 0);
24075
24119
  __decorate$2([
24076
- Property(['background', 'background-color', 'border', 'border-bottom', 'border-left', 'border-radius', 'border-right', 'border-style', 'border-top', 'border-width', 'clear', 'color', 'cursor', 'direction', 'display', 'float', 'font', 'font-family', 'font-size', 'font-weight', 'font-style', 'height', 'left', 'line-height', 'margin', 'margin-top', 'margin-left', 'margin-right', 'margin-bottom', 'max-height', 'max-width', 'min-height', 'min-width', 'overflow', 'overflow-x', 'overflow-y', 'padding', 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 'position', 'right', 'table-layout', 'text-align', 'text-decoration', 'text-indent', 'top', 'vertical-align', 'visibility', 'white-space', 'width'])
24120
+ Property(['background', 'background-color', 'border', 'border-bottom', 'border-left', 'border-radius', 'border-right', 'border-style', 'border-top', 'border-width', 'clear', 'color', 'cursor', 'direction', 'display', 'float', 'font', 'font-family', 'font-size', 'font-weight', 'font-style', 'height', 'left', 'line-height', 'list-style-type', 'margin', 'margin-top', 'margin-left', 'margin-right', 'margin-bottom', 'max-height', 'max-width', 'min-height', 'min-width', 'overflow', 'overflow-x', 'overflow-y', 'padding', 'padding-bottom', 'padding-left', 'padding-right', 'padding-top', 'position', 'right', 'table-layout', 'text-align', 'text-decoration', 'text-indent', 'top', 'vertical-align', 'visibility', 'white-space', 'width'])
24077
24121
  ], PasteCleanupSettings.prototype, "allowedStyleProps", void 0);
24078
24122
  __decorate$2([
24079
24123
  Property(null)
@@ -24340,9 +24384,20 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24340
24384
  EnterKeyAction.prototype.enterHandler = function (e) {
24341
24385
  var _this = this;
24342
24386
  this.getRangeNode();
24387
+ var isTableEnter = true;
24388
+ if (!isNullOrUndefined(this.startNode.closest('TABLE')) && !isNullOrUndefined(this.endNode.closest('TABLE'))) {
24389
+ isTableEnter = false;
24390
+ var curElement = this.startNode;
24391
+ var blockElement = curElement;
24392
+ while (!this.parent.formatter.editorManager.domNode.isBlockNode(curElement)) {
24393
+ blockElement = curElement;
24394
+ curElement = curElement.parentElement;
24395
+ }
24396
+ isTableEnter = blockElement.tagName === 'TD' ? false : true;
24397
+ }
24343
24398
  if (e.args.which === 13 && e.args.code === 'Enter') {
24344
- if (isNullOrUndefined(this.startNode.closest('LI')) && isNullOrUndefined(this.endNode.closest('LI')) && isNullOrUndefined(this.startNode.closest('TABLE')) &&
24345
- isNullOrUndefined(this.endNode.closest('TABLE')) && isNullOrUndefined(this.startNode.closest('PRE')) && isNullOrUndefined(this.endNode.closest('PRE'))) {
24399
+ if (isNullOrUndefined(this.startNode.closest('LI')) && isNullOrUndefined(this.endNode.closest('LI')) && isTableEnter &&
24400
+ isNullOrUndefined(this.startNode.closest('PRE')) && isNullOrUndefined(this.endNode.closest('PRE'))) {
24346
24401
  var shiftKey_1 = e.args.shiftKey;
24347
24402
  var actionBeginArgs = {
24348
24403
  cancel: false,
@@ -24403,10 +24458,29 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24403
24458
  if ((_this.parent.enterKey === 'P' && !shiftKey_1) || (_this.parent.enterKey === 'DIV' && !shiftKey_1) ||
24404
24459
  (_this.parent.shiftEnterKey === 'P' && shiftKey_1) ||
24405
24460
  (_this.parent.shiftEnterKey === 'DIV' && shiftKey_1)) {
24406
- var nearBlockNode = _this.parent.formatter.editorManager.domNode.blockParentNode(_this.startNode);
24461
+ var nearBlockNode = void 0;
24462
+ if (isTableEnter && _this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode)) {
24463
+ nearBlockNode = _this.startNode;
24464
+ }
24465
+ else {
24466
+ nearBlockNode = _this.parent.formatter.editorManager.domNode.blockParentNode(_this.startNode);
24467
+ }
24407
24468
  var isImageNode = false;
24408
- if (_this.range.startOffset === 0 && _this.range.endOffset === 0 && !(!isNullOrUndefined(_this.range.startContainer.previousSibling) &&
24409
- (_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
24469
+ var isFocusedFirst = false;
24470
+ if (_this.range.startOffset != 0 && _this.range.endOffset != 0 && _this.range.startContainer === _this.range.endContainer &&
24471
+ !(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG')) {
24472
+ var startNodeText = _this.range.startContainer.textContent;
24473
+ var splitFirstText = startNodeText.substring(0, _this.range.startOffset);
24474
+ if (splitFirstText.charCodeAt(_this.range.startOffset - 1) != 160 && splitFirstText.trim().length === 0) {
24475
+ isFocusedFirst = true;
24476
+ }
24477
+ }
24478
+ else if (_this.range.startOffset === 0 && _this.range.endOffset === 0) {
24479
+ isFocusedFirst = true;
24480
+ }
24481
+ if (((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
24482
+ !(!isNullOrUndefined(_this.range.startContainer.previousSibling) &&
24483
+ (_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
24410
24484
  var isNearBlockLengthZero = void 0;
24411
24485
  var newElem = void 0;
24412
24486
  if (_this.range.startContainer.nodeName === 'IMG') {
@@ -24415,7 +24489,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24415
24489
  isNearBlockLengthZero = false;
24416
24490
  }
24417
24491
  else {
24418
- if (nearBlockNode.textContent.length !== 0) {
24492
+ if (nearBlockNode.textContent.trim().length !== 0) {
24419
24493
  newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, false).cloneNode(true);
24420
24494
  isNearBlockLengthZero = false;
24421
24495
  }
@@ -24464,7 +24538,18 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24464
24538
  }
24465
24539
  if (newElem.textContent.trim().length === 0) {
24466
24540
  var brElm = _this.parent.createElement('br');
24467
- _this.startNode.appendChild(brElm);
24541
+ if (_this.startNode.nodeName === 'A') {
24542
+ var startParentElem = _this.startNode.parentElement;
24543
+ _this.startNode.parentElement.insertBefore(brElm, _this.startNode);
24544
+ detach(_this.startNode);
24545
+ _this.startNode = startParentElem;
24546
+ }
24547
+ else {
24548
+ _this.startNode.appendChild(brElm);
24549
+ }
24550
+ if (newElem.childNodes[0].textContent === '\n') {
24551
+ detach(newElem.childNodes[0]);
24552
+ }
24468
24553
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.startNode, 0);
24469
24554
  }
24470
24555
  if (((_this.parent.enterKey === 'P' || _this.parent.enterKey === 'DIV') && !shiftKey_1) || ((_this.parent.shiftEnterKey === 'DIV' ||
@@ -24475,7 +24560,8 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24475
24560
  }
24476
24561
  _this.parent.formatter.editorManager.domNode.insertAfter(insertElm, newElem);
24477
24562
  detach(newElem);
24478
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode) ? insertElm : _this.startNode, 0);
24563
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode) ?
24564
+ insertElm : _this.startNode, 0);
24479
24565
  }
24480
24566
  }
24481
24567
  e.args.preventDefault();
@@ -24505,9 +24591,11 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
24505
24591
  _this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
24506
24592
  _this.range.startOffset === _this.range.endOffset &&
24507
24593
  _this.range.startOffset === isLastNodeLength) {
24508
- var outerBRElem = _this.parent.createElement('br');
24509
- _this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
24510
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), outerBRElem, 0);
24594
+ var focusBRElem = _this.parent.createElement('br');
24595
+ var lineBreakBRElem = _this.parent.createElement('br');
24596
+ _this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, _this.range.startContainer);
24597
+ _this.parent.formatter.editorManager.domNode.insertAfter(lineBreakBRElem, _this.range.startContainer);
24598
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), focusBRElem, 0);
24511
24599
  }
24512
24600
  else if (!isNullOrUndefined(currentParent) && currentParent !== _this.parent.inputElement && currentParent.nodeName !== 'BR') {
24513
24601
  if (currentParent.textContent.trim().length === 0 || (currentParent.textContent.trim().length === 1 &&
@@ -26000,7 +26088,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
26000
26088
  this.setProperties({ value: this.valueTemplate });
26001
26089
  }
26002
26090
  else {
26003
- var compiledTemplate = compile(this.valueTemplate)('', this, 'valueTemplate');
26091
+ var compiledTemplate = compile(this.valueTemplate)("", this, 'valueTemplate');
26004
26092
  for (var i = 0; i < compiledTemplate.length; i++) {
26005
26093
  var item = compiledTemplate[i];
26006
26094
  append([item], this.element);
@@ -26395,7 +26483,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
26395
26483
  this.isRTE = false;
26396
26484
  }
26397
26485
  this.notify(docClick, { args: e });
26398
- if (e.detail > 3) {
26486
+ if (Browser.info.name !== 'msie' && e.detail > 3) {
26399
26487
  e.preventDefault();
26400
26488
  }
26401
26489
  };