@syncfusion/ej2-richtexteditor 19.3.55 → 19.3.57

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 : 19.3.55
3
+ * version : 19.3.57
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. 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@19.3.53",
3
+ "_id": "@syncfusion/ej2-richtexteditor@19.3.55",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-/w+XuY76VuYlFVyWhywJW+qPNC4qAsf4ICsEMJiaYSD0uMlEDlQdAEw56vCbKF+gMnWRUp0uBwCcRZYKPkFifQ==",
5
+ "_integrity": "sha512-D/DsRzXeFfRt5Dpl70MOKjgCZWbAvgLyeukh+TFdyGjtKeX3+QOcYK+UqdvSmOnjU1K006D1qL8HAWJJ+qko8w==",
6
6
  "_location": "/@syncfusion/ej2-richtexteditor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -26,8 +26,8 @@
26
26
  "/@syncfusion/ej2-react-richtexteditor",
27
27
  "/@syncfusion/ej2-vue-richtexteditor"
28
28
  ],
29
- "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-19.3.53.tgz",
30
- "_shasum": "ebf91ca62866526e3e847bbcb454f3d193c0bab2",
29
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-19.3.55.tgz",
30
+ "_shasum": "a67a4621ca30dd75181f6d3bf53341c29b0d0e0c",
31
31
  "_spec": "@syncfusion/ej2-richtexteditor@*",
32
32
  "_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
33
33
  "author": {
@@ -38,12 +38,12 @@
38
38
  },
39
39
  "bundleDependencies": false,
40
40
  "dependencies": {
41
- "@syncfusion/ej2-base": "~19.3.54",
41
+ "@syncfusion/ej2-base": "~19.3.56",
42
42
  "@syncfusion/ej2-buttons": "~19.3.53",
43
43
  "@syncfusion/ej2-filemanager": "~19.3.55",
44
- "@syncfusion/ej2-inputs": "~19.3.53",
45
- "@syncfusion/ej2-navigations": "~19.3.54",
46
- "@syncfusion/ej2-popups": "~19.3.53",
44
+ "@syncfusion/ej2-inputs": "~19.3.57",
45
+ "@syncfusion/ej2-navigations": "~19.3.57",
46
+ "@syncfusion/ej2-popups": "~19.3.57",
47
47
  "@syncfusion/ej2-splitbuttons": "~19.3.53"
48
48
  },
49
49
  "deprecated": false,
@@ -70,6 +70,6 @@
70
70
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
71
71
  },
72
72
  "typings": "index.d.ts",
73
- "version": "19.3.55",
73
+ "version": "19.3.57",
74
74
  "sideEffects": false
75
75
  }
@@ -370,7 +370,15 @@ var InsertHtml = /** @class */ (function () {
370
370
  tempSpan.parentNode.replaceChild(node, tempSpan);
371
371
  }
372
372
  else {
373
- var splitedElm = nodeCutter.GetSpliceNode(range, blockNode);
373
+ var currentNode = nodes[nodes.length - 1];
374
+ var splitedElm = void 0;
375
+ if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR') && !isNOU(currentNode.parentElement) &&
376
+ currentNode.parentElement.textContent.trim().length === 0 && !node.classList.contains('pasteContent')) {
377
+ splitedElm = currentNode;
378
+ }
379
+ else {
380
+ splitedElm = nodeCutter.GetSpliceNode(range, blockNode);
381
+ }
374
382
  splitedElm.parentNode.replaceChild(node, splitedElm);
375
383
  }
376
384
  }
@@ -13,6 +13,7 @@ export declare class EnterKeyAction {
13
13
  private removeEventListener;
14
14
  private getRangeNode;
15
15
  private enterHandler;
16
+ private insertBRElement;
16
17
  private insertFocusContent;
17
18
  private createInsertElement;
18
19
  }
@@ -89,12 +89,13 @@ var EnterKeyAction = /** @class */ (function () {
89
89
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.range.startContainer.childNodes[_this.range.startOffset], 0);
90
90
  _this.getRangeNode();
91
91
  }
