@syncfusion/ej2-richtexteditor 27.1.50 → 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.
@@ -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
  });
@@ -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
  }
@@ -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);
@@ -29274,15 +29298,22 @@ class MsWordPaste {
29274
29298
  const styleProperty = resultElem[j].getAttribute('style');
29275
29299
  if (!isNullOrUndefined(styleProperty) && styleProperty.trim() !== '') {
29276
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
+ }
29277
29307
  if (!fromClass) {
29278
29308
  for (let k = 0; k < valueSplit.length; k++) {
29279
- if (styleProperty.indexOf(valueSplit[k].split(':')[0]) >= 0) {
29309
+ const propertyName = valueSplit[k].split(':')[0];
29310
+ if (styleProperty.includes(propertyName + ':')) {
29280
29311
  valueSplit.splice(k, 1);
29281
29312
  k--;
29282
29313
  }
29283
29314
  }
29284
29315
  }
29285
- const changedValue = styleProperty + valueSplit.join(';') + ';';
29316
+ const changedValue = valueSplit.join(';') + ';' + styleProperty;
29286
29317
  resultElem[j].setAttribute('style', changedValue);
29287
29318
  }
29288
29319
  else {
@@ -31832,12 +31863,13 @@ class HtmlEditor {
31832
31863
  this.isImageDelete = false;
31833
31864
  }
31834
31865
  const brNode = this.deleteRangeElement.querySelector('BR');
31866
+ const brLastChildNode = this.deleteRangeElement.lastChild;
31835
31867
  if (brNode && brNode.classList.contains('e-rte-image-remove-focus')) {
31836
31868
  removeClass([brNode], ['e-rte-image-focus']);
31837
31869
  return;
31838
31870
  }
31839
- else if (brNode) {
31840
- detach(brNode);
31871
+ else if (brNode && brLastChildNode && brLastChildNode.nodeName === 'BR') {
31872
+ detach(brLastChildNode);
31841
31873
  e.args.preventDefault();
31842
31874
  }
31843
31875
  if (!isNullOrUndefined(this.deleteRangeElement) && (this.deleteOldRangeElement.tagName !== 'OL' && this.deleteOldRangeElement.tagName !== 'UL')
@@ -32417,12 +32449,12 @@ class PasteCleanup {
32417
32449
  if (e.args && !isNullOrUndefined(e.args.clipboardData)) {
32418
32450
  value = e.args.clipboardData.getData('text/html');
32419
32451
  }
32420
- this.parent.trigger(beforePasteCleanup, { value: value });
32421
32452
  if (e.args && value !== null && this.parent.editorMode === 'HTML') {
32422
32453
  let file;
32423
32454
  if (value.length === 0) {
32424
32455
  const htmlRegex = new RegExp(/<\/[a-z][\s\S]*>/i);
32425
32456
  value = e.args.clipboardData.getData('text/plain');
32457
+ this.parent.trigger(beforePasteCleanup, { value: value });
32426
32458
  this.isNotFromHtml = value !== '' ? true : false;
32427
32459
  value = value.replace(/</g, '&lt;');
32428
32460
  value = value.replace(/>/g, '&gt;');
@@ -32455,6 +32487,7 @@ class PasteCleanup {
32455
32487
  }
32456
32488
  }
32457
32489
  else if (value.length > 0) {
32490
+ this.parent.trigger(beforePasteCleanup, { value: value });
32458
32491
  this.parent.formatter.editorManager.observer.notify(MS_WORD_CLEANUP, {
32459
32492
  args: e.args,
32460
32493
  text: e.text,
@@ -36146,7 +36179,12 @@ class EnterKeyAction {
36146
36179
  else {
36147
36180
  let nearBlockNode;
36148
36181
  if (isTableEnter && this.parent.formatter.editorManager.domNode.isBlockNode(this.startNode)) {
36149
- 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
+ }
36150
36188
  }
36151
36189
  else {
36152
36190
  nearBlockNode = this.parent.formatter.editorManager.domNode.blockParentNode(this.startNode);
@@ -36194,7 +36232,7 @@ class EnterKeyAction {
36194
36232
  }
36195
36233
  else {
36196
36234
  if ((nearBlockNode.textContent.trim().length !== 0 ||
36197
- nearBlockNode.childNodes[0].nodeName === 'IMG' ||
36235
+ (!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG') ||
36198
36236
  (nearBlockNode.textContent.trim() === '' && nearBlockNode.querySelectorAll('img, audio, video').length > 0))) {
36199
36237
  if ((this.range.startOffset === this.range.endOffset && this.range.startOffset !== 0)) {
36200
36238
  newElem = this.parent.formatter.editorManager.nodeCutter.SplitNode(this.range, nearBlockNode, false).cloneNode(true);