@syncfusion/ej2-richtexteditor 24.2.8 → 24.2.9

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 24.2.8
3
+ * version : 24.2.9
4
4
  * Copyright Syncfusion Inc. 2001 - 2023. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-richtexteditor@*",
3
- "_id": "@syncfusion/ej2-richtexteditor@24.2.7",
3
+ "_id": "@syncfusion/ej2-richtexteditor@24.2.8",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-LAwzVB7DsDIemywqqLxTjUPWekzjmy1o9UDLYXMT+MHewJcUqD6wVlupgs4/Tej+ZAE275Bt25VKHA/Zl06IMg==",
5
+ "_integrity": "sha512-RiTlxXAeoPOeO3I9n1A4XHgDuna06LrHQgt08fEpnjhBE38mAzyH68yRzCtrUlVnoVqTPOvJJ83rLI2VDDlC1w==",
6
6
  "_location": "/@syncfusion/ej2-richtexteditor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -25,8 +25,8 @@
25
25
  "/@syncfusion/ej2-react-richtexteditor",
26
26
  "/@syncfusion/ej2-vue-richtexteditor"
27
27
  ],
28
- "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-24.2.7.tgz",
29
- "_shasum": "4baefba0381f2363ff721f0972d9319c4edf05ab",
28
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-24.2.8.tgz",
29
+ "_shasum": "f966e83e1230cc284396b8ec962f1df25c80d5a9",
30
30
  "_spec": "@syncfusion/ej2-richtexteditor@*",
31
31
  "_where": "/jenkins/workspace/elease-automation_release_24.1.1/packages/included",
32
32
  "author": {
@@ -40,9 +40,9 @@
40
40
  "@syncfusion/ej2-base": "~24.2.7",
41
41
  "@syncfusion/ej2-buttons": "~24.2.7",
42
42
  "@syncfusion/ej2-filemanager": "~24.2.7",
43
- "@syncfusion/ej2-inputs": "~24.2.7",
43
+ "@syncfusion/ej2-inputs": "~24.2.9",
44
44
  "@syncfusion/ej2-navigations": "~24.2.8",
45
- "@syncfusion/ej2-popups": "~24.2.8",
45
+ "@syncfusion/ej2-popups": "~24.2.9",
46
46
  "@syncfusion/ej2-splitbuttons": "~24.2.7"
47
47
  },
48
48
  "deprecated": false,
@@ -69,6 +69,6 @@
69
69
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
70
70
  },
71
71
  "typings": "index.d.ts",
72
- "version": "24.2.8",
72
+ "version": "24.2.9",
73
73
  "sideEffects": false
74
74
  }
@@ -211,7 +211,12 @@ var InsertHtml = /** @class */ (function () {
211
211
  CONSTANT.TABLE_BLOCK_TAGS.indexOf(closestParentNode.tagName.toLocaleLowerCase()) !== -1))
