@syncfusion/ej2-richtexteditor 27.1.48 → 27.1.51

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 (82) hide show
  1. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  2. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  3. package/dist/es6/ej2-richtexteditor.es2015.js +74 -17
  4. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  5. package/dist/es6/ej2-richtexteditor.es5.js +74 -17
  6. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  7. package/dist/global/ej2-richtexteditor.min.js +2 -2
  8. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  9. package/dist/global/index.d.ts +1 -1
  10. package/package.json +13 -14
  11. package/src/editor-manager/plugin/clearformat.js +13 -6
  12. package/src/editor-manager/plugin/inserthtml.js +22 -1
  13. package/src/editor-manager/plugin/ms-word-clean-up.js +17 -2
  14. package/src/editor-manager/plugin/table.js +3 -0
  15. package/src/rich-text-editor/actions/enter-key.js +7 -2
  16. package/src/rich-text-editor/actions/html-editor.js +3 -2
  17. package/src/rich-text-editor/actions/paste-clean-up.js +2 -1
  18. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +8 -8
  19. package/src/rich-text-editor/base/rich-text-editor.d.ts +8 -8
  20. package/src/rich-text-editor/base/rich-text-editor.js +5 -1
  21. package/src/rich-text-editor/formatter/formatter.js +1 -1
  22. package/src/rich-text-editor/models/default-locale.js +1 -1
  23. package/src/rich-text-editor/renderer/image-module.js +1 -1
  24. package/styles/bootstrap-dark-lite.css +20 -0
  25. package/styles/bootstrap-dark.css +20 -0
  26. package/styles/bootstrap-lite.css +20 -0
  27. package/styles/bootstrap.css +20 -0
  28. package/styles/bootstrap4-lite.css +20 -0
  29. package/styles/bootstrap4.css +20 -0
  30. package/styles/bootstrap5-dark-lite.css +20 -0
  31. package/styles/bootstrap5-dark.css +20 -0
  32. package/styles/bootstrap5-lite.css +20 -0
  33. package/styles/bootstrap5.3-lite.css +26 -0
  34. package/styles/bootstrap5.3.css +26 -0
  35. package/styles/bootstrap5.css +20 -0
  36. package/styles/fabric-dark-lite.css +20 -0
  37. package/styles/fabric-dark.css +20 -0
  38. package/styles/fabric-lite.css +20 -0
  39. package/styles/fabric.css +20 -0
  40. package/styles/fluent-dark-lite.css +20 -0
  41. package/styles/fluent-dark.css +20 -0
  42. package/styles/fluent-lite.css +20 -0
  43. package/styles/fluent.css +20 -0
  44. package/styles/fluent2-lite.css +20 -0
  45. package/styles/fluent2.css +20 -0
  46. package/styles/highcontrast-light-lite.css +20 -0
  47. package/styles/highcontrast-light.css +20 -0
  48. package/styles/highcontrast-lite.css +20 -0
  49. package/styles/highcontrast.css +20 -0
  50. package/styles/material-dark-lite.css +20 -0
  51. package/styles/material-dark.css +20 -0
  52. package/styles/material-lite.css +20 -0
  53. package/styles/material.css +20 -0
  54. package/styles/material3-dark-lite.css +20 -0
  55. package/styles/material3-dark.css +20 -0
  56. package/styles/material3-lite.css +20 -0
  57. package/styles/material3.css +20 -0
  58. package/styles/rich-text-editor/_layout.scss +17 -1
  59. package/styles/rich-text-editor/_theme.scss +24 -6
  60. package/styles/rich-text-editor/bootstrap-dark.css +20 -0
  61. package/styles/rich-text-editor/bootstrap.css +20 -0
  62. package/styles/rich-text-editor/bootstrap4.css +20 -0
  63. package/styles/rich-text-editor/bootstrap5-dark.css +20 -0
  64. package/styles/rich-text-editor/bootstrap5.3.css +26 -0
  65. package/styles/rich-text-editor/bootstrap5.css +20 -0
  66. package/styles/rich-text-editor/fabric-dark.css +20 -0
  67. package/styles/rich-text-editor/fabric.css +20 -0
  68. package/styles/rich-text-editor/fluent-dark.css +20 -0
  69. package/styles/rich-text-editor/fluent.css +20 -0
  70. package/styles/rich-text-editor/fluent2.css +20 -0
  71. package/styles/rich-text-editor/highcontrast-light.css +20 -0
  72. package/styles/rich-text-editor/highcontrast.css +20 -0
  73. package/styles/rich-text-editor/material-dark.css +20 -0
  74. package/styles/rich-text-editor/material.css +20 -0
  75. package/styles/rich-text-editor/material3-dark.css +20 -0
  76. package/styles/rich-text-editor/material3.css +20 -0
  77. package/styles/rich-text-editor/tailwind-dark.css +20 -0
  78. package/styles/rich-text-editor/tailwind.css +20 -0
  79. package/styles/tailwind-dark-lite.css +20 -0
  80. package/styles/tailwind-dark.css +20 -0
  81. package/styles/tailwind-lite.css +20 -0
  82. package/styles/tailwind.css +20 -0
