@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
@@ -2991,7 +2991,7 @@ let toolsLocale = {
2991
2991
  'remove': 'remove',
2992
2992
  'insertlink': 'insertLink',
2993
2993
  'display': 'display',
2994
- 'alttext': 'alternateHeader',
2994
+ 'alttext': 'imageAlternateText',
2995
2995
  'dimension': 'dimension',
2996
2996
  'fullscreen': 'fullscreen',
2997
2997
  'maximize': 'maximize',
@@ -8637,7 +8637,7 @@ class Image$1 {
8637
8637
  };
8638
8638
  proxy.inputUrl.setAttribute('disabled', 'true');
8639
8639
  if (isNullOrUndefined(proxy.parent.insertImageSettings.saveUrl) && this.isAllowedTypes
8640
- && !isNullOrUndefined(this.dialogObj)) {
8640
+ && !isNullOrUndefined(this.dialogObj) && selectArgs.filesData[0].size <= this.uploadObj.maxFileSize) {
8641
8641
  this.dialogObj.getButtons(0).element.removeAttribute('disabled');
8642
8642
  }
8643
8643
  });
@@ -18641,7 +18641,7 @@ class Formatter {
18641
18641
  }
18642
18642
  self.isBlur = false;
18643
18643
  const 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')));
18644
- 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')))) {
18644
+ 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)) {
18645
18645
  self.contentModule.getEditPanel().focus();
18646
18646
  }
18647
18647
  if (self.editorMode === 'HTML' && !isKeyboardVideoInsert) {
@@ -24195,6 +24195,9 @@ class InsertHtml {
24195
24195
  const rangeElement = closest(nearestAnchor, 'span');
24196
24196
  rangeElement.appendChild(tempSpan);
24197
24197
  }
24198
+ 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')) {
24199
+ range.startContainer.parentElement.insertAdjacentElement('afterend', tempSpan);
24200
+ }
24198
24201
  else {
24199
24202
  range.insertNode(tempSpan);
24200
24203
  }