212
212
  || (node.nodeName.toLowerCase() === 'table' && closestParentNode &&
213
213
  CONSTANT.TABLE_BLOCK_TAGS.indexOf(closestParentNode.tagName.toLocaleLowerCase()) === -1))) {
214
- preNode = nodeCutter.GetSpliceNode(range, closestParentNode);
214
+ if (isCollapsed) {
215
+ preNode = nodeCutter.SplitNode(range, closestParentNode, true);
216
+ }
217
+ else {
218
+ preNode = nodeCutter.SplitNode(range, closestParentNode, false);
219
+ }
215
220
  sibNode = isNOU(preNode.previousSibling) ? preNode.parentNode.previousSibling : preNode.previousSibling;
216
221
  if (nodes.length === 1) {
217
222
  nodeSelection.setSelectionContents(docElement, preNode);
@@ -298,6 +303,9 @@ var InsertHtml = /** @class */ (function () {
298
303
  var paraElm = void 0;
299
304
  var previousParent = void 0;
300
305
  if (!this.contentsDeleted) {
306
+ if (!isCollapsed && range.startContainer.parentElement.textContent.length === 0 && range.startContainer.nodeName === 'BR' && range.startContainer.parentElement.nodeName === 'P') {
307
+ editNode.removeChild(range.startContainer.parentElement);
308
+ }
301
309
  range.deleteContents();
302
310
  }
303
311
  while (node.firstChild) {
@@ -21,6 +21,7 @@ export declare class MsWordPaste {
21
21
  private addEventListener;
22
22
  private cropImageDimensions;
23
23
  private wordCleanup;
24
+ private addDoubleBr;
24
25
  private cleanList;
25
26
  private insertAfter;
26
27
  private findClosestListElem;
@@ -1,5 +1,5 @@
1
1
  import * as EVENTS from '../../common/constant';
2
- import { createElement, isNullOrUndefined as isNOU, detach, addClass } from '@syncfusion/ej2-base';
2
+ import { createElement, isNullOrUndefined as isNOU, detach, addClass, Browser } from '@syncfusion/ej2-base';
3
3
  import { PASTE_SOURCE } from '../base/constant';
4
4
  /**
5
5
  * PasteCleanup for MsWord content
@@ -61,6 +61,7 @@ var MsWordPaste = /** @class */ (function () {
61
61
  var elm = createElement('p');
62
62
  elm.setAttribute('id', 'MSWord-Content');
63
63
  elm.innerHTML = tempHTMLContent;
64
+ this.addDoubleBr(elm);
64
65
  var patern = /class='?Mso|style='[^ ]*\bmso-/i;
65
66
  var patern2 = /class="?Mso|style="[^ ]*\bmso-/i;
66
67
  var patern3 = /(class="?Mso|class='?Mso|class="?Xl|class='?Xl|class=Xl|style="[^"]*\bmso-|style='[^']*\bmso-|w:WordDocument)/gi;
@@ -95,6 +96,26 @@ var MsWordPaste = /** @class */ (function () {
95
96
  e.callBack(elm.innerHTML);
96
97
  }
97
98
  };
99
+ MsWordPaste.prototype.addDoubleBr = function (elm) {
100
+ var newline = elm.querySelector('.Apple-interchange-newline');
101
+ if (!isNOU(newline) && Browser.userAgent.indexOf('Chrome') !== -1 && newline.parentElement.nodeName === 'P' && elm !== newline.parentElement) {
102
+ for (var i = 0; i < elm.childNodes.length; i++) {
103
+ // eslint-disable-next-line
104
+ var node = elm.childNodes[i];
105
+ if (node.nodeType === Node.COMMENT_NODE && node.nodeValue.includes('StartFragment')) {
106
+ var newElement = document.createElement('p');
107
+ newElement.innerHTML = '<br>';
108
+ var cssText = newline.parentElement.style.cssText;
109
+ var currentStyle = newElement.getAttribute('style') || '';
110
+ var newStyle = currentStyle + cssText;
111
+ newElement.setAttribute('style', newStyle);
112
+ elm.insertBefore(newElement, node.nextSibling);
113
+ detach(newline);
114
+ break;
115
+ }
116
+ }
117
+ }
118
+ };
98
119
  MsWordPaste.prototype.cleanList = function (elm, listTag) {
99
120
  var replacableElem = elm.querySelectorAll(listTag + ' div');
100
121
  for (var j = replacableElem.length - 1; j >= 0; j--) {
@@ -223,6 +223,9 @@ var BaseQuickToolbar = /** @class */ (function () {
223
223
  _this.parent.disableToolbarItem(_this.parent.toolbarSettings.items);
224
224
  _this.parent.enableToolbarItem(['Undo', 'Redo']);
225
225
  }
226
+ else {
227
+ _this.parent.enableToolbarItem(_this.parent.toolbarSettings.items);
228
+ }
226
229
  append([_this.element], document.body);
227
230
  if (_this.parent.showTooltip) {
228
231
  _this.tooltip = new Tooltip({
@@ -64,7 +64,7 @@ var EmojiPicker = /** @class */ (function () {
64
64
  this.parent.getToolbar().appendChild(this.popDiv);
65
65
  }
66
66
  else if (this.parent.inlineMode.enable) {
67
- this.parent.inputElement.appendChild(this.popDiv);
67
+ this.parent.element.appendChild(this.popDiv);
68
68
  }
69
69
  EventHandler.add(this.popDiv, 'keydown', this.onKeyDown, this);
70
70
  EventHandler.add(this.popDiv, 'keyup', this.searchFilter, this);
@@ -485,10 +485,10 @@ var EnterKeyAction = /** @class */ (function () {
485
485
  }
486
486
  var previousBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].previousSibling;
487
487
  var nextBlockNode = this.parent.formatter.editorManager.domNode.blockNodes()[0].nextSibling;
488
- if (!isNOU(previousBlockNode) && previousBlockNode.hasAttribute('style') && previousBlockNode.nodeName !== 'TABLE') {
488
+ if (!isNOU(previousBlockNode) && previousBlockNode.nodeName !== '#text' && previousBlockNode.hasAttribute('style') && previousBlockNode.nodeName !== 'TABLE') {
489
489
  insertElem.setAttribute('style', previousBlockNode.getAttribute('style'));
490
490
  }
491
- if (isNOU(previousBlockNode) && !isNOU(nextBlockNode) && nextBlockNode.hasAttribute('style') && nextBlockNode.nodeName !== 'TABLE') {
491
+ if (isNOU(previousBlockNode) && !isNOU(nextBlockNode) && nextBlockNode.nodeName !== '#text' && nextBlockNode.hasAttribute('style') && nextBlockNode.nodeName !== 'TABLE') {
492
492
  insertElem.setAttribute('style', nextBlockNode.getAttribute('style'));
493
493
  }
494
494
  return insertElem;
@@ -425,9 +425,9 @@ var HtmlEditor = /** @class */ (function () {
425
425
  var liElement = this.getRangeLiNode(currentRange.startContainer);
426
426
  if (liElement.previousElementSibling && liElement.previousElementSibling.childElementCount > 0) {
427
427
  this.oldRangeElement = liElement.previousElementSibling.lastElementChild.nodeName === 'BR' ?
428
- liElement.previousElementSibling : liElement.previousElementSibling.lastElementChild;
428
+ liElement.previousElementSibling : liElement.previousElementSibling.lastChild;
429
429
  if (!isNOU(liElement.lastElementChild) && liElement.lastElementChild.nodeName !== 'BR' &&
430
- isNOU(liElement.lastElementChild.previousSibling)) {
430
+ isNOU(liElement.lastElementChild.previousSibling) && liElement.lastChild.nodeName !== "#text") {
431
431
  this.rangeElement = liElement.lastElementChild;
432
432
  isLiElement = true;
433
433
  }
@@ -452,7 +452,7 @@ var HtmlEditor = /** @class */ (function () {
452
452
  ? this.oldRangeElement.lastElementChild.lastElementChild :
453
453
  this.oldRangeElement.lastElementChild;
454
454
  }
455
- var lastNode = this.oldRangeElement.lastChild;
455
+ var lastNode = this.oldRangeElement.lastChild ? this.oldRangeElement.lastChild : this.oldRangeElement;
456
456
  while (lastNode.nodeType !== 3 && lastNode.nodeName !== '#text' &&
457
457
  lastNode.nodeName !== 'BR') {
458
458
  lastNode = lastNode.lastChild;
@@ -460,12 +460,17 @@ var HtmlEditor = /** @class */ (function () {
460
460
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(),
461
461
  // eslint-disable-next-line
462
462
  lastNode, lastNode.textContent.length);
463
- if (this.oldRangeElement.querySelectorAll('BR').length === 1) {
463
+ if (this.oldRangeElement.nodeName !== '#text' && this.oldRangeElement.querySelectorAll('BR').length === 1) {
464
464
  detach(this.oldRangeElement.querySelector('BR'));
465
465
  }
466
466
  if (!isNOU(this.rangeElement) && this.oldRangeElement !== this.rangeElement) {
467
467
  while (this.rangeElement.firstChild) {
468
- this.oldRangeElement.appendChild(this.rangeElement.childNodes[0]);
468
+ if (this.oldRangeElement.nodeName === '#text') {
469
+ this.oldRangeElement.parentElement.appendChild(this.rangeElement.childNodes[0]);
470
+ }
471
+ else {
472
+ this.oldRangeElement.appendChild(this.rangeElement.childNodes[0]);
473
+ }
469
474
  }
470
475
  // eslint-disable-next-line
471
476
  !isLiElement ? detach(this.rangeElement) : detach(this.rangeElement.parentElement);
@@ -149,7 +149,7 @@ var QuickToolbar = /** @class */ (function () {
149
149
 
150
150
  */
151
151
  QuickToolbar.prototype.showInlineQTBar = function (x, y, target) {
152
- if (isNOU(this.parent) || this.parent.readonly || target.tagName.toLowerCase() === 'img') {
152
+ if (isNOU(this.parent) || this.parent.readonly || target.tagName.toLowerCase() === 'img' || this.inlineQTBar.element.querySelector('.e-rte-color-content')) {
153
153
  return;
154
154
  }
155
155
  this.inlineQTBar.showPopup(x, y, target);