@syncfusion/ej2-richtexteditor 28.1.38 → 28.1.41

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 : 28.1.38
3
+ * version : 28.1.41
4
4
  * Copyright Syncfusion Inc. 2001 - 2024. 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@28.1.37",
3
+ "_id": "@syncfusion/ej2-richtexteditor@28.1.39",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-LcoACNENKzPU49FmsncrsED1lWXsHPU9w6nV7nSn1wOipA3bqUwEVvbJimIw8Ll29E/RrzcR80mBsWYj7LhNzw==",
5
+ "_integrity": "sha512-0KqSNDw/9+yUG6PLOvq4wOdLHA1K+yc4GQpGzG8C2ObKSx+5gVmtQFIQ6aVkJMlMIiDf7Z1hnYwjEI9336U1jA==",
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-28.1.37.tgz",
29
- "_shasum": "8e8379aba1b398d91e5704b67386f3fac2be2b87",
28
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-28.1.39.tgz",
29
+ "_shasum": "4ba1fd2991037302c8e01fa5181ed21d0d8199dc",
30
30
  "_spec": "@syncfusion/ej2-richtexteditor@*",
31
31
  "_where": "/jenkins/workspace/elease-automation_release_28.1.1/packages/included",
32
32
  "author": {
@@ -38,13 +38,13 @@
38
38
  "bundleDependencies": false,
39
39
  "dependencies": {
40
40
  "@syncfusion/ej2-base": "~28.1.33",
41
- "@syncfusion/ej2-buttons": "~28.1.37",
42
- "@syncfusion/ej2-dropdowns": "~28.1.38",
43
- "@syncfusion/ej2-filemanager": "~28.1.36",
44
- "@syncfusion/ej2-inputs": "~28.1.37",
45
- "@syncfusion/ej2-navigations": "~28.1.37",
46
- "@syncfusion/ej2-popups": "~28.1.38",
47
- "@syncfusion/ej2-splitbuttons": "~28.1.37"
41
+ "@syncfusion/ej2-buttons": "~28.1.39",
42
+ "@syncfusion/ej2-dropdowns": "~28.1.41",
43
+ "@syncfusion/ej2-filemanager": "~28.1.39",
44
+ "@syncfusion/ej2-inputs": "~28.1.41",
45
+ "@syncfusion/ej2-navigations": "~28.1.41",
46
+ "@syncfusion/ej2-popups": "~28.1.39",
47
+ "@syncfusion/ej2-splitbuttons": "~28.1.41"
48
48
  },
49
49
  "deprecated": false,
50
50
  "description": "Essential JS 2 RichTextEditor component",
@@ -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": "28.1.38",
83
+ "version": "28.1.41",
84
84
  "sideEffects": false
85
85
  }
@@ -13,11 +13,10 @@ export declare function isIDevice(): boolean;
13
13
  export declare function setEditFrameFocus(editableElement: Element, selector: string): void;
14
14
  /**
15
15
  * @param {string} value - specifies the string value
16
- * @param {string} enterAction - specifies the enter key action API
17
16
  * @returns {void}
18
17
  * @hidden
19
18
  */
20
- export declare function updateTextNode(value: string, enterAction?: string): string;
19
+ export declare function updateTextNode(value: string): string;
21
20
  /**
22
21
  * @param {Node} startChildNodes - specifies the node
23
22
  * @returns {void}
@@ -1,12 +1,7 @@
1
1
  /**
2
2
  * Defines common util methods used by Rich Text Editor.
3
3
  */
4
- import { isNullOrUndefined, Browser, createElement, detach, removeClass } from '@syncfusion/ej2-base';
5
- var inlineNode = ['a', 'abbr', 'acronym', 'audio', 'b', 'bdi', 'bdo', 'big', 'br', 'button',
6
- 'canvas', 'cite', 'code', 'data', 'datalist', 'del', 'dfn', 'em', 'embed', 'font', 'i', 'iframe', 'img', 'input',
7
- 'ins', 'kbd', 'label', 'map', 'mark', 'meter', 'noscript', 'object', 'output', 'picture', 'progress',
8
- 'q', 'ruby', 's', 'samp', 'script', 'select', 'slot', 'small', 'span', 'strong', 'strike', 'sub', 'sup', 'svg',
9
- 'template', 'textarea', 'time', 'u', 'tt', 'var', 'video', 'wbr'];
4
+ import { isNullOrUndefined, Browser, removeClass } from '@syncfusion/ej2-base';
10
5
  /**
11
6
  * @returns {void}
12
7
  * @hidden
@@ -34,109 +29,68 @@ export function setEditFrameFocus(editableElement, selector) {
34
29
  }
35
30
  /**
36
31
  * @param {string} value - specifies the string value
37
- * @param {string} enterAction - specifies the enter key action API
38
32
  * @returns {void}
39
33
  * @hidden
40
34
  */