@@ -24280,6 +24283,24 @@ class InsertHtml {
24280
24283
  if (lastSelectionNode.nodeName === '#text') {
24281
24284
  this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
24282
24285
  }
24286
+ else if (lastSelectionNode.nodeName === 'HR') {
24287
+ const nextSiblingNode = lastSelectionNode.nextSibling ? lastSelectionNode.nextSibling : null;
24288
+ const siblingTag = enterAction === 'DIV' ? createElement('div') : createElement('p');
24289
+ siblingTag.appendChild(createElement('br'));
24290
+ if (!isNullOrUndefined(nextSiblingNode) && nextSiblingNode.nodeName === 'HR') {
24291
+ lastSelectionNode.parentNode.insertBefore(siblingTag, nextSiblingNode);
24292
+ lastSelectionNode = siblingTag;
24293
+ }
24294
+ else if (!isNullOrUndefined(nextSiblingNode)) {
24295
+ lastSelectionNode = nextSiblingNode;
24296
+ }
24297
+ else {
24298
+ lastSelectionNode.parentNode.appendChild(siblingTag);
24299
+ lastSelectionNode.parentNode.insertBefore(lastSelectionNode, siblingTag);
24300
+ lastSelectionNode = siblingTag;
24301
+ }
24302
+ nodeSelection.setSelectionText(docElement, lastSelectionNode, lastSelectionNode, 0, 0);
24303
+ }
24283
24304
  else {
24284
24305
  this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
24285
24306
  }
@@ -24351,7 +24372,7 @@ class InsertHtml {
24351
24372
  if (blockNode.nodeName === 'BODY' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
24352
24373
  blockNode = range.startContainer;
24353
24374
  }
24354
- if (blockNode.closest('LI') && blockNode.nodeName !== 'TD' && blockNode.nodeName !== 'TH' && blockNode.nodeName !== 'TR' && node && node.firstElementChild &&
24375
+ if (blockNode.closest('LI') && editNode.contains(blockNode.closest('LI')) && blockNode.nodeName !== 'TD' && blockNode.nodeName !== 'TH' && blockNode.nodeName !== 'TR' && node && node.firstElementChild &&
24355
24376
  ((node).firstElementChild.tagName === 'OL' || node.firstElementChild.tagName === 'UL')) {
24356
24377
  let liNode;
24357
24378
  while (node.firstElementChild.lastElementChild && node.firstElementChild.lastElementChild.tagName === 'LI') {
@@ -26224,6 +26245,9 @@ class TableCommand {
26224
26245
  for (let i = 0; i < thTdElm.length; i++) {
26225
26246
  thTdElm[i].dataset.oldWidth = (thTdElm[i].offsetWidth / currentTabElm.offsetWidth * 100) + '%';
26226
26247
  }
26248
+ if (isNullOrUndefined(currentTabElm.style.width) || currentTabElm.style.width === '') {
26249
+ currentTabElm.style.width = currentTabElm.offsetWidth + 'px';
26250
+ }
26227
26251
  for (let i = 0; i < allRows.length; i++) {
26228
26252
  curCell = allRows[i].querySelectorAll(':scope > td, :scope > th')[colIndex];
26229
26253
  const colTemplate = curCell.cloneNode(true);
@@ -28352,9 +28376,13 @@ class ClearFormat$1 {
28352
28376
  nodeSelection.setSelectionText(docElement, parentNodes[index1], parentNodes[index1], 0, parentNodes[index1].childNodes.length);
28353
28377
  InsertMethods.unwrap(nodeCutter.GetSpliceNode(nodeSelection.getRange(docElement), parentNodes[index1].parentNode));
28354
28378
  }
28379
+ const blockquoteNode = closest(parentNodes[index1], 'blockquote');
28380
+ if (parentNodes[index1].nodeName.toLocaleLowerCase() !== 'blockquote' && !isNullOrUndefined(blockquoteNode) && blockquoteNode.textContent === parentNodes[index1].textContent) {
28381
+ const blockNodes = this.removeParent([blockquoteNode]);
28382
+ this.unWrap(docElement, blockNodes, nodeCutter, nodeSelection);
28383
+ }
28355
28384
  if (parentNodes[index1].nodeName.toLocaleLowerCase() !== 'p') {
28356
28385
  if (this.NONVALID_PARENT_TAGS.indexOf(parentNodes[index1].nodeName.toLowerCase()) < 0
28357
- && parentNodes[index1].parentNode.nodeName.toLocaleLowerCase() !== 'p'
28358
28386
  && !((parentNodes[index1].nodeName.toLocaleLowerCase() === 'blockquote'
28359
28387
  || parentNodes[index1].nodeName.toLocaleLowerCase() === 'li')
28360
28388
  && this.IGNORE_PARENT_TAGS.indexOf(parentNodes[index1].childNodes[0].nodeName.toLocaleLowerCase()) > -1)
@@ -28378,13 +28406,16 @@ class ClearFormat$1 {
28378
28406
  this.unWrap(docElement, blockNodes, nodeCutter, nodeSelection);
28379
28407
  }
28380
28408
  else if (this.BLOCK_TAGS.indexOf(childNodes[index2].nodeName.toLocaleLowerCase()) > -1 &&
28381
- childNodes[index2].parentNode.nodeName.toLocaleLowerCase() ===
28382
- childNodes[index2].nodeName.toLocaleLowerCase()) {
28409
+ childNodes[index2].nodeName.toLocaleLowerCase() === 'p') {
28410
+ if (childNodes[index2].parentNode.nodeName.toLocaleLowerCase() === 'p') {
28411
+ InsertMethods.unwrap(childNodes[index2].parentNode);
28412
+ }
28413
+ InsertMethods.Wrap(childNodes[index2], docElement.createElement(this.defaultTag));
28383
28414
  InsertMethods.unwrap(childNodes[index2]);
28384
28415
  }
28385
28416
  else if (this.BLOCK_TAGS.indexOf(childNodes[index2].nodeName.toLocaleLowerCase()) > -1 &&
28386
- childNodes[index2].nodeName.toLocaleLowerCase() === 'p') {
28387
- InsertMethods.Wrap(childNodes[index2], docElement.createElement(this.defaultTag));
28417
+ childNodes[index2].parentNode.nodeName.toLocaleLowerCase() ===
28418
+ childNodes[index2].nodeName.toLocaleLowerCase()) {
28388
28419
  InsertMethods.unwrap(childNodes[index2]);
28389
28420
  }
28390
28421
  }
@@ -29267,15 +29298,22 @@ class MsWordPaste {
29267
29298
  const styleProperty = resultElem[j].getAttribute('style');
29268
29299
  if (!isNullOrUndefined(styleProperty) && styleProperty.trim() !== '') {
29269
29300
  const valueSplit = values[i].split(';');
29301
+ for (let q = 0; q < valueSplit.length; q++) {
29302
+ if (valueSplit[q].split(':')[0] === 'border' && valueSplit[q].split(':')[1] === 'none') {
29303
+ valueSplit.splice(q, 1);
29304
+ q--;
29305
+ }
29306
+ }
29270
29307
  if (!fromClass) {
29271
29308
  for (let k = 0; k < valueSplit.length; k++) {
29272
- if (styleProperty.indexOf(valueSplit[k].split(':')[0]) >= 0) {
29309
+ const propertyName = valueSplit[k].split(':')[0];
29310
+ if (styleProperty.includes(propertyName + ':')) {
29273
29311
  valueSplit.splice(k, 1);
29274
29312
  k--;
29275
29313
  }
29276
29314
  }
29277
29315
  }
29278
- const changedValue = styleProperty + valueSplit.join(';') + ';';
29316
+ const changedValue = valueSplit.join(';') + ';' + styleProperty;
29279
29317
  resultElem[j].setAttribute('style', changedValue);
29280
29318
  }
29281
29319
  else {
@@ -29757,6 +29795,14 @@ class MsWordPaste {
29757
29795
  for (let i = 0; i < listIgnoreTag.length; i++) {
29758
29796
  listIgnoreTag[i].setAttribute('style', listIgnoreTag[i].getAttribute('style').replace(/\n/g, ''));
29759
29797
  }
29798
+ const listOrderCleanup = firstChild.querySelector('span[style*="mso-list"]');
29799
+ if (listOrderCleanup) {
29800
+ let style = listOrderCleanup.getAttribute('style');
29801
+ if (style) {
29802
+ style = style.replace(/\s*:\s*/g, ':');
29803
+ listOrderCleanup.setAttribute('style', style);
29804
+ }
29805
+ }
29760
29806
  const listOrder = firstChild.querySelector('span[style="mso-list:Ignore"]');
29761
29807
  if (!isNullOrUndefined(listOrder)) {
29762
29808
  this.listContents.push(listOrder.textContent.trim());
@@ -31817,12 +31863,13 @@ class HtmlEditor {
31817
31863
  this.isImageDelete = false;
31818
31864
  }
31819
31865
  const brNode = this.deleteRangeElement.querySelector('BR');
31866
+ const brLastChildNode = this.deleteRangeElement.lastChild;
31820
31867
  if (brNode && brNode.classList.contains('e-rte-image-remove-focus')) {
31821
31868
  removeClass([brNode], ['e-rte-image-focus']);
31822
31869
  return;
31823
31870
  }
31824
- else if (brNode) {
31825
- detach(brNode);
31871
+ else if (brNode && brLastChildNode && brLastChildNode.nodeName === 'BR') {
31872
+ detach(brLastChildNode);
31826
31873
  e.args.preventDefault();
31827
31874
  }
31828
31875
  if (!isNullOrUndefined(this.deleteRangeElement) && (this.deleteOldRangeElement.tagName !== 'OL' && this.deleteOldRangeElement.tagName !== 'UL')
@@ -32402,12 +32449,12 @@ class PasteCleanup {
32402
32449
  if (e.args && !isNullOrUndefined(e.args.clipboardData)) {
32403
32450
  value = e.args.clipboardData.getData('text/html');
32404
32451
  }
32405
- this.parent.trigger(beforePasteCleanup, { value: value });
32406
32452
  if (e.args && value !== null && this.parent.editorMode === 'HTML') {
32407
32453
  let file;
32408
32454
  if (value.length === 0) {
32409
32455
  const htmlRegex = new RegExp(/<\/[a-z][\s\S]*>/i);
32410
32456
  value = e.args.clipboardData.getData('text/plain');
32457
+ this.parent.trigger(beforePasteCleanup, { value: value });
32411
32458
  this.isNotFromHtml = value !== '' ? true : false;
32412
32459
  value = value.replace(/</g, '&lt;');
32413
32460
  value = value.replace(/>/g, '&gt;');
@@ -32440,6 +32487,7 @@ class PasteCleanup {
32440
32487
  }
32441
32488
  }
32442
32489
  else if (value.length > 0) {
32490
+ this.parent.trigger(beforePasteCleanup, { value: value });
32443
32491
  this.parent.formatter.editorManager.observer.notify(MS_WORD_CLEANUP, {
32444
32492
  args: e.args,
32445
32493
  text: e.text,
@@ -36131,7 +36179,12 @@ class EnterKeyAction {
36131
36179
  else {
36132
36180
  let nearBlockNode;
36133
36181
  if (isTableEnter && this.parent.formatter.editorManager.domNode.isBlockNode(this.startNode)) {
36134
- nearBlockNode = this.startNode;
36182
+ if (this.range.startContainer.nodeName === '#text' && !isNullOrUndefined(this.range.startContainer.previousSibling) && this.range.startContainer.previousSibling.nodeName === 'HR') {
36183
+ nearBlockNode = this.range.startContainer.nextSibling;
36184
+ }
36185
+ else {
36186
+ nearBlockNode = this.startNode;
36187
+ }
36135
36188
  }
36136
36189
  else {
36137
36190
  nearBlockNode = this.parent.formatter.editorManager.domNode.blockParentNode(this.startNode);
@@ -36179,7 +36232,7 @@ class EnterKeyAction {
36179
36232
  }
36180
36233
  else {
36181
36234
  if ((nearBlockNode.textContent.trim().length !== 0 ||
36182
- nearBlockNode.childNodes[0].nodeName === 'IMG' ||
36235
+ (!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG') ||
36183
36236
  (nearBlockNode.textContent.trim() === '' && nearBlockNode.querySelectorAll('img, audio, video').length > 0))) {
36184
36237
  if ((this.range.startOffset === this.range.endOffset && this.range.startOffset !== 0)) {
36185
36238
  newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, false).cloneNode(true);
@@ -37293,8 +37346,12 @@ let RichTextEditor = class RichTextEditor extends Component {
37293
37346
  keyDown(e) {
37294
37347
  if (this.inputElement.classList.contains('e-mention')) {
37295
37348
  const mentionPopup = this.inputElement.ownerDocument.getElementById(this.inputElement.id + '_popup');
37349
+ const slashMenuPopup = this.inputElement.ownerDocument.getElementById(this.inputElement.id + '_slash_menu_popup');
37296
37350
  const mentionKeys = mentionRestrictKeys;
37297
- if (mentionKeys.indexOf(e.key) !== -1 && mentionPopup && mentionPopup.classList.contains('e-popup-open')) {
37351
+ const isMentionKeys = mentionKeys.indexOf(e.key) !== -1;
37352
+ const isMentionPopupOpen = mentionPopup && mentionPopup.classList.contains('e-popup-open');
37353
+ const isSlashMenuPopupOpen = slashMenuPopup && slashMenuPopup.classList.contains('e-popup-open');
37354
+ if (isMentionKeys && (isMentionPopupOpen || isSlashMenuPopupOpen)) {
37298
37355
  return;
37299
37356
  }
37300
37357
  }