@syncfusion/ej2-richtexteditor 27.1.57 → 27.1.58

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 : 27.1.57
3
+ * version : 27.1.58
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@27.1.55",
3
+ "_id": "@syncfusion/ej2-richtexteditor@27.1.57",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-FkQvU6rbg+RgDWBi+nu3SpZ2kwoDNif3vbSxDqbVh3crbjTrl8mnEY2l9DPXgzMI8AKbrzkywhmbz+QU7Py+Xg==",
5
+ "_integrity": "sha512-wMfgyUUD6XFFD/6hxFprox/aI5dItkVOTwAOmA7bU4VsOGK5aT18rrfOU1JWs9BSpriRIe4/Ro83nnxnxcE6HQ==",
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-27.1.55.tgz",
29
- "_shasum": "a888e8865fd0e8182ac49c4f745d8f6f78b6bf6a",
28
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-27.1.57.tgz",
29
+ "_shasum": "b0b1c08b46fa0b7c3c5d5a1a24421007bb00ec43",
30
30
  "_spec": "@syncfusion/ej2-richtexteditor@*",
31
31
  "_where": "/jenkins/workspace/elease-automation_release_27.1.1/packages/included",
32
32
  "author": {
@@ -38,12 +38,12 @@
38
38
  "bundleDependencies": false,
39
39
  "dependencies": {
40
40
  "@syncfusion/ej2-base": "~27.1.55",
41
- "@syncfusion/ej2-buttons": "~27.1.53",
42
- "@syncfusion/ej2-dropdowns": "~27.1.57",
41
+ "@syncfusion/ej2-buttons": "~27.1.58",
42
+ "@syncfusion/ej2-dropdowns": "~27.1.58",
43
43
  "@syncfusion/ej2-filemanager": "~27.1.55",
44
- "@syncfusion/ej2-inputs": "~27.1.55",
45
- "@syncfusion/ej2-navigations": "~27.1.57",
46
- "@syncfusion/ej2-popups": "~27.1.57",
44
+ "@syncfusion/ej2-inputs": "~27.1.58",
45
+ "@syncfusion/ej2-navigations": "~27.1.58",
46
+ "@syncfusion/ej2-popups": "~27.1.58",
47
47
  "@syncfusion/ej2-splitbuttons": "~27.1.56"
48
48
  },
49
49
  "deprecated": false,
@@ -80,6 +80,6 @@
80
80
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
81
81
  },
82
82
  "typings": "index.d.ts",
83
- "version": "27.1.57",
83
+ "version": "27.1.58",
84
84
  "sideEffects": false
85
85
  }
