@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.
@@ -13698,14 +13698,18 @@ var InsertHtml = /** @__PURE__ @class */ (function () {
13698
13698
  };
13699
13699
  InsertHtml.removeEmptyElements = function (element) {
13700
13700
  var emptyElements = element.querySelectorAll(':empty');
13701
- for (var i = 0; i < emptyElements.length; i++) {
13701
+ var nonSvgEmptyElements = Array.from(emptyElements).filter(function (element) {
13702
+ // Check if the element is an SVG element or an ancestor of an SVG element
13703
+ return !element.closest('svg') && !element.closest('canvas');
13704
+ });
13705
+ for (var i = 0; i < nonSvgEmptyElements.length; i++) {
13702
13706
  var lineWithDiv = true;
13703
- if (emptyElements[i].tagName === 'DIV') {
13704
- lineWithDiv = emptyElements[i].style.borderBottom === 'none' ||
13705
- emptyElements[i].style.borderBottom === '' ? true : false;
13707
+ if (nonSvgEmptyElements[i].tagName === 'DIV') {
13708
+ lineWithDiv = nonSvgEmptyElements[i].style.borderBottom === 'none' ||
13709
+ nonSvgEmptyElements[i].style.borderBottom === '' ? true : false;
13706
13710
  }
13707
- if (SELF_CLOSING_TAGS.indexOf(emptyElements[i].tagName.toLowerCase()) < 0 && lineWithDiv) {
13708
- var detachableElement = this.findDetachEmptyElem(emptyElements[i]);
13711
+ if (SELF_CLOSING_TAGS.indexOf(nonSvgEmptyElements[i].tagName.toLowerCase()) < 0 && lineWithDiv) {
13712
+ var detachableElement = this.findDetachEmptyElem(nonSvgEmptyElements[i]);
13709
13713
  if (!isNullOrUndefined(detachableElement)) {
13710
13714
  detach(detachableElement);
13711
13715
  }
@@ -13821,6 +13825,12 @@ var LinkCommand = /** @__PURE__ @class */ (function () {
13821
13825
  || e.event.keyCode === 13) || e.item.action === 'Paste' || range.collapsed || text) {
13822
13826
  var anchor = this.createAchorNode(e);
13823
13827
  anchor.innerText = e.item.text === '' ? e.item.url : e.item.text;
13828
+ var text_1 = anchor.innerText;
13829
+ // Replace spaces with non-breaking spaces
13830
+ var modifiedText = text_1.replace(/ +/g, function (match) {
13831
+ return '\u00A0'.repeat(match.length);
13832
+ });
13833
+ anchor.innerText = modifiedText;
13824
13834
  e.item.selection.restore();
13825
13835
  InsertHtml.Insert(this.parent.currentDocument, anchor, this.parent.editableElement);
13826
13836
  if (e.event && e.event.type === 'keydown' && (e.event.keyCode === 32
@@ -25336,9 +25346,10 @@ var Image$1 = /** @__PURE__ @class */ (function () {
25336
25346
  var getAlt = (e.selectNode[0].getAttribute('alt') === null) ? '' :
25337
25347
  e.selectNode[0].getAttribute('alt');
25338
25348
  var content = '<div class="e-rte-field' + ' ' + this.parent.cssClass + '">' +
25339
- '<input type="text" spellcheck="false" value="' + getAlt + '" class="e-input e-img-alt' + ' ' + this.parent.cssClass + '" placeholder="' + altText + '"/>' +
25349
+ '<input type="text" spellcheck="false" class="e-input e-img-alt' + ' ' + this.parent.cssClass + '" placeholder="' + altText + '"/>' +
25340
25350
  '</div>';
25341
25351
  var contentElem = parseHtml(content);
25352
+ contentElem.querySelector('input').setAttribute('value', getAlt);
25342
25353
  altWrap.appendChild(contentElem);
25343
25354
  var inputAlt = altWrap.querySelector('.e-img-alt');
25344
25355
  var altArgs_1 = {
@@ -25874,14 +25885,12 @@ var Image$1 = /** @__PURE__ @class */ (function () {
25874
25885
  this.changedWidthValue = null;
25875
25886
  this.changedHeightValue = null;
25876
25887
  var content = '<div class="e-rte-label' + ' ' + this.parent.cssClass + '"><label>' + imgWidth +
25877
- '</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '"><input type="text" id="imgwidth" class="e-img-width' + ' ' + this.parent.cssClass + '" value=' +
25878
- widthVal
25879
- + ' /></div>' +
25888
+ '</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '"><input type="text" id="imgwidth" class="e-img-width' + ' ' + this.parent.cssClass + '/></div>' +
25880
25889
  '<div class="e-rte-label' + ' ' + this.parent.cssClass + '">' + '<label>' + imgHeight + '</label></div><div class="e-rte-field' + ' ' + this.parent.cssClass + '"> ' +
25881
- '<input type="text" id="imgheight" class="e-img-height' + ' ' + this.parent.cssClass + '" value=' +
25882
- heightVal
25883
- + ' /></div>';
25890
+ '<input type="text" id="imgheight" class="e-img-height' + ' ' + this.parent.cssClass + '"/></div>';
25884
25891
  var contentElem = parseHtml(content);
25892
+ contentElem.getElementById('imgwidth').setAttribute('value', widthVal);
25893
+ contentElem.getElementById('imgheight').setAttribute('value', heightVal);
25885
25894
  imgSizeWrap.appendChild(contentElem);
25886
25895
  this.widthNum = new TextBox({
25887
25896
  value: formatUnit(widthVal),
@@ -31995,6 +32004,14 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
31995
32004
  else if ((this.parent.enterKey === 'P' && !shiftKey) || (this.parent.shiftEnterKey === 'P' && shiftKey)) {
31996
32005
  insertElem = this.parent.createElement('p');
31997
32006
  }
32007
+ var previousBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].previousSibling;
32008
+ var nextBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].nextSibling;
32009
+ if (!isNullOrUndefined(previousBlockNode) && previousBlockNode.hasAttribute('style')) {
32010
+ insertElem.setAttribute('style', previousBlockNode.getAttribute('style'));
32011
+ }
32012
+ if (isNullOrUndefined(previousBlockNode) && !isNullOrUndefined(nextBlockNode) && nextBlockNode.hasAttribute('style')) {
32013
+ insertElem.setAttribute('style', nextBlockNode.getAttribute('style'));
32014
+ }
31998
32015
  return insertElem;
31999
32016
  };
32000
32017
  return EnterKeyAction;