@syncfusion/ej2-richtexteditor 20.1.48 → 20.1.52

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 : 20.1.48
3
+ * version : 20.1.52
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@20.1.47",
3
+ "_id": "@syncfusion/ej2-richtexteditor@20.1.51",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-+JqSmzz8uh/Xuf7mVptZllX9DZbzfOt9enpA9JftvQiFGKQVDeZwRW2J9qrdtumUBBMmbasVPWkvpMMoLy7w2g==",
5
+ "_integrity": "sha512-bcIISkRgLWZVdsUIfFPqPrFMSGKxvgZmaNVU5xbKp0kVkMKtUJAouugs0PG1pnqX5AE7JihxTWbXzbBfKqPOqQ==",
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-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-20.1.47.tgz",
30
- "_shasum": "7d854e478b53c30642348539aa9a389c4df071f9",
29
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-20.1.51.tgz",
30
+ "_shasum": "750c5f70b543df06b6138fef3e932de46991d2c2",
31
31
  "_spec": "@syncfusion/ej2-richtexteditor@*",
32
32
  "_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
33
33
  "author": {
@@ -38,11 +38,11 @@
38
38
  },
39
39
  "bundleDependencies": false,
40
40
  "dependencies": {
41
- "@syncfusion/ej2-base": "~20.1.48",
42
- "@syncfusion/ej2-buttons": "~20.1.47",
43
- "@syncfusion/ej2-filemanager": "~20.1.47",
41
+ "@syncfusion/ej2-base": "~20.1.50",
42
+ "@syncfusion/ej2-buttons": "~20.1.52",
43
+ "@syncfusion/ej2-filemanager": "~20.1.52",
44
44
  "@syncfusion/ej2-inputs": "~20.1.48",
45
- "@syncfusion/ej2-navigations": "~20.1.48",
45
+ "@syncfusion/ej2-navigations": "~20.1.51",
46
46
  "@syncfusion/ej2-popups": "~20.1.47",
47
47
  "@syncfusion/ej2-splitbuttons": "~20.1.47"
48
48
  },
@@ -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": "20.1.48",
73
+ "version": "20.1.52",
74
74
  "sideEffects": false
75
75
  }