41
- export function updateTextNode(value, enterAction) {
42
- var tempNode = document.createElement('div');
43
- tempNode.innerHTML = value;
44
- tempNode.setAttribute('class', 'tempDiv');
35
+ export function updateTextNode(value) {
45
36
  var resultElm = document.createElement('div');
46
- var childNodes = tempNode.childNodes;
47
- if (childNodes.length > 0) {
48
- var isPreviousInlineElem = void 0;
49
- var previousParent = void 0;
50
- var paraElm = void 0;
51
- while (tempNode.firstChild) {
52
- if ((tempNode.firstChild.nodeName === '#text' &&
53
- (tempNode.firstChild.textContent.indexOf('\n') < 0 || tempNode.firstChild.textContent.trim() !== '')) ||
54
- inlineNode.indexOf(tempNode.firstChild.nodeName.toLocaleLowerCase()) >= 0) {
55
- if (!isPreviousInlineElem) {
56
- if (enterAction === 'BR') {
57
- resultElm.appendChild(tempNode.firstChild);
58
- previousParent = resultElm;
59
- }
60
- else {
61
- paraElm = createElement('p');
62
- resultElm.appendChild(paraElm);
63
- paraElm.appendChild(tempNode.firstChild);
64
- previousParent = paraElm;
65
- isPreviousInlineElem = true;
66
- }
67
- }
68
- else {
69
- previousParent.appendChild(tempNode.firstChild);
70
- previousParent = paraElm;
71
- isPreviousInlineElem = true;
72
- }
73
- }
74
- else if (tempNode.firstChild.nodeName === '#text' && (tempNode.firstChild.textContent === '\n' ||
75
- (tempNode.firstChild.textContent.indexOf('\n') >= 0 && tempNode.firstChild.textContent.trim() === ''))) {
76
- detach(tempNode.firstChild);
37
+ resultElm.innerHTML = value;
38
+ var tableElm = resultElm.querySelectorAll('table');
39
+ for (var i = 0; i < tableElm.length; i++) {
40
+ if (tableElm[i].classList.length > 0 &&
41
+ !tableElm[i].classList.contains('e-rte-table') && !tableElm[i].classList.contains('e-rte-custom-table')) {
42
+ tableElm[i].classList.add('e-rte-paste-table');
43
+ if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
44
+ tableElm[i].classList.remove('e-rte-paste-word-table');
45
+ continue; // Skiping the removal of the border if the source is from word.
77
46
  }
78
- else {
79
- resultElm.appendChild(tempNode.firstChild);
80
- isPreviousInlineElem = false;
81
- }
82
- }
83
- var tableElm = resultElm.querySelectorAll('table');
84
- for (var i = 0; i < tableElm.length; i++) {
85
- if (tableElm[i].classList.length > 0 &&
86
- !tableElm[i].classList.contains('e-rte-table') && !tableElm[i].classList.contains('e-rte-custom-table')) {
87
- tableElm[i].classList.add('e-rte-paste-table');
88
- if (tableElm[i].classList.contains('e-rte-paste-word-table')) {
89
- tableElm[i].classList.remove('e-rte-paste-word-table');
90
- continue; // Skiping the removal of the border if the source is from word.
47
+ else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
48
+ tableElm[i].classList.remove('e-rte-paste-excel-table');
49
+ if (tableElm[i].getAttribute('border') === '0') {
50
+ tableElm[i].removeAttribute('border');
91
51
  }
92
- else if (tableElm[i].classList.contains('e-rte-paste-excel-table')) {
93
- tableElm[i].classList.remove('e-rte-paste-excel-table');
94
- if (tableElm[i].getAttribute('border') === '0') {
95
- tableElm[i].removeAttribute('border');
52
+ var tdElm = tableElm[i].querySelectorAll('td');
53
+ for (var j = 0; j < tdElm.length; j++) {
54
+ if (tdElm[j].style.borderLeft === 'none') {
55
+ tdElm[j].style.removeProperty('border-left');
96
56
  }
97
- var tdElm = tableElm[i].querySelectorAll('td');
98
- for (var j = 0; j < tdElm.length; j++) {
99
- if (tdElm[j].style.borderLeft === 'none') {
100
- tdElm[j].style.removeProperty('border-left');
101
- }
102
- if (tdElm[j].style.borderRight === 'none') {
103
- tdElm[j].style.removeProperty('border-right');
104
- }
105
- if (tdElm[j].style.borderBottom === 'none') {
106
- tdElm[j].style.removeProperty('border-bottom');
107
- }
108
- if (tdElm[j].style.borderTop === 'none') {
109
- tdElm[j].style.removeProperty('border-top');
110
- }
111
- if (tdElm[j].style.border === 'none') {
112
- tdElm[j].style.removeProperty('border');
113
- }
57
+ if (tdElm[j].style.borderRight === 'none') {
58
+ tdElm[j].style.removeProperty('border-right');
59
+ }
60
+ if (tdElm[j].style.borderBottom === 'none') {
61
+ tdElm[j].style.removeProperty('border-bottom');
62
+ }
63
+ if (tdElm[j].style.borderTop === 'none') {
64
+ tdElm[j].style.removeProperty('border-top');
65
+ }
66
+ if (tdElm[j].style.border === 'none') {
67
+ tdElm[j].style.removeProperty('border');
114
68
  }
115
69
  }
116
- else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
117
- tableElm[i].classList.remove('e-rte-paste-onenote-table');
118
- continue;
119
- }
120
- else if (tableElm[i].classList.contains('e-rte-paste-html-table')) {
121
- tableElm[i].classList.remove('e-rte-paste-html-table');
122
- continue;
123
- }
124
- }
125
- }
126
- var imageElm = resultElm.querySelectorAll('img');
127
- for (var i = 0; i < imageElm.length; i++) {
128
- if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
129
- continue; // Should not add the class if the image is Broken.
130
70
  }
131
- if (!imageElm[i].classList.contains('e-rte-image')) {
132
- imageElm[i].classList.add('e-rte-image');
71
+ else if (tableElm[i].classList.contains('e-rte-paste-onenote-table')) {
72
+ tableElm[i].classList.remove('e-rte-paste-onenote-table');
73
+ continue;
133
74
  }
134
- if (!(imageElm[i].classList.contains('e-imginline') ||
135
- imageElm[i].classList.contains('e-imgbreak'))) {
136
- imageElm[i].classList.add('e-imginline');
75
+ else if (tableElm[i].classList.contains('e-rte-paste-html-table')) {
76
+ tableElm[i].classList.remove('e-rte-paste-html-table');
77
+ continue;
137
78
  }
138
79
  }
139
80
  }
81
+ var imageElm = resultElm.querySelectorAll('img');
82
+ for (var i = 0; i < imageElm.length; i++) {
83
+ if (imageElm[i].classList.contains('e-rte-image-unsupported')) {
84
+ continue; // Should not add the class if the image is Broken.
85
+ }
86
+ if (!imageElm[i].classList.contains('e-rte-image')) {
87
+ imageElm[i].classList.add('e-rte-image');
88
+ }
89
+ if (!(imageElm[i].classList.contains('e-imginline') ||
90
+ imageElm[i].classList.contains('e-imgbreak'))) {
91
+ imageElm[i].classList.add('e-imginline');
92
+ }
93
+ }
140
94
  return resultElm.innerHTML;
141
95
  }
142
96
  /**
@@ -156,6 +156,14 @@ export interface IHtmlKeyboardEvent {
156
156
  * Specifies the enter key configuration.
157
157
  */
158
158
  enterAction?: string;
159
+ /**
160
+ * Defines tag to be used when enter key is pressed.
161
+ */
162
+ enterKey?: string;
163
+ /**
164
+ * Defines tag to be used when shift enter key is pressed.
165
+ */
166
+ shiftEnterKey?: string;
159
167
  }
160
168
  /**
161
169
  *
@@ -397,7 +397,7 @@ var InsertHtml = /** @class */ (function () {
397
397
  nodeSelection.setSelectionText(docElement, lastSelectionNode, lastSelectionNode, 0, 0);
398
398
  }
399
399
  else {
400
- this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
400
+ this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode);
401
401
  }
402
402
  this.alignCheck(editNode);
403
403
  this.listCleanUp(nodeSelection, docElement);
@@ -661,9 +661,9 @@ var InsertHtml = /** @class */ (function () {
661
661
  }
662
662
  }
663
663
  };
664
- InsertHtml.cursorPos = function (lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction) {
664
+ InsertHtml.cursorPos = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
665
665
  lastSelectionNode.classList.add('lastNode');
666
- editNode.innerHTML = updateTextNode(editNode.innerHTML, enterAction);
666
+ editNode.innerHTML = updateTextNode(editNode.innerHTML);
667
667
  lastSelectionNode = editNode.querySelector('.lastNode');
668
668
  if (!isNOU(lastSelectionNode)) {
669
669
  this.placeCursorEnd(lastSelectionNode, node, nodeSelection, docElement, editNode);
@@ -25,6 +25,7 @@ export declare class Lists {
25
25
  private removeEventListener;
26
26
  private testList;
27
27
  private testCurrentList;
28
+ private createAutoList;
28
29
  private spaceList;
29
30
  private enterList;
30
31
  private backspaceList;
@@ -64,6 +64,17 @@ var Lists = /** @class */ (function () {
64
64
  }
65
65
  return false;
66
66
  };
67
+ Lists.prototype.createAutoList = function (enterKey, shiftEnterKey) {
68
+ var autoListRules = {
69
+ BR: { BR: true, P: true, DIV: true },
70
+ P: { BR: false, P: true, DIV: true },
71
+ DIV: { BR: false, P: true, DIV: true }
72
+ };
73
+ if (autoListRules[enterKey] && autoListRules[enterKey][shiftEnterKey] !== undefined) {
74
+ return autoListRules[enterKey][shiftEnterKey];
75
+ }
76
+ return false;
77
+ };
67
78
  Lists.prototype.spaceList = function (e) {
68
79
  var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
69
80
  this.saveSelection = this.parent.nodeSelection.save(range, this.parent.currentDocument);
@@ -79,7 +90,8 @@ var Lists = /** @class */ (function () {
79
90
  var startElementOLTest = this.testCurrentList(range);
80
91
  var preElementOLTest = this.testList(preElement);
81
92
  var nextElementOLTest = this.testList(nextElement);
82
- if (!preElementOLTest && !nextElementOLTest && preElemULStart !== '*' && nextElemULStart !== '*') {
93
+ var nextElementBRTest = range.startContainer.previousElementSibling && range.startContainer.previousElementSibling.tagName === 'BR';
94
+ if (!preElementOLTest && !nextElementOLTest && preElemULStart !== '*' && nextElemULStart !== '*' && (this.createAutoList(e.enterKey, e.shiftEnterKey) || !nextElementBRTest)) {
83
95
  var brElement = createElement('br');
84
96
  if (startElementOLTest) {
85
97
  range.startContainer.textContent = range.startContainer.textContent.slice(range.startOffset, range.startContainer.textContent.length);
@@ -151,7 +151,7 @@ var EnterKeyAction = /** @class */ (function () {
151
151
  if ((_this.parent.enterKey === 'P' && !shiftKey_1) || (_this.parent.enterKey === 'DIV' && !shiftKey_1) ||
152
152
  (_this.parent.shiftEnterKey === 'P' && shiftKey_1) ||
153
153
  (_this.parent.shiftEnterKey === 'DIV' && shiftKey_1)) {
154
- if ((_this.range.startOffset === 1 && _this.parent.inputElement.childNodes.length === 1 && _this.parent.inputElement.childNodes[0].nodeName === 'TABLE') || (_this.parent.enterKey === 'BR' && shiftKey_1)) {
154
+ if ((_this.range.startOffset === 1 && _this.parent.inputElement.childNodes.length === 1 && _this.parent.inputElement.childNodes[0].nodeName === 'TABLE')) {
155
155
  var newElem = _this.createInsertElement(shiftKey_1);
156
156
  newElem.appendChild(_this.parent.createElement('BR'));
157
157
  _this.parent.inputElement.appendChild(newElem);
@@ -210,8 +210,9 @@ var EnterKeyAction = /** @class */ (function () {
210
210
  (_this.range.startContainer.nodeName === '#text' && !isNOU(_this.range.startContainer.textContent[_this.range.startOffset]) &&
211
211
  _this.range.startContainer.textContent[_this.range.startOffset].includes('\u200B') && _this.range.startContainer.textContent[_this.range.startOffset] === '\u200B' &&
212
212
  _this.parent.inputElement.textContent[0] !== '\u200B'));
213
+ var preventEnterkeyShiftKey = (_this.range.startContainer.nodeName === '#text' || _this.range.startContainer.nodeName === 'BR') && (_this.range.startOffset === 0 && _this.range.endOffset === 0) && _this.range.startContainer.parentElement === _this.parent.inputElement && _this.parent.enterKey === 'BR' && shiftKey_1;
213
214
  // eslint-disable-next-line max-len
214
- if (!preventZeroWithSpace && !fireFoxEnterAtMiddle && ((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
215
+ if (!preventEnterkeyShiftKey && !preventZeroWithSpace && !fireFoxEnterAtMiddle && ((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
215
216
  !(!isNOU(_this.range.startContainer.previousSibling) &&
216
217
  (_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
217
218
  var isNearBlockLengthZero = void 0;
@@ -276,7 +277,7 @@ var EnterKeyAction = /** @class */ (function () {
276
277
  }
277
278
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), insertElem.nextElementSibling, 0);
278
279
  }
279
- else if (nearBlockNode.textContent.length === 0 && !(!isNOU(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG' ||
280
+ else if (nearBlockNode !== _this.parent.inputElement && nearBlockNode.textContent.length === 0 && !(!isNOU(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG' ||
280
281
  (nearBlockNode.querySelectorAll('video').length > 0) || (nearBlockNode.querySelectorAll('audio').length > 0) || (nearBlockNode.querySelectorAll('img').length > 0))) {
281
282
  if (!isNOU(nearBlockNode.children[0]) && nearBlockNode.children[0].tagName !== 'BR') {
282
283
  var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, false).cloneNode(true);
@@ -332,6 +333,36 @@ var EnterKeyAction = /** @class */ (function () {
332
333
  _this.parent.videoModule.hideVideoQuickToolbar();
333
334
  }
334
335
  }
336
+ else if (_this.parent.enterKey === 'BR' && shiftKey_1 && _this.range.startContainer.nodeType === Node.TEXT_NODE && _this.range.startContainer.parentElement && _this.range.startContainer.parentElement === _this.parent.inputElement) {
337
+ var range = _this.range;
338
+ var startContainer = range.startContainer;
339
+ var startOffset = range.startOffset;
340
+ var newElement = _this.parent.createElement(_this.parent.shiftEnterKey);
341
+ if (startContainer.nodeType === Node.TEXT_NODE && range.endOffset !== 0 && range.startOffset !== 0) {
342
+ var textNode = startContainer;
343
+ if (startOffset < textNode.length) {
344
+ var newTextNode = textNode.splitText(startOffset);
345
+ newElement.appendChild(newTextNode);
346
+ }
347
+ else {
348
+ newElement.innerHTML = '<br>';
349
+ }
350
+ textNode.parentNode.insertBefore(newElement, textNode.nextSibling);
351
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), newElement, 0);
352
+ }
353
+ else if (startOffset === 0 && range.endOffset === 0) {
354
+ newElement.innerHTML = '<br>';
355
+ if (range.endOffset === startContainer.textContent.length) {
356
+ var brElement = _this.parent.createElement('br');
357
+ startContainer.parentNode.insertBefore(brElement, startContainer);
358
+ }
359
+ startContainer.parentNode.insertBefore(newElement, startContainer);
360
+ var cursorTarget = (range.endOffset === startContainer.textContent.length)
361
+ ? newElement : newElement.nextSibling;
362
+ startContainer.parentNode.insertBefore(newElement, startContainer);
363
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), cursorTarget, 0);
364
+ }
365
+ }
335
366
  else {
336
367
  var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, true);
337
368
  if (!isNOU(newElem.childNodes[0]) && newElem.childNodes[0].nodeName === '#text' &&
@@ -431,7 +431,9 @@ var HtmlEditor = /** @class */ (function () {
431
431
  var eventArgs_1 = {
432
432
  callBack: null,
433
433
  event: e.args,
434
- name: 'keydown-handler'
434
+ name: 'keydown-handler',
435
+ enterKey: this.parent.enterKey,
436
+ shiftEnterKey: this.parent.shiftEnterKey
435
437
  };
436
438
  var actionBeginArgs = {
437
439
  cancel: false,
@@ -567,6 +569,26 @@ var HtmlEditor = /** @class */ (function () {
567
569
  if (isNOU(this.oldRangeElement)) {
568
570
  return;
569
571
  }
572
+ else if (findBlockElement[0].previousSibling) {
573
+ var prevSibling = findBlockElement[0].previousSibling;
574
+ var currentElement = findBlockElement[0];
575
+ if (prevSibling.textContent.trim()) {
576
+ if (prevSibling.lastChild.nodeName === 'BR') {
577
+ prevSibling.removeChild(prevSibling.lastChild);
578
+ }
579
+ var cursorpointer = prevSibling.lastChild.textContent.length;
580
+ var lastChild = prevSibling.lastChild;
581
+ var childNodes = Array.from(currentElement.childNodes);
582
+ for (var i = 0; i < childNodes.length; i++) {
583
+ prevSibling.appendChild(childNodes[i].cloneNode(true));
584
+ }
585
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), lastChild, cursorpointer);
586
+ currentElement.parentNode.removeChild(currentElement);
587
+ }
588
+ else {
589
+ prevSibling.parentNode.removeChild(prevSibling);
590
+ }
591
+ }
570
592
  else {
571
593
  if (this.oldRangeElement.tagName === 'OL' || this.oldRangeElement.tagName === 'UL') {
572
594
  this.oldRangeElement = this.oldRangeElement.lastElementChild.lastElementChild
@@ -15,6 +15,8 @@ export declare class Resize {
15
15
  private constructor();
16
16
  private addEventListener;
17
17
  private renderResizable;
18
+ private onIFrameLoad;
19
+ private removeMouseUpEventListener;
18
20
  private resizeStart;
19
21
  private performResize;
20
22
  private stopResize;
@@ -36,13 +36,24 @@ var Resize = /** @class */ (function () {
36
36
  this.iframeElement = this.parent.contentModule.getDocument().querySelectorAll('iframe');
37
37
  if (!isNullOrUndefined(this.iframeElement)) {
38
38
  this.iframeElement.forEach(function (iframe) {
39
- EventHandler.add(iframe.contentDocument, 'mouseup', _this.stopResize, _this);
39
+ EventHandler.add(iframe, 'load', _this.onIFrameLoad, _this);
40
40
  });
41
41
  }
42
42
  this.touchStartEvent = (Browser.info.name === 'msie') ? 'pointerdown' : 'touchstart';
43
43
  EventHandler.add(this.resizer, 'mousedown', this.resizeStart, this);
44
44
  EventHandler.add(this.resizer, this.touchStartEvent, this.resizeStart, this);
45
45
  };
46
+ Resize.prototype.onIFrameLoad = function (e) {
47
+ var iframe = e.target;
48
+ if (iframe.nodeName === 'IFRAME' && iframe.contentDocument) {
49
+ EventHandler.add(iframe.contentDocument, 'mouseup', this.stopResize, this);
50
+ }
51
+ };
52
+ Resize.prototype.removeMouseUpEventListener = function (iframe) {
53
+ if (iframe.contentDocument) {
54
+ EventHandler.remove(iframe.contentDocument, 'mouseup', this.stopResize);
55
+ }
56
+ };
46
57
  Resize.prototype.resizeStart = function (e) {
47
58
  var _this = this;
48
59
  this.isResizing = false;
@@ -149,7 +160,7 @@ var Resize = /** @class */ (function () {
149
160
  }
150
161
  if (!isNullOrUndefined(this.iframeElement)) {
151
162
  this.iframeElement.forEach(function (iframe) {
152
- EventHandler.remove(iframe.contentDocument, 'mouseup', _this.stopResize);
163
+ _this.removeMouseUpEventListener(iframe);
153
164
  });
154
165
  }
155
166
  if (this.resizer) {
@@ -1560,7 +1560,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1560
1560
  this.placeHolderWrapper.innerHTML = this.placeholder;
1561
1561
  if (this.inputElement.textContent.length === 0 && this.inputElement.childNodes.length < 2 && !isNOU(this.inputElement.firstChild) && (this.inputElement.firstChild.nodeName === 'BR' ||
1562
1562
  ((this.inputElement.firstChild.nodeName === 'P' || this.inputElement.firstChild.nodeName === 'DIV') && !isNOU(this.inputElement.firstChild.firstChild) &&
1563
- this.inputElement.firstChild.firstChild.nodeName === 'BR'))) {
1563
+ this.inputElement.firstChild.childNodes.length < 2 && this.inputElement.firstChild.firstChild.nodeName === 'BR'))) {
1564
1564
  this.placeHolderWrapper.classList.add('enabled');
1565
1565
  }
1566
1566
  else {
@@ -2296,7 +2296,6 @@ var RichTextEditor = /** @class */ (function (_super) {
2296
2296
  var value = this.getUpdatedValue();
2297
2297
  this.setProperties({ value: value });
2298
2298
  this.valueContainer.value = this.value;
2299
- this.notify(events.toolbarRefresh, { args: e, documentNode: document });
2300
2299
  this.isValueChangeBlurhandler = true;
2301
2300
  this.invokeChangeEvent();
2302
2301
  this.isFocusOut = true;
@@ -397,10 +397,10 @@ var Link = /** @class */ (function () {
397
397
  }
398
398
  if (!this.selfLink.isUrl(linkUrl)) {
399
399
  if (this.selfLink.parent.editorMode === 'Markdown') {
400
- linkText = (linkText !== '') ? linkText : '';
400
+ linkText = (linkText.trim() !== '') ? linkText : '';
401
401
  }
402
402
  else {
403
- linkText = (linkText === '') ? linkUrl : linkText;
403
+ linkText = (linkText.trim() === '') ? linkUrl : linkText;
404
404
  }
405
405
  if (!this.selfLink.parent.enableAutoUrl) {
406
406
  linkUrl = linkUrl.indexOf('http') > -1 ? linkUrl : 'http://' + linkUrl;
@@ -40,6 +40,7 @@ export declare class Table {
40
40
  private resizeIconPositionTime;
41
41
  private isResizeBind;
42
42
  private isDestroyed;
43
+ private createTablePopupBoundFn;
43
44
  private constructor();
44
45
  protected addEventListener(): void;
45
46
  protected removeEventListener(): void;
@@ -48,7 +49,6 @@ export declare class Table {
48
49
  private afterRender;
49
50
  private dropdownSelect;
50
51
  private UpdateCells;
51
- private keyUp;
52
52
  private keyDown;
53
53
  private tableCellsKeyboardSelection;
54
54
  private resetTableSelection;
@@ -150,4 +150,5 @@ export declare class Table {
150
150
  private getModuleName;
151
151
  private afterKeyDown;
152
152
  private updateResizeIconPosition;
153
+ private createTablePopupKeyDown;
153
154
  }
@@ -1,4 +1,4 @@
1
- import { createElement, detach, closest, Browser, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
1
+ import { createElement, detach, closest, Browser, isNullOrUndefined as isNOU, getComponent } from '@syncfusion/ej2-base';
2
2
  import { isNullOrUndefined, EventHandler, addClass } from '@syncfusion/ej2-base';
3
3
  import { Popup } from '@syncfusion/ej2-popups';
4
4
  import { Button } from '@syncfusion/ej2-buttons';
@@ -45,7 +45,6 @@ var Table = /** @class */ (function () {
45
45
  this.parent.on(events.tableToolbarAction, this.onToolbarAction, this);
46
46
  this.parent.on(events.dropDownSelect, this.dropdownSelect, this);
47
47
  this.parent.on(events.keyDown, this.keyDown, this);
48
- this.parent.on(events.keyUp, this.keyUp, this);
49
48
  this.parent.on(events.tableModulekeyUp, this.tableModulekeyUp, this);
50
49
  this.parent.on(events.bindCssClass, this.setCssClass, this);
51
50
  this.parent.on(events.destroy, this.destroy, this);
@@ -66,7 +65,6 @@ var Table = /** @class */ (function () {
66
65
  this.parent.off(events.mouseDown, this.cellSelect);
67
66
  this.parent.off(events.tableColorPickerChanged, this.setBGColor);
68
67
  this.parent.off(events.keyDown, this.keyDown);
69
- this.parent.off(events.keyUp, this.keyUp);
70
68
  this.parent.off(events.tableModulekeyUp, this.tableModulekeyUp);
71
69
  this.parent.off(events.bindCssClass, this.setCssClass);
72
70
  this.parent.off(events.destroy, this.destroy);
@@ -163,20 +161,6 @@ var Table = /** @class */ (function () {
163
161
  this.parent.formatter.process(this.parent, e, e, { selection: selectCell, subCommand: e.item.subCommand });
164
162
  this.hideTableQuickToolbar();
165
163
  };
166
- Table.prototype.keyUp = function (e) {
167
- var target = e.args.target;
168
- if (e.args.key.toLocaleLowerCase() === 'escape' && target && target.classList && (this.popupObj && !closest(target, '[id=' + '\'' + this.popupObj.element.id + '\'' + ']')) && this.popupObj) {
169
- var createTableToolbarBtn = this.popupObj.relateTo;
170
- if (createTableToolbarBtn.nodeName !== 'BUTTON') {
171
- createTableToolbarBtn = createTableToolbarBtn.querySelector('span.e-create-table');
172
- createTableToolbarBtn = createTableToolbarBtn.parentElement;
173
- }
174
- this.popupObj.hide();
175
- if (createTableToolbarBtn) {
176
- createTableToolbarBtn.focus();
177
- }
178
- }
179
- };
180
164
  Table.prototype.keyDown = function (e) {
181
165
  var event = e.args;
182
166
  // eslint-disable-next-line
@@ -1755,6 +1739,8 @@ var Table = /** @class */ (function () {
1755
1739
  var header = '1X1';
1756
1740
  var insertbtn = this.l10n.getConstant('inserttablebtn');
1757
1741
  this.dlgDiv = this.parent.createElement('div', { className: 'e-rte-table-popup' + this.parent.getCssClass(true), id: this.rteID + '_table' });
1742
+ this.createTablePopupBoundFn = this.createTablePopupKeyDown.bind(this);
1743
+ this.dlgDiv.addEventListener('keydown', this.createTablePopupBoundFn);
1758
1744
  this.tblHeader = this.parent.createElement('div', { className: 'e-rte-popup-header' + this.parent.getCssClass(true) });
1759
1745
  this.tblHeader.innerHTML = header;
1760
1746
  this.dlgDiv.appendChild(this.tblHeader);
@@ -1792,6 +1778,7 @@ var Table = /** @class */ (function () {
1792
1778
  // eslint-disable-next-line
1793
1779
  close: function (event) {
1794
1780
  EventHandler.remove(btnEle, 'click', _this.insertTableDialog);
1781
+ _this.dlgDiv.removeEventListener('keydown', _this.createTablePopupBoundFn);
1795
1782
  detach(btnEle);
1796
1783
  if (_this.createTableButton && !_this.createTableButton.isDestroyed) {
1797
1784
  _this.createTableButton.destroy();
@@ -2175,6 +2162,7 @@ var Table = /** @class */ (function () {
2175
2162
  this.createTableButton.destroy();
2176
2163
  this.createTableButton = null;
2177
2164
  }
2165
+ this.createTablePopupBoundFn = null;
2178
2166
  this.isDestroyed = true;
2179
2167
  };
2180
2168
  /**
@@ -2201,6 +2189,15 @@ var Table = /** @class */ (function () {
2201
2189
  'px; left:' + (tablePosition.left + parseInt(getComputedStyle(this.curTable).width, 10) - 4) + 'px;';
2202
2190
  }
2203
2191
  };
2192
+ Table.prototype.createTablePopupKeyDown = function (e) {
2193
+ if (e.key === 'Escape') {
2194
+ var popupRootElem = e.target.closest('.e-rte-table-popup');
2195
+ var popup = getComponent(popupRootElem, 'popup');
2196
+ var tableToolbarButton = popup.relateTo;
2197
+ popup.hide();
2198
+ tableToolbarButton.focus({ preventScroll: true });
2199
+ }
2200
+ };
2204
2201
  return Table;
2205
2202
  }());
2206
2203
  export { Table };
@@ -645,7 +645,6 @@ var ToolbarRenderer = /** @class */ (function () {
645
645
  var proxy = this;
646
646
  var value;
647
647
  var colorPicker = new ColorPicker({
648
- enablePersistence: this.parent.enablePersistence,
649
648
  enableRtl: this.parent.enableRtl,
650
649
  inline: true,
651
650
  value: null,