@syncfusion/ej2-richtexteditor 26.2.8 → 26.2.10

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.
@@ -26865,6 +26865,12 @@ var SelectionCommands = /** @__PURE__ @class */ (function () {
26865
26865
  if (cursorNodes.length === 1 && range.startOffset === 0 && (cursorNodes[0].nodeName === 'BR' || (isNullOrUndefined(cursorNodes[0].nextSibling) ? false : cursorNodes[0].nextSibling.nodeName === 'BR'))) {
26866
26866
  detach(cursorNodes[0].nodeName === '#text' ? cursorNodes[0].nextSibling : cursorNodes[0]);
26867
26867
  }
26868
+ if (!isNullOrUndefined(cursorNodes[0].parentElement) && IsFormatted.inlineTags.
26869
+ indexOf((cursorNodes[0].parentElement).tagName.toLowerCase()) !== -1 && cursorNodes[0].textContent.includes('\u200B')) {
26870
+ var element = this.GetFormatNode(format, value);
26871
+ this.applyStyles(cursorNodes, 0, element);
26872
+ return cursorNodes[0];
26873
+ }
26868
26874
  cursorNode = this.getInsertNode(docElement, range, format, value).firstChild;
26869
26875
  }
26870
26876
  return cursorNode;
@@ -30935,7 +30941,7 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
30935
30941
  };