92
- if (_this.parent.enterKey === 'P' || _this.parent.enterKey === 'DIV' ||
92
+ if ((_this.parent.enterKey === 'P' && !shiftKey_1) || (_this.parent.enterKey === 'DIV' && !shiftKey_1) ||
93
93
  (_this.parent.shiftEnterKey === 'P' && shiftKey_1) ||
94
94
  (_this.parent.shiftEnterKey === 'DIV' && shiftKey_1)) {
95
95
  var nearBlockNode = _this.parent.formatter.editorManager.domNode.blockParentNode(_this.startNode);
96
96
  var isImageNode = false;
97
- if (_this.range.startOffset === 0 && _this.range.endOffset === 0 && !(!isNOU(_this.range.startContainer.previousSibling) && _this.range.startContainer.previousSibling.nodeName === 'IMG')) {
97
+ if (_this.range.startOffset === 0 && _this.range.endOffset === 0 && !(!isNOU(_this.range.startContainer.previousSibling) &&
98
+ (_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
98
99
  var isNearBlockLengthZero = void 0;
99
100
  var newElem = void 0;
100
101
  if (_this.range.startContainer.nodeName === 'IMG') {
@@ -168,7 +169,7 @@ var EnterKeyAction = /** @class */ (function () {
168
169
  }
169
170
  e.args.preventDefault();
170
171
  }
171
- if (_this.parent.enterKey === 'BR' && !shiftKey_1) {
172
+ if ((_this.parent.enterKey === 'BR' && !shiftKey_1) || (_this.parent.shiftEnterKey === 'BR' && shiftKey_1)) {
172
173
  var currentParent = void 0;
173
174
  if (!_this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode)) {
174
175
  var currentNode = _this.startNode;
@@ -184,10 +185,16 @@ var EnterKeyAction = /** @class */ (function () {
184
185
  currentParent = _this.startNode;
185
186
  }
186
187
  var isEmptyBrInserted = false;
188
+ var currentParentLastChild = currentParent.lastChild;
189
+ while (!isNOU(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text')) {
190
+ currentParentLastChild = currentParentLastChild.lastChild;
191
+ }
192
+ var isLastNodeLength = _this.range.startContainer === currentParentLastChild ?
193
+ _this.range.startContainer.textContent.length : currentParent.textContent.length;
187
194
  if (currentParent !== _this.parent.inputElement &&
188
195
  _this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
189
196
  _this.range.startOffset === _this.range.endOffset &&
190
- _this.range.startOffset === currentParent.textContent.length) {
197
+ _this.range.startOffset === isLastNodeLength) {
191
198
  var outerBRElem = _this.parent.createElement('br');
192
199
  _this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
193
200
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), outerBRElem, 0);
@@ -217,34 +224,12 @@ var EnterKeyAction = /** @class */ (function () {
217
224
  isEmptyBrInserted = true;
218
225
  }
219
226
  else {
220
- newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, currentParent, true);
221
- newElem.parentElement.insertBefore(outerBRElem, newElem);
222
- _this.insertFocusContent();
227
+ _this.insertBRElement();
223
228
  }
224
229
  }
225
230
  }
226
231
  else {
227
- var brElm = _this.parent.createElement('br');
228
- if (_this.startNode.nodeName === 'BR' && _this.endNode.nodeName === 'BR' && _this.range.startOffset === 0 && _this.range.startOffset === _this.range.endOffset) {
229
- _this.parent.formatter.editorManager.domNode.insertAfter(brElm, _this.startNode);
230
- isEmptyBrInserted = true;
231
- }
232
- else {
233
- if (_this.startNode === _this.parent.inputElement && !isNOU(_this.range.startContainer.previousSibling) &&
234
- _this.range.startContainer.previousSibling.nodeName === 'BR' && _this.range.startContainer.textContent.length === 0) {
235
- isEmptyBrInserted = true;
236
- }
237
- _this.range.insertNode(brElm);
238
- }
239
- if (isEmptyBrInserted || (!isNOU(brElm.nextElementSibling) && brElm.nextElementSibling.tagName === 'BR') || (!isNOU(brElm.nextSibling) && brElm.nextSibling.textContent.length > 0)) {
240
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), !isNOU(brElm.nextSibling) ? brElm.nextSibling : brElm, 0);
241
- isEmptyBrInserted = false;
242
- }
243
- else {
244
- var brElm2 = _this.parent.createElement('br');
245
- _this.range.insertNode(brElm2);
246
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), brElm, 0);
247
- }
232
+ _this.insertBRElement();
248
233
  }
249
234
  e.args.preventDefault();
250
235
  }
@@ -254,6 +239,30 @@ var EnterKeyAction = /** @class */ (function () {
254
239
  }
255
240
  }
256
241
  };
242
+ EnterKeyAction.prototype.insertBRElement = function () {
243
+ var isEmptyBrInserted = false;
244
+ var brElm = this.parent.createElement('br');
245
+ if (this.startNode.nodeName === 'BR' && this.endNode.nodeName === 'BR' && this.range.startOffset === 0 && this.range.startOffset === this.range.endOffset) {
246
+ this.parent.formatter.editorManager.domNode.insertAfter(brElm, this.startNode);
247
+ isEmptyBrInserted = true;
248
+ }
249
+ else {
250
+ if (this.startNode === this.parent.inputElement && !isNOU(this.range.startContainer.previousSibling) &&
251
+ this.range.startContainer.previousSibling.nodeName === 'BR' && this.range.startContainer.textContent.length === 0) {
252
+ isEmptyBrInserted = true;
253
+ }
254
+ this.range.insertNode(brElm);
255
+ }
256
+ if (isEmptyBrInserted || (!isNOU(brElm.nextElementSibling) && brElm.nextElementSibling.tagName === 'BR') || (!isNOU(brElm.nextSibling) && brElm.nextSibling.textContent.length > 0)) {
257
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), !isNOU(brElm.nextSibling) ? brElm.nextSibling : brElm, 0);
258
+ isEmptyBrInserted = false;
259
+ }
260
+ else {
261
+ var brElm2 = this.parent.createElement('br');
262
+ this.range.insertNode(brElm2);
263
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), brElm, 0);
264
+ }
265
+ };
257
266
  EnterKeyAction.prototype.insertFocusContent = function () {
258
267
  if (this.range.startContainer.textContent.length === 0) {
259
268
  if (this.range.startContainer.nodeName === '#text') {
@@ -149,7 +149,7 @@ var HtmlEditor = /** @class */ (function () {
149
149
  e.args.action === 'enter' ||
150
150
  e.args.keyCode === 13) {
151
151
  this.spaceLink(e.args);
152
- if (this.parent.editorMode === 'HTML' && !((this.parent.shiftEnterKey === 'BR' && e.args.shiftKey))) {
152
+ if (this.parent.editorMode === 'HTML') {
153
153
  this.parent.notify(events.enterHandler, { args: e.args });
154
154
  }
155
155
  }
@@ -426,7 +426,7 @@ var HtmlEditor = /** @class */ (function () {
426
426
  var divElement = this.parent.createElement('div');
427
427
  divElement.setAttribute('class', 'pasteContent');
428
428
  divElement.style.display = 'inline';
429
- divElement.innerHTML = contentInnerElem;
429
+ divElement.innerHTML = contentInnerElem.replace('&para', '&para');
430
430
  var paraElem = divElement.querySelectorAll('span, p');
431
431
  for (var i = 0; i < paraElem.length; i++) {
432
432
  var splitTextContent = paraElem[i].innerHTML.split(' ');
@@ -134,7 +134,7 @@ var QuickToolbar = /** @class */ (function () {
134
134
 
135
135
  */
136
136
  QuickToolbar.prototype.showInlineQTBar = function (x, y, target) {
137
- if (this.parent.readonly) {
137
+ if (this.parent.readonly || target.tagName.toLowerCase() === "img") {
138
138
  return;
139
139
  }
140
140
  this.inlineQTBar.showPopup(x, y, target);
@@ -576,6 +576,8 @@ export interface ActionBeginEventArgs {
576
576
  originalEvent?: MouseEvent | KeyboardEvent;
577
577
  /** Defines the event name. */
578
578
  name?: string;
579
+ /** Defines the selection type is dropdown. */
580
+ selectType?: string;
579
581
  /**
580
582
  * Defines the url action details.
581
583
  *
@@ -88,7 +88,7 @@ var Formatter = /** @class */ (function () {
88
88
  || ((args.item.subCommand === 'FontName' || args.item.subCommand === 'FontSize') && args.name === 'dropDownSelect')
89
89
  || ((args.item.subCommand === 'BackgroundColor' || args.item.subCommand === 'FontColor')
90
90
  && args.name === 'colorPickerChanged'))) {
91
- extend(args, args, { requestType: args.item.subCommand, cancel: false, itemCollection: value }, true);
91
+ extend(args, args, { requestType: args.item.subCommand, cancel: false, itemCollection: value, selectType: args.name }, true);
92
92
  self.trigger(CONSTANT.actionBegin, args, function (actionBeginArgs) {
93
93
  if (!actionBeginArgs.cancel) {
94
94
  if (_this.getUndoRedoStack().length === 0 && actionBeginArgs.item.command !== 'Links'
@@ -106,8 +106,8 @@ var Formatter = /** @class */ (function () {
106
106
  }
107
107
  else {
108
108
  _this.editorManager.observer.notify(CONSTANT.checkUndo, { subCommand: actionBeginArgs.item.subCommand });
109
- _this.editorManager.execCommand(actionBeginArgs.item.command, actionBeginArgs.item.subCommand, event, _this.onSuccess.bind(_this, self), actionBeginArgs.item.value, actionBeginArgs.item.subCommand === 'Pre' && args.name === 'dropDownSelect' ?
110
- { name: args.name } : value, ('#' + self.getID() + ' iframe'), self.enterKey);
109
+ _this.editorManager.execCommand(actionBeginArgs.item.command, actionBeginArgs.item.subCommand, event, _this.onSuccess.bind(_this, self), actionBeginArgs.item.value, actionBeginArgs.item.subCommand === 'Pre' && actionBeginArgs.selectType === 'dropDownSelect' ?
110
+ { name: actionBeginArgs.selectType } : value, ('#' + self.getID() + ' iframe'), self.enterKey);
111
111
  }
112
112
  }
113
113
  });
@@ -328,10 +328,14 @@ var Image = /** @class */ (function () {
328
328
  img.style.height = expectedY + 'px';
329
329
  }
330
330
  else if (img.style.width !== '' && img.style.height === '') {
331
- img.style.width = ((width / height * expectedY) + width / height).toString() + 'px';
331
+ var currentWidth = ((width / height * expectedY) + width / height) < (this.parent.inputElement.getBoundingClientRect().right - 32) ?
332
+ ((width / height * expectedY) + width / height) : (this.parent.inputElement.getBoundingClientRect().right - 32);
333
+ img.style.width = currentWidth.toString() + 'px';
332
334
  }
333
335
  else if (img.style.width !== '') {
334
- img.style.width = (width / height * expectedY) + 'px';
336
+ var currentWidth = (width / height * expectedY) < (this.parent.inputElement.getBoundingClientRect().right - 32) ?
337
+ (width / height * expectedY) : (this.parent.inputElement.getBoundingClientRect().right - 32);
338
+ img.style.width = currentWidth + 'px';
335
339
  img.style.height = expectedY + 'px';
336
340
  }
337
341
  else {
@@ -440,7 +444,7 @@ var Image = /** @class */ (function () {
440
444
  };
441
445
  Image.prototype.resizeImgDupPos = function (e) {
442
446
  this.imgDupPos = {
443
- width: (e.style.height !== '') ? this.imgEle.style.width : e.width + 'px',
447
+ width: (e.style.width !== '') ? this.imgEle.style.width : e.width + 'px',
444
448
  height: (e.style.height !== '') ? this.imgEle.style.height : e.height + 'px'
445
449
  };
446
450
  };
@@ -608,6 +612,27 @@ var Image = /** @class */ (function () {
608
612
  var src = this.deletedImg[i].src;
609
613
  this.imageRemovePost(src);
610
614
  }
615
+ if (range.startContainer.nodeType === 3) {
616
+ if (originalEvent.code === 'Backspace') {
617
+ if (range.startContainer.previousElementSibling && range.startOffset === 0 &&
618
+ range.startContainer.previousElementSibling.classList.contains(classes.CLS_CAPTION) &&
619
+ range.startContainer.previousElementSibling.classList.contains(classes.CLS_CAPINLINE)) {
620
+ detach(range.startContainer.previousElementSibling);
621
+ }
622
+ }
623
+ else {
624
+ if (range.startContainer.nextElementSibling &&
625
+ range.endContainer.textContent.length === range.endOffset &&
626
+ range.startContainer.nextElementSibling.classList.contains(classes.CLS_CAPTION) &&
627
+ range.startContainer.nextElementSibling.classList.contains(classes.CLS_CAPINLINE)) {
628
+ detach(range.startContainer.nextElementSibling);
629
+ }
630
+ }
631
+ }
632
+ else if ((range.startContainer.nodeType === 1 &&
633
+ range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_CAPINLINE))) {
634
+ detach(range.startContainer.querySelector('.' + classes.CLS_CAPTION + '.' + classes.CLS_CAPINLINE));
635
+ }
611
636
  break;
612
637
  case 'insert-image':
613
638
  this.openDialog(true, originalEvent, save, selectNodeEle, selectParentEle);
@@ -813,7 +838,7 @@ var Image = /** @class */ (function () {
813
838
  var target = args.target;
814
839
  this.contentModule = this.rendererFactory.getRenderer(RenderType.Content);
815
840
  var isPopupOpen = this.quickToolObj.imageQTBar.element.classList.contains('e-rte-pop');
816
- if (target.nodeName === 'IMG' && this.parent.quickToolbarModule && this.parent.getRange().startOffset === this.parent.getRange().endOffset) {
841
+ if (target.nodeName === 'IMG' && this.parent.quickToolbarModule) {
817
842
  if (isPopupOpen) {
818
843
  return;
819
844
  }
@@ -1054,6 +1079,9 @@ var Image = /** @class */ (function () {
1054
1079
  Image.prototype.imageRemovePost = function (src) {
1055
1080
  var proxy = this;
1056
1081
  var absoluteUrl = '';
1082
+ if (isNOU(this.parent.insertImageSettings.removeUrl) || this.parent.insertImageSettings.removeUrl === '') {
1083
+ return;
1084
+ }
1057
1085
  if (src.indexOf('http://') > -1 || src.indexOf('https://') > -1) {
1058
1086
  absoluteUrl = src;
1059
1087
  }
@@ -1899,6 +1927,7 @@ var Image = /** @class */ (function () {
1899
1927
  imageTag.addEventListener('load', function () {
1900
1928
  _this.parent.trigger(events.actionComplete, e);
1901
1929
  });
1930
+ detach(parentElement);
1902
1931
  };
1903
1932
  /**
1904
1933
  * Rendering uploader and popup for drag and drop
@@ -1934,6 +1963,9 @@ var Image = /** @class */ (function () {
1934
1963
  _this.popupObj.destroy();
1935
1964
  detach(_this.popupObj.element);
1936
1965
  _this.popupObj = null;
1966
+ if (!_this.parent.inlineMode.enable) {
1967
+ _this.parent.toolbarModule.baseToolbar.toolbarObj.disable(false);
1968
+ }
1937
1969
  }
1938
1970
  });
1939
1971
  this.popupObj.element.style.display = 'none';
@@ -1965,6 +1997,10 @@ var Image = /** @class */ (function () {
1965
1997
  isUploading = false;
1966
1998
  detach(imageElement);
1967
1999
  _this.popupObj.close();
2000
+ _this.quickToolObj.imageQTBar.hidePopup();
2001
+ setTimeout(function () {
2002
+ _this.uploadObj.destroy();
2003
+ }, 900);
1968
2004
  },
1969
2005
  beforeUpload: function (args) {
1970
2006
  if (_this.parent.isServerRendered) {
@@ -1976,6 +2012,9 @@ var Image = /** @class */ (function () {
1976
2012
  if (beforeUploadArgs.cancel) {
1977
2013
  return;
1978
2014
  }
2015
+ if (!_this.parent.inlineMode.enable) {
2016
+ _this.parent.toolbarModule.baseToolbar.toolbarObj.disable(true);
2017
+ }
1979
2018
  /* eslint-disable */
1980
2019
  _this.uploadObj.currentRequestHeader = beforeUploadArgs.currentRequest ?
1981
2020
  beforeUploadArgs.currentRequest : _this.uploadObj.currentRequestHeader;
@@ -1988,6 +2027,9 @@ var Image = /** @class */ (function () {
1988
2027
  }
1989
2028
  else {
1990
2029
  _this.parent.trigger(events.beforeImageUpload, args);
2030
+ if (!_this.parent.inlineMode.enable) {
2031
+ _this.parent.toolbarModule.baseToolbar.toolbarObj.disable(true);
2032
+ }
1991
2033
  }
1992
2034
  },
1993
2035
  uploading: function (e) {
@@ -2030,6 +2072,9 @@ var Image = /** @class */ (function () {
2030
2072
  }, 900);
2031
2073
  },
2032
2074
  success: function (e) {
2075
+ if (e.operation === "cancel") {
2076
+ return;
2077
+ }
2033
2078
  isUploading = false;
2034
2079
  _this.parent.inputElement.contentEditable = 'true';
2035
2080
  var args = {
@@ -116,7 +116,8 @@ var NodeSelection = /** @class */ (function () {
116
116
  || range.startContainer;
117
117
  var endNode = range.endContainer.childNodes[(range.endOffset > 0) ? (range.endOffset - 1) : range.endOffset]
118
118
  || range.endContainer;
119
- if (startNode === endNode && startNode.childNodes.length === 0) {
119
+ if ((startNode === endNode || (startNode.nodeName === 'BR' && startNode === range.endContainer.childNodes[range.endOffset])) &&
120
+ startNode.childNodes.length === 0) {
120
121
  return [startNode];
121
122
  }
122
123
  if (range.startOffset === range.endOffset && range.startOffset !== 0 && range.startContainer.nodeName === 'PRE') {