@@ -2984,7 +2984,7 @@ var toolsLocale = {
2984
2984
  'remove': 'remove',
2985
2985
  'insertlink': 'insertLink',
2986
2986
  'display': 'display',
2987
- 'alttext': 'alternateHeader',
2987
+ 'alttext': 'imageAlternateText',
2988
2988
  'dimension': 'dimension',
2989
2989
  'fullscreen': 'fullscreen',
2990
2990
  'maximize': 'maximize',
@@ -8661,7 +8661,7 @@ var Image$1 = /** @__PURE__ @class */ (function () {
8661
8661
  };
8662
8662
  proxy.inputUrl.setAttribute('disabled', 'true');
8663
8663
  if (isNullOrUndefined(proxy.parent.insertImageSettings.saveUrl) && _this.isAllowedTypes
8664
- && !isNullOrUndefined(_this.dialogObj)) {
8664
+ && !isNullOrUndefined(_this.dialogObj) && selectArgs.filesData[0].size <= _this.uploadObj.maxFileSize) {
8665
8665
  _this.dialogObj.getButtons(0).element.removeAttribute('disabled');
8666
8666
  }
8667
8667
  });
@@ -18683,7 +18683,7 @@ var Formatter = /** @__PURE__ @class */ (function () {
18683
18683
  }
18684
18684
  self.isBlur = false;
18685
18685
  var quickToolbarAction = !isNullOrUndefined(event) && !isNullOrUndefined(event.target) && (!isNullOrUndefined(closest(event.target, '.e-rte-elements.e-dropdown-popup.e-rte-dropdown-popup.e-quick-dropdown.e-popup-open')) || !isNullOrUndefined(closest(event.target, '.e-rte-elements.e-rte-quick-popup.e-popup-open')));
18686
- if (isNullOrUndefined(saveSelection) || (!quickToolbarAction && (isNullOrUndefined(closest(saveSelection.range.startContainer.parentElement, '.e-img-caption')) ? true : !(closest(saveSelection.range.startContainer.parentElement, '.e-img-caption').getAttribute('contenteditable') === 'false')))) {
18686
+ if (isNullOrUndefined(saveSelection) || (!quickToolbarAction && (isNullOrUndefined(closest(saveSelection.range.startContainer.parentElement, '.e-img-caption')) ? true : !(closest(saveSelection.range.startContainer.parentElement, '.e-img-caption').getAttribute('contenteditable') === 'false'))) && !(Browser.userAgent.indexOf('Firefox') !== -1)) {
18687
18687
  self.contentModule.getEditPanel().focus();
18688
18688
  }
18689
18689
  if (self.editorMode === 'HTML' && !isKeyboardVideoInsert) {
@@ -24276,6 +24276,9 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
24276
24276
  var rangeElement = closest(nearestAnchor, 'span');
24277
24277
  rangeElement.appendChild(tempSpan);
24278
24278
  }
24279
+ else if (nodes[0].nodeName === '#text' && nodes[0].nodeValue.includes('\u200B') && !isNullOrUndefined(nodes[0].parentElement) && !isNullOrUndefined(nodes[0].parentElement.previousElementSibling) && nodes[0].parentElement.previousElementSibling.classList.contains('e-mention-chip')) {
24280
+ range.startContainer.parentElement.insertAdjacentElement('afterend', tempSpan);
24281
+ }
24279
24282
  else {
24280
24283
  range.insertNode(tempSpan);
24281
24284
  }
@@ -24361,6 +24364,24 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
24361
24364
  if (lastSelectionNode.nodeName === '#text') {
24362
24365
  this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
24363
24366
  }
24367
+ else if (lastSelectionNode.nodeName === 'HR') {
24368
+ var nextSiblingNode = lastSelectionNode.nextSibling ? lastSelectionNode.nextSibling : null;
24369
+ var siblingTag = enterAction === 'DIV' ? createElement('div') : createElement('p');
24370
+ siblingTag.appendChild(createElement('br'));
24371
+ if (!isNullOrUndefined(nextSiblingNode) && nextSiblingNode.nodeName === 'HR') {
24372
+ lastSelectionNode.parentNode.insertBefore(siblingTag, nextSiblingNode);
24373
+ lastSelectionNode = siblingTag;
24374
+ }
24375
+ else if (!isNullOrUndefined(nextSiblingNode)) {
24376
+ lastSelectionNode = nextSiblingNode;
24377
+ }
24378
+ else {
24379
+ lastSelectionNode.parentNode.appendChild(siblingTag);
24380
+ lastSelectionNode.parentNode.insertBefore(lastSelectionNode, siblingTag);
24381
+ lastSelectionNode = siblingTag;
24382
+ }
24383
+ nodeSelection.setSelectionText(docElement, lastSelectionNode, lastSelectionNode, 0, 0);
24384
+ }
24364
24385
  else {
24365
24386
  this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
24366
24387
  }
@@ -24432,7 +24453,7 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
24432
24453
  if (blockNode.nodeName === 'BODY' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
24433
24454
  blockNode = range.startContainer;
24434
24455
  }
24435
- if (blockNode.closest('LI') && blockNode.nodeName !== 'TD' && blockNode.nodeName !== 'TH' && blockNode.nodeName !== 'TR' && node && node.firstElementChild &&
24456
+ if (blockNode.closest('LI') && editNode.contains(blockNode.closest('LI')) && blockNode.nodeName !== 'TD' && blockNode.nodeName !== 'TH' && blockNode.nodeName !== 'TR' && node && node.firstElementChild &&
24436
24457
  ((node).firstElementChild.tagName === 'OL' || node.firstElementChild.tagName === 'UL')) {
24437
24458
  var liNode = void 0;
24438
24459
  while (node.firstElementChild.lastElementChild && node.firstElementChild.lastElementChild.tagName === 'LI') {
@@ -26315,6 +26336,9 @@ var TableCommand = /** @__PURE__ @class */ (function () {
26315
26336
  for (var i = 0; i < thTdElm.length; i++) {
26316
26337
  thTdElm[i].dataset.oldWidth = (thTdElm[i].offsetWidth / currentTabElm.offsetWidth * 100) + '%';
26317
26338
  }
26339
+ if (isNullOrUndefined(currentTabElm.style.width) || currentTabElm.style.width === '') {
26340
+ currentTabElm.style.width = currentTabElm.offsetWidth + 'px';
26341
+ }
26318
26342
  for (var i = 0; i < allRows.length; i++) {
26319
26343
  curCell = allRows[i].querySelectorAll(':scope > td, :scope > th')[colIndex];
26320
26344
  var colTemplate = curCell.cloneNode(true);
@@ -28454,9 +28478,13 @@ var ClearFormat$1 = /** @__PURE__ @class */ (function () {
28454
28478
  nodeSelection.setSelectionText(docElement, parentNodes[index1], parentNodes[index1], 0, parentNodes[index1].childNodes.length);
28455
28479
  InsertMethods.unwrap(nodeCutter.GetSpliceNode(nodeSelection.getRange(docElement), parentNodes[index1].parentNode));
28456
28480
  }
28481
+ var blockquoteNode = closest(parentNodes[index1], 'blockquote');
28482
+ if (parentNodes[index1].nodeName.toLocaleLowerCase() !== 'blockquote' && !isNullOrUndefined(blockquoteNode) && blockquoteNode.textContent === parentNodes[index1].textContent) {
28483
+ var blockNodes = this.removeParent([blockquoteNode]);
28484
+ this.unWrap(docElement, blockNodes, nodeCutter, nodeSelection);
28485
+ }
28457
28486
  if (parentNodes[index1].nodeName.toLocaleLowerCase() !== 'p') {
28458
28487
  if (this.NONVALID_PARENT_TAGS.indexOf(parentNodes[index1].nodeName.toLowerCase()) < 0
28459
- && parentNodes[index1].parentNode.nodeName.toLocaleLowerCase() !== 'p'
28460
28488
  && !((parentNodes[index1].nodeName.toLocaleLowerCase() === 'blockquote'
28461
28489
  || parentNodes[index1].nodeName.toLocaleLowerCase() === 'li')
28462
28490
  && this.IGNORE_PARENT_TAGS.indexOf(parentNodes[index1].childNodes[0].nodeName.toLocaleLowerCase()) > -1)
@@ -28480,13 +28508,16 @@ var ClearFormat$1 = /** @__PURE__ @class */ (function () {
28480
28508
  this.unWrap(docElement, blockNodes, nodeCutter, nodeSelection);
28481
28509
  }
28482
28510
  else if (this.BLOCK_TAGS.indexOf(childNodes[index2].nodeName.toLocaleLowerCase()) > -1 &&
28483
- childNodes[index2].parentNode.nodeName.toLocaleLowerCase() ===
28484
- childNodes[index2].nodeName.toLocaleLowerCase()) {
28511
+ childNodes[index2].nodeName.toLocaleLowerCase() === 'p') {
28512
+ if (childNodes[index2].parentNode.nodeName.toLocaleLowerCase() === 'p') {
28513
+ InsertMethods.unwrap(childNodes[index2].parentNode);
28514
+ }
28515
+ InsertMethods.Wrap(childNodes[index2], docElement.createElement(this.defaultTag));
28485
28516
  InsertMethods.unwrap(childNodes[index2]);
28486
28517
  }
28487
28518
  else if (this.BLOCK_TAGS.indexOf(childNodes[index2].nodeName.toLocaleLowerCase()) > -1 &&
28488
- childNodes[index2].nodeName.toLocaleLowerCase() === 'p') {
28489
- InsertMethods.Wrap(childNodes[index2], docElement.createElement(this.defaultTag));
28519
+ childNodes[index2].parentNode.nodeName.toLocaleLowerCase() ===
28520
+ childNodes[index2].nodeName.toLocaleLowerCase()) {
28490
28521
  InsertMethods.unwrap(childNodes[index2]);
28491
28522
  }
28492
28523
  }
@@ -29373,15 +29404,22 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
29373
29404
  var styleProperty = resultElem[j].getAttribute('style');
29374
29405
  if (!isNullOrUndefined(styleProperty) && styleProperty.trim() !== '') {
29375
29406
  var valueSplit = values[i].split(';');
29407
+ for (var q = 0; q < valueSplit.length; q++) {
29408
+ if (valueSplit[q].split(':')[0] === 'border' && valueSplit[q].split(':')[1] === 'none') {
29409
+ valueSplit.splice(q, 1);
29410
+ q--;
29411
+ }
29412
+ }
29376
29413
  if (!fromClass) {
29377
29414
  for (var k = 0; k < valueSplit.length; k++) {
29378
- if (styleProperty.indexOf(valueSplit[k].split(':')[0]) >= 0) {
29415
+ var propertyName = valueSplit[k].split(':')[0];
29416
+ if (styleProperty.includes(propertyName + ':')) {
29379
29417
  valueSplit.splice(k, 1);
29380
29418
  k--;
29381
29419
  }
29382
29420
  }
29383
29421
  }
29384
- var changedValue = styleProperty + valueSplit.join(';') + ';';
29422
+ var changedValue = valueSplit.join(';') + ';' + styleProperty;
29385
29423
  resultElem[j].setAttribute('style', changedValue);
29386
29424
  }
29387
29425
  else {
@@ -29863,6 +29901,14 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
29863
29901
  for (var i = 0; i < listIgnoreTag.length; i++) {
29864
29902
  listIgnoreTag[i].setAttribute('style', listIgnoreTag[i].getAttribute('style').replace(/\n/g, ''));
29865
29903
  }
29904
+ var listOrderCleanup = firstChild.querySelector('span[style*="mso-list"]');
29905
+ if (listOrderCleanup) {
29906
+ var style = listOrderCleanup.getAttribute('style');
29907
+ if (style) {
29908
+ style = style.replace(/\s*:\s*/g, ':');
29909
+ listOrderCleanup.setAttribute('style', style);
29910
+ }
29911
+ }
29866
29912
  var listOrder = firstChild.querySelector('span[style="mso-list:Ignore"]');
29867
29913
  if (!isNullOrUndefined(listOrder)) {
29868
29914
  this.listContents.push(listOrder.textContent.trim());
@@ -31953,12 +31999,13 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
31953
31999
  this.isImageDelete = false;
31954
32000
  }
31955
32001
  var brNode = this.deleteRangeElement.querySelector('BR');
32002
+ var brLastChildNode = this.deleteRangeElement.lastChild;
31956
32003
  if (brNode && brNode.classList.contains('e-rte-image-remove-focus')) {
31957
32004
  removeClass([brNode], ['e-rte-image-focus']);
31958
32005
  return;
31959
32006
  }
31960
- else if (brNode) {
31961
- detach(brNode);
32007
+ else if (brNode && brLastChildNode && brLastChildNode.nodeName === 'BR') {
32008
+ detach(brLastChildNode);
31962
32009
  e.args.preventDefault();
31963
32010
  }
31964
32011
  if (!isNullOrUndefined(this.deleteRangeElement) && (this.deleteOldRangeElement.tagName !== 'OL' && this.deleteOldRangeElement.tagName !== 'UL')
@@ -32541,12 +32588,12 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
32541
32588
  if (e.args && !isNullOrUndefined(e.args.clipboardData)) {
32542
32589
  value = e.args.clipboardData.getData('text/html');
32543
32590
  }
32544
- this.parent.trigger(beforePasteCleanup, { value: value });
32545
32591
  if (e.args && value !== null && this.parent.editorMode === 'HTML') {
32546
32592
  var file = void 0;
32547
32593
  if (value.length === 0) {
32548
32594
  var htmlRegex = new RegExp(/<\/[a-z][\s\S]*>/i);
32549
32595
  value = e.args.clipboardData.getData('text/plain');
32596
+ this.parent.trigger(beforePasteCleanup, { value: value });
32550
32597
  this.isNotFromHtml = value !== '' ? true : false;
32551
32598
  value = value.replace(/</g, '&lt;');
32552
32599
  value = value.replace(/>/g, '&gt;');
@@ -32579,6 +32626,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
32579
32626
  }
32580
32627
  }
32581
32628
  else if (value.length > 0) {
32629
+ this.parent.trigger(beforePasteCleanup, { value: value });
32582
32630
  this.parent.formatter.editorManager.observer.notify(MS_WORD_CLEANUP, {
32583
32631
  args: e.args,
32584
32632
  text: e.text,
@@ -36454,7 +36502,12 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
36454
36502
  else {
36455
36503
  var nearBlockNode = void 0;
36456
36504
  if (isTableEnter && _this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode)) {
36457
- nearBlockNode = _this.startNode;
36505
+ if (_this.range.startContainer.nodeName === '#text' && !isNullOrUndefined(_this.range.startContainer.previousSibling) && _this.range.startContainer.previousSibling.nodeName === 'HR') {
36506
+ nearBlockNode = _this.range.startContainer.nextSibling;
36507
+ }
36508
+ else {
36509
+ nearBlockNode = _this.startNode;
36510
+ }
36458
36511
  }
36459
36512
  else {
36460
36513
  nearBlockNode = _this.parent.formatter.editorManager.domNode.blockParentNode(_this.startNode);
@@ -36502,7 +36555,7 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
36502
36555
  }
36503
36556
  else {
36504
36557
  if ((nearBlockNode.textContent.trim().length !== 0 ||
36505
- nearBlockNode.childNodes[0].nodeName === 'IMG' ||
36558
+ (!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG') ||
36506
36559
  (nearBlockNode.textContent.trim() === '' && nearBlockNode.querySelectorAll('img, audio, video').length > 0))) {
36507
36560
  if ((_this.range.startOffset === _this.range.endOffset && _this.range.startOffset !== 0)) {
36508
36561
  newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, false).cloneNode(true);
@@ -37646,8 +37699,12 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
37646
37699
  RichTextEditor.prototype.keyDown = function (e) {
37647
37700
  if (this.inputElement.classList.contains('e-mention')) {
37648
37701
  var mentionPopup = this.inputElement.ownerDocument.getElementById(this.inputElement.id + '_popup');
37702
+ var slashMenuPopup = this.inputElement.ownerDocument.getElementById(this.inputElement.id + '_slash_menu_popup');
37649
37703
  var mentionKeys = mentionRestrictKeys;
37650
- if (mentionKeys.indexOf(e.key) !== -1 && mentionPopup && mentionPopup.classList.contains('e-popup-open')) {
37704
+ var isMentionKeys = mentionKeys.indexOf(e.key) !== -1;
37705
+ var isMentionPopupOpen = mentionPopup && mentionPopup.classList.contains('e-popup-open');
37706
+ var isSlashMenuPopupOpen = slashMenuPopup && slashMenuPopup.classList.contains('e-popup-open');
37707
+ if (isMentionKeys && (isMentionPopupOpen || isSlashMenuPopupOpen)) {
37651
37708
  return;
37652
37709
  }
37653
37710
  }