30936
30942
  HtmlEditor.prototype.onKeyUp = function (e) {
30937
30943
  var args = e.args;
30938
- var restrictKeys = [8, 9, 13, 16, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
30944
+ var restrictKeys = [8, 9, 13, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
30939
30945
  112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123];
30940
30946
  var range = this.parent.getRange();
30941
30947
  var regEx = new RegExp('\u200B', 'g');
@@ -30943,9 +30949,18 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
30943
30949
  range.startOffset === 1 && range.startContainer.textContent.length === 1 &&
30944
30950
  range.startContainer.textContent.charCodeAt(0) === 8203 &&
30945
30951
  range.startContainer.textContent.replace(regEx, '').length === 0;
30952
+ var isMention = false;
30953
+ if (range.startContainer === range.endContainer &&
30954
+ range.startOffset === range.endOffset && (range.startContainer !== this.parent.inputElement && range.startOffset !== 0)) {
30955
+ var mentionStartNode = range.startContainer.nodeType === 3 ?
30956
+ range.startContainer : range.startContainer.childNodes[range.startOffset - 1];
30957
+ isMention = args.keyCode === 16 &&
30958
+ mentionStartNode.textContent.charCodeAt(0) === 8203 &&
30959
+ !isNullOrUndefined(mentionStartNode.previousSibling) && mentionStartNode.previousSibling.contentEditable === 'false';
30960
+ }
30946
30961
  var pointer;
30947
30962
  var isRootParent = false;
30948
- if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode) {
30963
+ if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode && !isMention) {
30949
30964
  pointer = range.startOffset;
30950
30965
  var container = range.startContainer;
30951
30966
  // Check if the container is a text node and contains a zero-width space
@@ -32130,9 +32145,7 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
32130
32145
  dropArea: this.parent.inputElement,
32131
32146
  allowedExtensions: this.parent.insertImageSettings.allowedTypes.toString(),
32132
32147
  success: function (e) {
32133
- _this.popupCloseTime = setTimeout(function () {
32134
- _this.popupClose(_this.popupObj, _this.uploadObj, imgElem, e);
32135
- }, 900);
32148
+ _this.popupClose(_this.popupObj, _this.uploadObj, imgElem, e);
32136
32149
  },
32137
32150
  uploading: function (e) {
32138
32151
  if (!_this.parent.isServerRendered) {
@@ -32214,30 +32227,31 @@ var PasteCleanup = /** @__PURE__ @class */ (function () {
32214
32227
  this.parent.inputElement.contentEditable = 'true';
32215
32228
  e.element = imgElem;
32216
32229
  e.detectImageSource = ImageInputSource.Pasted;
32217
- uploadObj.filesData.forEach(function (element) {
32218
- if (element.statusCode === '2') {
32219
- _this.parent.trigger(imageUploadSuccess, e, function (e) {
32220
- if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
32221
- var url = _this.parent.insertImageSettings.path + e.file.name;
32222
- imgElem.src = url;
32223
- imgElem.setAttribute('alt', e.file.name);
32224
- }
32225
- });
32226
- }
32227
- else if (element.statusCode === '5') {
32228
- _this.parent.trigger(imageRemoving, e, function (e) {
32229
- if (!isNullOrUndefined(e.element.src)) {
32230
- e.element.src = '';
32231
- }
32232
- });
32233
- }
32234
- });
32235
- popupObj.close();
32236
- imgElem.style.opacity = '1';
32237
- if (uploadObj && document.body.contains(uploadObj.element)) {
32238
- uploadObj.destroy();
32230
+ var element = e.file;
32231
+ if (element.statusCode === '2') {
32232
+ this.parent.trigger(imageUploadSuccess, e, function (e) {
32233
+ if (!isNullOrUndefined(_this.parent.insertImageSettings.path)) {
32234
+ var url = _this.parent.insertImageSettings.path + e.file.name;
32235
+ imgElem.src = url;
32236
+ imgElem.setAttribute('alt', e.file.name);
32237
+ }
32238
+ });
32239
32239
  }
32240
- this.toolbarEnableDisable(false);
32240
+ else if (element.statusCode === '5') {
32241
+ this.parent.trigger(imageRemoving, e, function (e) {
32242
+ if (!isNullOrUndefined(e.element.src)) {
32243
+ e.element.src = '';
32244
+ }
32245
+ });
32246
+ }
32247
+ this.popupCloseTime = setTimeout(function () {
32248
+ popupObj.close();
32249
+ imgElem.style.opacity = '1';
32250
+ this.toolbarEnableDisable(false);
32251
+ if (uploadObj && document.body.contains(uploadObj.element)) {
32252
+ uploadObj.destroy();
32253
+ }
32254
+ }.bind(this), 1500);
32241
32255
  };
32242
32256
  PasteCleanup.prototype.refreshPopup = function (imageElement, popupObj) {
32243
32257
  var imgPosition = this.parent.iframeSettings.enable ? this.parent.element.offsetTop +
@@ -36961,7 +36975,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
36961
36975
  this.inputElement.innerHTML = this.enterKey !== 'BR' ? '<' + this.enterKey + '><br></' + this.enterKey + '>' : '<br>';
36962
36976
  this.isSelectAll = false;
36963
36977
  }
36964
- if (selection.rangeCount > 0 && this.contentModule.getDocument().activeElement.tagName !== 'INPUT' && this.inputElement.contains(this.contentModule.getDocument().activeElement)) {
36978
+ if (selection.rangeCount > 0 && this.contentModule.getDocument().activeElement.tagName !== 'INPUT' && this.inputElement.contains(this.contentModule.getDocument().activeElement) && range.startContainer.innerHTML === '<br>' && range.startContainer.textContent === '') {
36965
36979
  selection.removeAllRanges();
36966
36980
  selection.addRange(currentRange);
36967
36981
  }
@@ -37224,6 +37238,10 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
37224
37238
  clearInterval(this.timeInterval);
37225
37239
  this.timeInterval = null;
37226
37240
  }
37241
+ if (!isNullOrUndefined(this.autoSaveTimeOut)) {
37242
+ clearTimeout(this.autoSaveTimeOut);
37243
+ this.autoSaveTimeOut = null;
37244
+ }
37227
37245
  if (!isNullOrUndefined(this.idleInterval)) {
37228
37246
  clearTimeout(this.idleInterval);
37229
37247
  this.idleInterval = null;
@@ -38258,7 +38276,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
38258
38276
  }
38259
38277
  this.preventDefaultResize(e);
38260
38278
  this.trigger('focus', { event: e, isInteracted: Object.keys(e).length === 0 ? false : true });
38261
- if (!isNullOrUndefined(this.saveInterval) && this.saveInterval > 0 && !this.autoSaveOnIdle) {
38279
+ if (!isNullOrUndefined(this.saveInterval) && this.saveInterval > 0 && !this.autoSaveOnIdle && isNullOrUndefined(this.timeInterval)) {
38262
38280
  this.timeInterval = setInterval(this.updateValueOnIdle.bind(this), this.saveInterval);
38263
38281
  }
38264
38282
  EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
@@ -38427,8 +38445,8 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
38427
38445
  RichTextEditor.prototype.contentChanged = function () {
38428
38446
  if (this.autoSaveOnIdle) {
38429
38447
  if (!isNullOrUndefined(this.saveInterval)) {
38430
- clearTimeout(this.timeInterval);
38431
- this.timeInterval = setTimeout(this.updateIntervalValue.bind(this), this.saveInterval);
38448
+ clearTimeout(this.autoSaveTimeOut);
38449
+ this.autoSaveTimeOut = setTimeout(this.updateIntervalValue.bind(this), this.saveInterval);
38432
38450
  }
38433
38451
  }
38434
38452
  };