@@ -23,7 +23,7 @@ var InsertTextExec = /** @class */ (function () {
23
23
  };
24
24
  InsertTextExec.prototype.insertText = function (e) {
25
25
  var node = document.createTextNode(e.value);
26
- InsertHtml.Insert(this.parent.currentDocument, node);
26
+ InsertHtml.Insert(this.parent.currentDocument, node, this.parent.editableElement);
27
27
  if (e.callBack) {
28
28
  e.callBack({
29
29
  requestType: e.subCommand,
@@ -377,7 +377,8 @@ var InsertHtml = /** @class */ (function () {
377
377
  tempSpan.parentNode.replaceChild(node, tempSpan);
378
378
  }
379
379
  else {
380
- var currentNode = nodes[nodes.length - 1];
380
+ var nodeSelection = new NodeSelection();
381
+ var currentNode = this.getNodeCollection(range, nodeSelection, node)[this.getNodeCollection(range, nodeSelection, node).length - 1];
381
382
  var splitedElm = void 0;
382
383
  if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR') && !isNOU(currentNode.parentElement) &&
383
384
  currentNode.parentElement.textContent.trim().length === 0) {
@@ -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.isImgElm(fragment) && fragment.textContent.trim() === '') ? true : false;
74
+ && this.isImgElm(fragment) && fragment.textContent === '') ? true : false;
75
75
  if (!isEmpty) {
76
76
  if (node) {
77
77
  InsertMethods.AppendBefore(fragment, node, true);
@@ -122,7 +122,7 @@ var NodeCutter = /** @class */ (function () {
122
122
  else if (len > -1) {
123
123
  this.spliceEmptyNode(fragment.childNodes[0], isStart);
124
124
  }
125
- else if (fragment.nodeType !== 3 && fragment.nodeType !== 11) {
125
+ else if (fragment.nodeType !== 3 && fragment.nodeType !== 11 && fragment.nodeName !== 'IMG') {
126
126
  fragment.parentNode.removeChild(fragment);
127
127
  }
128
128
  return fragment;
@@ -46,12 +46,18 @@ var SelectionCommands = /** @class */ (function () {
46
46
  var preventRestore = false;
47
47
  var isFontStyle = (['fontcolor', 'fontname', 'fontsize', 'backgroundcolor'].indexOf(format) > -1);
48
48
  if (range.collapsed) {
49
+ var currentFormatNode = isFormatted.getFormattedNode(range.startContainer, format, endNode);
50
+ var currentSelector = !isNOU(currentFormatNode) ?
51
+ (currentFormatNode.getAttribute('style') === null ? currentFormatNode.nodeName :
52
+ currentFormatNode.nodeName + "[style='" + currentFormatNode.getAttribute('style') + "']") : null;
49
53
  if (nodes.length > 0) {
50
54
  isCollapsed = true;
51
55
  range = nodeCutter.GetCursorRange(docElement, range, nodes[0]);
52
56
  }
53
- else if (range.startContainer.nodeType === 3 && range.startContainer.parentElement.childElementCount > 0 &&
54
- range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') {
57
+ else if (range.startContainer.nodeType === 3 && ((range.startContainer.parentElement.childElementCount > 0 &&
58
+ range.startOffset > 0 && range.startContainer.parentElement.firstElementChild.tagName.toLowerCase() !== 'br') ||
59
+ !isNOU(currentFormatNode) && currentFormatNode === (range.startContainer.parentElement.closest(currentSelector)) &&
60
+ ((range.startContainer.parentElement.closest(currentSelector)).textContent.replace(new RegExp(String.fromCharCode(8203), 'g'), '').trim().length != 0))) {
55
61
  isCollapsed = true;
56
62
  range = nodeCutter.GetCursorRange(docElement, range, range.startContainer);
57
63
  nodes.push(range.startContainer);
@@ -109,11 +109,11 @@ var TableCommand = /** @class */ (function () {
109
109
  for (var i = 0; i < emptyUl.length; i++) {
110
110
  detach(emptyUl[i]);
111
111
  }
112
- var emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
112
+ var emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
113
113
  for (var i = 0; i < emptyLiChild.length; i++) {
114
114
  detach(emptyLiChild[i]);
115
115
  if (emptyLiChild.length === i + 1) {
116
- emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty');
116
+ emptyLiChild = this.parent.editableElement.querySelectorAll('li *:empty:not(img)');
117
117
  i = -1;
118
118
  }
119
119
  }
@@ -96,7 +96,7 @@ var UndoRedoManager = /** @class */ (function () {
96
96
  */
97
97
  UndoRedoManager.prototype.saveData = function (e) {
98
98
  var range = new NodeSelection().getRange(this.parent.currentDocument);
99
- var currentContainer = range.startContainer;
99
+ var currentContainer = this.parent.editableElement === range.startContainer.parentElement ? range.startContainer.parentElement : range.startContainer;
100
100
  for (var i = currentContainer.childNodes.length - 1; i >= 0; i--) {
101
101
  if (!isNullOrUndefined(currentContainer.childNodes[i]) && currentContainer.childNodes[i].nodeName === '#text' &&
102
102
  currentContainer.childNodes[i].textContent.length === 0 && currentContainer.childNodes[i].nodeName !== 'IMG' &&
@@ -292,8 +292,9 @@ var EnterKeyAction = /** @class */ (function () {
292
292
  };
293
293
  EnterKeyAction.prototype.removeBRElement = function (currentElement) {
294
294
  if (Browser.userAgent.indexOf('Firefox') != -1 &&
295
- this.range.endOffset === currentElement.textContent.length &&
296
- currentElement.lastChild.nodeName === 'BR') {
295
+ this.range.endOffset === currentElement.textContent.length && (currentElement.textContent.length !== 0 ||
296
+ currentElement.querySelectorAll('BR').length > 1) &&
297
+ !isNOU(currentElement.lastChild) && currentElement.lastChild.nodeName === 'BR') {
297
298
  detach(currentElement.lastChild);
298
299
  }
299
300
  };
@@ -195,7 +195,7 @@ var Toolbar = /** @class */ (function () {
195
195
  if ((parent_1.bottom < (floatOffset + tbHeight + topValue)) || parent_1.bottom < 0 || parent_1.top > floatOffset + topValue) {
196
196
  isFloat = false;
197
197
  }
198
- else if (parent_1.top < floatOffset) {
198
+ else if (parent_1.top < floatOffset || parent_1.top < floatOffset + topValue) {
199
199
  isFloat = true;
200
200
  }
201
201
  }
@@ -728,6 +728,10 @@ var RichTextEditor = /** @class */ (function (_super) {
728
728
  ? 0 : e.clipboardData.getData('text/plain').length;
729
729
  var totalLength = (currentLength - selectionLength) + pastedContentLength;
730
730
  if (_this.editorMode === 'Markdown') {
731
+ var args_1 = { requestType: 'Paste', editorMode: _this.editorMode, event: e };
732
+ setTimeout(function () {
733
+ _this.formatter.onSuccess(_this, args_1);
734
+ }, 0);
731
735
  if (!(_this.maxLength === -1 || totalLength <= _this.maxLength)) {
732
736
  e.preventDefault();
733
737
  }
@@ -739,7 +743,7 @@ var RichTextEditor = /** @class */ (function (_super) {
739
743
  _this.notify(events.pasteClean, { args: e });
740
744
  }
741
745
  else {
742
- var args_1 = { requestType: 'Paste', editorMode: _this.editorMode, event: e };
746
+ var args_2 = { requestType: 'Paste', editorMode: _this.editorMode, event: e };
743
747
  var value = null;
744
748
  var htmlValue = false;
745
749
  if (e && !isNOU(e.clipboardData)) {
@@ -757,7 +761,7 @@ var RichTextEditor = /** @class */ (function (_super) {
757
761
  });
758
762
  }
759
763
  setTimeout(function () {
760
- _this.formatter.onSuccess(_this, args_1);
764
+ _this.formatter.onSuccess(_this, args_2);
761
765
  }, 0);
762
766
  }
763
767
  }
@@ -377,14 +377,10 @@ var Image = /** @class */ (function () {
377
377
  img.style.height = null;
378
378
  img.removeAttribute('height');
379
379
  }
380
- else if (img.style.width !== '') {
380
+ else {
381
381
  img.style.width = expectedX + 'px';
382
382
  img.style.height = expectedX + 'px';
383
383
  }
384
- else {
385
- img.setAttribute('width', expectedX.toString());
386
- img.setAttribute('height', expectedX.toString());
387
- }
388
384
  }
389
385
  };
390
386
  Image.prototype.pixToPerc = function (expected, parentEle) {
@@ -807,7 +807,7 @@ var Table = /** @class */ (function () {
807
807
  EventHandler.remove(_this.contentModule.getEditPanel(), 'mouseover', _this.resizeHelper);
808
808
  }
809
809
  var widthType = _this.curTable.style.width.indexOf('%') > -1;
810
- _this.curTable.style.width = widthType ? _this.convertPixelToPercentage(tableWidth + mouseX, rteWidth) + '%'
810
+ _this.curTable.style.width = widthType && !_this.curTable.closest('TD') ? _this.convertPixelToPercentage(tableWidth + mouseX, rteWidth) + '%'
811
811
  : tableWidth + mouseX + 'px';
812
812
  _this.curTable.style.height = tableHeight + mouseY + 'px';
813
813
  tableReBox.classList.add('e-rbox-select');