@@ -50,7 +50,7 @@ var NodeCutter = /** @class */ (function () {
50
50
  fragment = this.spliceEmptyNode(fragment, false);
51
51
  if (fragment && fragment.childNodes.length > 0) {
52
52
  var isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG' && !(fragment.querySelectorAll('img').length > 0)
53
- && this.isRteElm(fragment) && fragment.textContent.trim() === '') ? true : false;
53
+ && this.isRteElm(fragment) && fragment.textContent.trim() === '' && fragment.textContent !== ' ' && fragment.textContent.charCodeAt(0) !== 160) ? true : false;
54
54
  if (!isEmpty) {
55
55
  if (node) {
56
56
  InsertMethods.AppendBefore(fragment, node);
@@ -71,7 +71,7 @@ var NodeCutter = /** @class */ (function () {
71
71
  fragment = this.spliceEmptyNode(fragment, true);
72
72
  if (fragment && fragment.childNodes.length > 0) {
73
73
  var isEmpty = (fragment.childNodes.length === 1 && fragment.childNodes[0].nodeName !== 'IMG'
74
- && this.isRteElm(fragment) && fragment.textContent.trim() === '') ? true : false;
74
+ && this.isRteElm(fragment) && fragment.textContent.trim() === '' && fragment.textContent !== ' ' && fragment.textContent.charCodeAt(0) !== 160) ? true : false;
75
75
  if (!isEmpty) {
76
76
  if (node) {
77
77
  InsertMethods.AppendBefore(fragment, node, true);
@@ -651,12 +651,16 @@ var HtmlEditor = /** @class */ (function () {
651
651
  }
652
652
  var brNode = this.deleteRangeElement.querySelector('BR');
653
653
  var brLastChildNode = this.deleteRangeElement.lastChild;
654
+ var brParentNode = brLastChildNode.parentNode;
654
655
  if (brNode && brNode.classList.contains('e-rte-image-remove-focus')) {
655
656
  removeClass([brNode], ['e-rte-image-focus']);
656
657
  return;
657
658
  }
658
659
  else if (brNode && brLastChildNode && brLastChildNode.nodeName === 'BR') {
659
660
  detach(brLastChildNode);
661
+ if (!isNullOrUndefined(brParentNode) && brParentNode.childNodes.length === 0) {
662
+ detach(brParentNode);
663
+ }
660
664
  e.args.preventDefault();
661
665
  }
662
666
  if (!isNullOrUndefined(this.deleteRangeElement) && (this.deleteOldRangeElement.tagName !== 'OL' && this.deleteOldRangeElement.tagName !== 'UL')
@@ -11,7 +11,7 @@ import * as EVENTS from './../../common/constant';
11
11
  import { RenderType, ImageInputSource } from '../base/enum';
12
12
  import { Uploader } from '@syncfusion/ej2-inputs';
13
13
  import * as classes from '../base/classes';
14
- import { sanitizeHelper, convertToBlob, getDefaultValue } from '../base/util';
14
+ import { sanitizeHelper, convertToBlob } from '../base/util';
15
15
  import { scrollToCursor } from '../../common/util';
16
16
  /**
17
17
  * PasteCleanup module called when pasting content in RichTextEditor
@@ -206,38 +206,62 @@ var PasteCleanup = /** @class */ (function () {
206
206
  }
207
207
  };
208
208
  PasteCleanup.prototype.splitBreakLine = function (value) {
209
- var enterSplitText = value.split('\n');
210
- var contentInnerElem = '';
209
+ var enterSplitText = value.split('\r\n\r\n');
210
+ var finalText = '';
211
211
  var startNode = this.parent.enterKey === 'P' ? '<p>' : (this.parent.enterKey === 'DIV' ? '<div>' : '');
212
212
  var endNode = this.parent.enterKey === 'P' ? '</p>' : (this.parent.enterKey === 'DIV' ? '</div>' : '<br>');
213
213
  for (var i = 0; i < enterSplitText.length; i++) {
214
- if (enterSplitText[i].trim() === '') {
215
- contentInnerElem += getDefaultValue(this.parent);
214
+ var content = enterSplitText[i];
215
+ var contentWithSpace = this.makeSpace(content);
216
+ var contentWithLineBreak = contentWithSpace.replace(/\r\n|\n/g, '<br>');
217
+ if (i === 0) {
218
+ if (this.parent.enterKey === 'BR') {
219
+ finalText += (contentWithLineBreak + endNode);
220
+ }
221
+ else {
222
+ finalText += contentWithLineBreak; // In order to merge the content in current line. No P/Div tag is added.
223
+ }
216
224
  }
217
225
  else {
218
- var contentWithSpace = this.makeSpace(enterSplitText[i]);
219
- contentInnerElem += (i === 0 && this.parent.enterKey !== 'BR' ? '<span>' : startNode) +
220
- (contentWithSpace.trim() === '' ? '<br>' : contentWithSpace.trim()) +
221
- (enterSplitText.length - 1 === i && this.parent.enterKey === 'BR' ? '' : (i === 0 && this.parent.enterKey !== 'BR' ? '</span>' : endNode));
226
+ if (this.parent.enterKey === 'BR') {
227
+ if (i === enterSplitText.length - 1) {
228
+ finalText += (contentWithLineBreak + endNode);
229
+ }
230
+ else {
231
+ finalText += (contentWithLineBreak + endNode + endNode);
232
+ }
233
+ }
234
+ else {
235
+ finalText += startNode + contentWithLineBreak + endNode;
236
+ }
222
237
  }
223
238
  }
224
- return contentInnerElem;
239
+ return finalText;
225
240
  };
226
- PasteCleanup.prototype.makeSpace = function (enterSplitText) {
227
- var contentWithSpace = '';
228
- var spaceBetweenContent = true;
229
- enterSplitText = enterSplitText.replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;');
230
- var spaceSplit = enterSplitText.split(' ');
231
- for (var j = 0; j < spaceSplit.length; j++) {
232
- if (spaceSplit[j].trim() === '') {
233
- contentWithSpace += spaceBetweenContent ? '&nbsp;' : ' ';
241
+ PasteCleanup.prototype.makeSpace = function (text) {
242
+ var spacedContent = '';
243
+ if (text === '') {
244
+ return text;
245
+ }
246
+ var lineBreakSplitText = text.split(' ');
247
+ for (var i = 0; i < lineBreakSplitText.length; i++) {
248
+ var currentText = lineBreakSplitText[i];
249
+ if (currentText === '') {
250
+ spacedContent += '&nbsp;';
251
+ }
252
+ else if (currentText === '\t') {
253
+ spacedContent += '&nbsp;&nbsp;&nbsp;&nbsp;';
234
254
  }
235
255
  else {
236
- spaceBetweenContent = false;
237
- contentWithSpace += spaceSplit[j] + ' ';
256
+ if (i > 0 && i < lineBreakSplitText.length) {
257
+ spacedContent += ' ';
258
+ }
259
+ spacedContent += currentText;
238
260
  }
239
261
  }
240
- return contentWithSpace;
262
+ spacedContent = spacedContent.replace(/\t/g, '&nbsp;&nbsp;&nbsp;&nbsp;');
263
+ spacedContent = spacedContent.replace(/&nbsp;&nbsp;/g, '&nbsp; ');
264
+ return spacedContent;
241
265
  };
242
266
  PasteCleanup.prototype.imgUploading = function (elm) {
243
267
  var allImgElm = elm.querySelectorAll('.pasteContent_Img');
@@ -781,7 +781,7 @@ var RichTextEditor = /** @class */ (function (_super) {
781
781
  }
782
782
  var notFormatPainterCopy = isNOU(e.action) ? true : (e.action !== 'format-copy' ? true : false);
783
783
  if (this.formatter.getUndoRedoStack().length === 0 && notFormatPainterCopy &&
784
- !(e.altKey || e.shiftKey || (e.altKey && e.shiftKey && e.which === 67))) {
784
+ !(e.altKey || (e.shiftKey && e.which === 16) || (e.altKey && e.shiftKey && e.which === 67))) {
785
785
  this.formatter.saveData();
786
786
  }
787
787
  var preventingMention = false;
@@ -1835,7 +1835,10 @@ var RichTextEditor = /** @class */ (function (_super) {
1835
1835
  var item = compiledTemplate[i];
1836
1836
  append([item], appendElem);
1837
1837
  }
1838
- this.setProperties({ value: appendElem.innerHTML.trim() });
1838
+ var content = appendElem.innerHTML.trim();
1839
+ if (content.length > 0) {
1840
+ this.setProperties({ value: content });
1841
+ }
1839
1842
  this.renderReactTemplates();
1840
1843
  }
1841
1844
  }
@@ -939,7 +939,9 @@ var Image = /** @class */ (function () {
939
939
  _this.parent.formatter.editorManager.nodeSelection.Clear(_this.contentModule.getDocument());
940
940
  _this.parent.formatter.editorManager.nodeSelection.setSelectionContents(_this.contentModule.getDocument(), target);
941
941
  _this.quickToolObj.imageQTBar.showPopup(args.pageX, pageY, target);
942
- _this.resizeStart(e.args, target);
942
+ if (_this.parent.insertImageSettings.resize === true) {
943
+ _this.resizeStart(e.args, target);
944
+ }
943
945
  }, 400);
944
946
  }
945
947
  else {
@@ -2422,7 +2424,9 @@ var Image = /** @class */ (function () {
2422
2424
  if (imageElement) {
2423
2425
  this.showImageQTbarTime = setTimeout(function () {
2424
2426
  _this.showImageQuickToolbar(args);
2425
- _this.resizeStart(e.args, imageElement);
2427
+ if (_this.parent.insertImageSettings.resize) {
2428
+ _this.resizeStart(e.args, imageElement);
2429
+ }
2426
2430
  }, 0);
2427
2431
  }
2428
2432
  };