@syncfusion/ej2-richtexteditor 23.1.43 → 23.1.44

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.
@@ -13600,14 +13600,18 @@ class InsertHtml {
13600
13600
  }
13601
13601
  static removeEmptyElements(element) {
13602
13602
  const emptyElements = element.querySelectorAll(':empty');
13603
- for (let i = 0; i < emptyElements.length; i++) {
13603
+ const nonSvgEmptyElements = Array.from(emptyElements).filter(element => {
13604
+ // Check if the element is an SVG element or an ancestor of an SVG element
13605
+ return !element.closest('svg') && !element.closest('canvas');
13606
+ });
13607
+ for (let i = 0; i < nonSvgEmptyElements.length; i++) {
13604
13608
  let lineWithDiv = true;
13605
- if (emptyElements[i].tagName === 'DIV') {
13606
- lineWithDiv = emptyElements[i].style.borderBottom === 'none' ||
13607
- emptyElements[i].style.borderBottom === '' ? true : false;
13609
+ if (nonSvgEmptyElements[i].tagName === 'DIV') {
13610
+ lineWithDiv = nonSvgEmptyElements[i].style.borderBottom === 'none' ||
13611
+ nonSvgEmptyElements[i].style.borderBottom === '' ? true : false;
13608
13612
  }
13609
- if (SELF_CLOSING_TAGS.indexOf(emptyElements[i].tagName.toLowerCase()) < 0 && lineWithDiv) {
13610
- const detachableElement = this.findDetachEmptyElem(emptyElements[i]);
13613
+ if (SELF_CLOSING_TAGS.indexOf(nonSvgEmptyElements[i].tagName.toLowerCase()) < 0 && lineWithDiv) {
13614
+ const detachableElement = this.findDetachEmptyElem(nonSvgEmptyElements[i]);
13611
13615
  if (!isNullOrUndefined(detachableElement)) {
13612
13616
  detach(detachableElement);
13613
13617
  }
@@ -13722,6 +13726,12 @@ class LinkCommand {
13722
13726
  || e.event.keyCode === 13) || e.item.action === 'Paste' || range.collapsed || text) {
13723
13727
  const anchor = this.createAchorNode(e);
13724
13728
  anchor.innerText = e.item.text === '' ? e.item.url : e.item.text;
13729
+ const text = anchor.innerText;
13730
+ // Replace spaces with non-breaking spaces
13731
+ const modifiedText = text.replace(/ +/g, function (match) {
13732
+ return '\u00A0'.repeat(match.length);
13733
+ });
13734
+ anchor.innerText = modifiedText;
13725
13735
  e.item.selection.restore();
13726
13736
  InsertHtml.Insert(this.parent.currentDocument, anchor, this.parent.editableElement);
13727
13737
  if (e.event && e.event.type === 'keydown' && (e.event.keyCode === 32
@@ -25227,9 +25237,10 @@ class Image$1 {
25227
25237
  const getAlt = (e.selectNode[0].getAttribute('alt') === null) ? '' :
25228
25238
  e.selectNode[0].getAttribute('alt');
25229
25239
  const content = '<div class="e-rte-field' + ' ' + this.parent.cssClass + '">' +
25230
- '<input type="text" spellcheck="false" value="' + getAlt + '" class="e-input e-img-alt' + ' ' + this.parent.cssClass + '" placeholder="' + altText + '"/>' +
25240
+ '<input type="text" spellcheck="false" class="e-input e-img-alt' + ' ' + this.parent.cssClass + '" placeholder="' + altText + '"/>' +
25231
25241
  '</div>';
25232
25242
  const contentElem = parseHtml(content);
25243
+ contentElem.querySelector('input').setAttribute('value', getAlt);
25233
25244
  altWrap.appendChild(contentElem);
25234
25245
  const inputAlt = altWrap.querySelector('.e-img-alt');
25235
25246
  const altArgs = {
@@ -25761,14 +25772,12 @@ class Image$1 {
25761
25772
  this.changedWidthValue = null;
25762
25773
  this.changedHeightValue = null;
25763
25774
  const content = '<div class="e-rte-label' + ' ' + this.parent.cssClass + '"><label>' + imgWidth +
25764
- '</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '"><input type="text" id="imgwidth" class="e-img-width' + ' ' + this.parent.cssClass + '" value=' +
25765
- widthVal
25766
- + ' /></div>' +
25775
+ '</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '"><input type="text" id="imgwidth" class="e-img-width' + ' ' + this.parent.cssClass + '/></div>' +
25767
25776
  '<div class="e-rte-label' + ' ' + this.parent.cssClass + '">' + '<label>' + imgHeight + '</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '"> ' +
25768
- '<input type="text" id="imgheight" class="e-img-height' + ' ' + this.parent.cssClass + '" value=' +
25769
- heightVal
25770
- + ' /></div>';
25777
+ '<input type="text" id="imgheight" class="e-img-height' + ' ' + this.parent.cssClass + '"/></div>';
25771
25778
  const contentElem = parseHtml(content);
25779
+ contentElem.getElementById('imgwidth').setAttribute('value', widthVal);
25780
+ contentElem.getElementById('imgheight').setAttribute('value', heightVal);
25772
25781
  imgSizeWrap.appendChild(contentElem);
25773
25782
  this.widthNum = new TextBox({
25774
25783
  value: formatUnit(widthVal),
@@ -31711,6 +31720,14 @@ class EnterKeyAction {
31711
31720
  else if ((this.parent.enterKey === 'P' && !shiftKey) || (this.parent.shiftEnterKey === 'P' && shiftKey)) {
31712
31721
  insertElem = this.parent.createElement('p');
31713
31722
  }
31723
+ const previousBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].previousSibling;
31724
+ const nextBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].nextSibling;
31725
+ if (!isNullOrUndefined(previousBlockNode) && previousBlockNode.hasAttribute('style')) {
31726
+ insertElem.setAttribute('style', previousBlockNode.getAttribute('style'));
31727
+ }
31728
+ if (isNullOrUndefined(previousBlockNode) && !isNullOrUndefined(nextBlockNode) && nextBlockNode.hasAttribute('style')) {
31729
+ insertElem.setAttribute('style', nextBlockNode.getAttribute('style'));
31730
+ }
31714
31731
  return insertElem;
31715
31732
  }
31716
31733
  }