@syncfusion/ej2-richtexteditor 19.3.43 → 19.3.47

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.
Files changed (67) hide show
  1. package/CHANGELOG.md +44 -2
  2. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  3. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-richtexteditor.es2015.js +199 -80
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +195 -80
  7. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  8. package/dist/global/ej2-richtexteditor.min.js +2 -2
  9. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  10. package/dist/global/index.d.ts +1 -1
  11. package/package.json +12 -12
  12. package/src/common/constant.d.ts +8 -8
  13. package/src/common/constant.js +8 -8
  14. package/src/editor-manager/base/editor-manager.js +1 -1
  15. package/src/editor-manager/plugin/clearformat.d.ts +1 -0
  16. package/src/editor-manager/plugin/clearformat.js +1 -0
  17. package/src/editor-manager/plugin/image.js +12 -17
  18. package/src/editor-manager/plugin/inserthtml.js +16 -6
  19. package/src/editor-manager/plugin/lists.js +0 -1
  20. package/src/editor-manager/plugin/ms-word-clean-up.js +1 -0
  21. package/src/editor-manager/plugin/selection-commands.d.ts +1 -0
  22. package/src/editor-manager/plugin/selection-commands.js +52 -2
  23. package/src/editor-manager/plugin/table.js +3 -3
  24. package/src/editor-manager/plugin/toolbar-status.js +3 -3
  25. package/src/rich-text-editor/actions/enter-key.js +4 -16
  26. package/src/rich-text-editor/actions/html-editor.d.ts +1 -0
  27. package/src/rich-text-editor/actions/html-editor.js +31 -1
  28. package/src/rich-text-editor/actions/quick-toolbar.js +5 -2
  29. package/src/rich-text-editor/actions/xhtml-validation.d.ts +1 -0
  30. package/src/rich-text-editor/actions/xhtml-validation.js +5 -3
  31. package/src/rich-text-editor/base/rich-text-editor-model.d.ts +6 -6
  32. package/src/rich-text-editor/base/util.d.ts +1 -0
  33. package/src/rich-text-editor/base/util.js +1 -0
  34. package/src/rich-text-editor/renderer/image-module.d.ts +2 -0
  35. package/src/rich-text-editor/renderer/image-module.js +39 -12
  36. package/src/rich-text-editor/renderer/link-module.js +5 -3
  37. package/src/rich-text-editor/renderer/table-module.js +10 -3
  38. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +0 -1
  39. package/src/rich-text-editor/renderer/toolbar-renderer.js +1 -1
  40. package/styles/bootstrap-dark.css +1 -1
  41. package/styles/bootstrap.css +1 -1
  42. package/styles/bootstrap4.css +1 -1
  43. package/styles/bootstrap5-dark.css +1 -1
  44. package/styles/bootstrap5.css +1 -1
  45. package/styles/fabric-dark.css +1 -1
  46. package/styles/fabric.css +1 -1
  47. package/styles/highcontrast-light.css +1 -1
  48. package/styles/highcontrast.css +1 -1
  49. package/styles/material-dark.css +1 -1
  50. package/styles/material.css +1 -1
  51. package/styles/rich-text-editor/_tailwind-definition.scss +1 -1
  52. package/styles/rich-text-editor/_theme.scss +1 -1
  53. package/styles/rich-text-editor/bootstrap-dark.css +1 -1
  54. package/styles/rich-text-editor/bootstrap.css +1 -1
  55. package/styles/rich-text-editor/bootstrap4.css +1 -1
  56. package/styles/rich-text-editor/bootstrap5-dark.css +1 -1
  57. package/styles/rich-text-editor/bootstrap5.css +1 -1
  58. package/styles/rich-text-editor/fabric-dark.css +1 -1
  59. package/styles/rich-text-editor/fabric.css +1 -1
  60. package/styles/rich-text-editor/highcontrast-light.css +1 -1
  61. package/styles/rich-text-editor/highcontrast.css +1 -1
  62. package/styles/rich-text-editor/material-dark.css +1 -1
  63. package/styles/rich-text-editor/material.css +1 -1
  64. package/styles/rich-text-editor/tailwind-dark.css +1 -1
  65. package/styles/rich-text-editor/tailwind.css +1 -1
  66. package/styles/tailwind-dark.css +1 -1
  67. package/styles/tailwind.css +1 -1
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 19.3.43
3
+ * version : 19.3.47
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@18.56.3",
3
+ "_id": "@syncfusion/ej2-richtexteditor@19.3.46",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-A4SCmlOjvTVUxWapX9kGMVSNNLBAtftqknMvjF8zGq6hZL43VGLW2UpoMJqfWIw84dVOhEsuMuyl0Jpvt+8k4Q==",
5
+ "_integrity": "sha512-KQjXb4GwcPJNBiezc3uprAR1P3Z0O2zn0ponoX5Y6KdSgN06/h83YeBbgoOVjQTVtK2ni97KMliyopHBJ8IsFQ==",
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-release/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-18.56.3.tgz",
30
- "_shasum": "826e64146698b4573f40bc66de6a6b253b2e3272",
29
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-19.3.46.tgz",
30
+ "_shasum": "ce6564f5c1887ff8ddd139f2fbbf40ccbacb99fe",
31
31
  "_spec": "@syncfusion/ej2-richtexteditor@*",
32
32
  "_where": "/jenkins/workspace/automation_release_19.1.0.1-ZPMUBNQ6AUYH6YGEFBPVYMEQLRRW2SLD4XCZ6GATNZJFYJ3RIAOA/packages/included",
33
33
  "author": {
@@ -38,13 +38,13 @@
38
38
  },
39
39
  "bundleDependencies": false,
40
40
  "dependencies": {
41
- "@syncfusion/ej2-base": "~19.3.43",
42
- "@syncfusion/ej2-buttons": "~19.3.43",
43
- "@syncfusion/ej2-filemanager": "~19.3.43",
44
- "@syncfusion/ej2-inputs": "~19.3.43",
45
- "@syncfusion/ej2-navigations": "~19.3.43",
46
- "@syncfusion/ej2-popups": "~19.3.43",
47
- "@syncfusion/ej2-splitbuttons": "~19.3.43"
41
+ "@syncfusion/ej2-base": "~19.3.47",
42
+ "@syncfusion/ej2-buttons": "~19.3.44",
43
+ "@syncfusion/ej2-filemanager": "~19.3.44",
44
+ "@syncfusion/ej2-inputs": "~19.3.47",
45
+ "@syncfusion/ej2-navigations": "~19.3.46",
46
+ "@syncfusion/ej2-popups": "~19.3.47",
47
+ "@syncfusion/ej2-splitbuttons": "~19.3.47"
48
48
  },
49
49
  "deprecated": false,
50
50
  "description": "Essential JS 2 RichTextEditor component",
@@ -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.43",
73
+ "version": "19.3.47",
74
74
  "sideEffects": false
75
75
  }
@@ -68,14 +68,14 @@ export declare const MS_WORD_CLEANUP_PLUGIN: string;
68
68
  */
69
69
  export declare const MS_WORD_CLEANUP: string;
70
70
  /**
71
- * ActionBegin event callback
72
- *
73
- * @hidden
74
- */
71
+ * ActionBegin event callback
72
+ *
73
+ * @hidden
74
+ */
75
75
  export declare const ON_BEGIN: string;
76
76
  /**
77
- * Callback for spacelist action
78
- *
79
- * @hidden
80
- */
77
+ * Callback for spacelist action
78
+ *
79
+ * @hidden
80
+ */
81
81
  export declare const SPACE_ACTION: string;
@@ -68,14 +68,14 @@ export var MS_WORD_CLEANUP_PLUGIN = 'ms_word_cleanup_plugin';
68
68
  */
69
69
  export var MS_WORD_CLEANUP = 'ms_word_cleanup';
70
70
  /**
71
- * ActionBegin event callback
72
- *
73
- * @hidden
74
- */
71
+ * ActionBegin event callback
72
+ *
73
+ * @hidden
74
+ */
75
75
  export var ON_BEGIN = 'onBegin';
76
76
  /**
77
- * Callback for spacelist action
78
- *
79
- * @hidden
80
- */
77
+ * Callback for spacelist action
78
+ *
79
+ * @hidden
80
+ */
81
81
  export var SPACE_ACTION = 'actionBegin';
@@ -93,7 +93,7 @@ var EditorManager = /** @class */ (function () {
93
93
  */
94
94
  /* eslint-enable */
95
95
  EditorManager.prototype.execCommand = function (command, value, event, callBack, text, exeValue, selector, enterAction) {
96
- switch (command.toLocaleLowerCase()) {
96
+ switch (command.toLowerCase()) {
97
97
  case 'lists':
98
98
  this.observer.notify(EVENTS.LIST_TYPE, { subCommand: value, event: event, callBack: callBack,
99
99
  selector: selector, item: exeValue, enterAction: enterAction });
@@ -10,6 +10,7 @@ export declare class ClearFormat {
10
10
  *
11
11
  * @param {Document} docElement - specifies the document element.
12
12
  * @param {Node} endNode - specifies the end node
13
+ * @param {string} enterAction - specifies the enter key action
13
14
  * @param {string} selector - specifies the string value
14
15
  * @returns {void}
15
16
  * @hidden
@@ -16,6 +16,7 @@ var ClearFormat = /** @class */ (function () {
16
16
  *
17
17
  * @param {Document} docElement - specifies the document element.
18
18
  * @param {Node} endNode - specifies the end node
19
+ * @param {string} enterAction - specifies the enter key action
19
20
  * @param {string} selector - specifies the string value
20
21
  * @returns {void}
21
22
  * @hidden
@@ -32,7 +32,7 @@ var ImageCommand = /** @class */ (function () {
32
32
 
33
33
  */
34
34
  ImageCommand.prototype.imageCommand = function (e) {
35
- switch (e.value.toString().toLocaleLowerCase()) {
35
+ switch (e.value.toString().toLowerCase()) {
36
36
  case 'image':
37
37
  case 'replace':
38
38
  this.createImage(e);
@@ -109,21 +109,8 @@ var ImageCommand = /** @class */ (function () {
109
109
  var selectedNode = this.parent.nodeSelection.getSelectedNodes(this.parent.currentDocument)[0];
110
110
  var imgElm_1 = (e.value === 'Replace' || isReplaced) ? e.item.selectParent[0] :
111
111
  (Browser.isIE ? selectedNode.previousSibling : selectedNode.previousElementSibling);
112
- var preventLoadCall_1 = false;
113
112
  imgElm_1.addEventListener('load', function () {
114
- if (e.value === 'Replace' || isReplaced) {
115
- if (!preventLoadCall_1) {
116
- e.callBack({
117
- requestType: 'Images',
118
- editorMode: 'HTML',
119
- event: e.event,
120
- range: _this.parent.nodeSelection.getRange(_this.parent.currentDocument),
121
- elements: [imgElm_1]
122
- });
123
- preventLoadCall_1 = true;
124
- }
125
- }
126
- else {
113
+ if (e.value !== 'Replace' || !isReplaced) {
127
114
  e.callBack({
128
115
  requestType: 'Images',
129
116
  editorMode: 'HTML',
@@ -253,10 +240,18 @@ var ImageCommand = /** @class */ (function () {
253
240
  var selectNode = e.item.selectNode[0];
254
241
  selectNode.style.height = '';
255
242
  selectNode.style.width = '';
256
- e.item.width !== 'auto' ? selectNode.style.width = formatUnit(e.item.width) :
243
+ if (e.item.width !== 'auto') {
244
+ selectNode.style.width = formatUnit(e.item.width);
245
+ }
246
+ else {
257
247
  selectNode.removeAttribute('width');
258
- e.item.height !== 'auto' ? selectNode.style.height = formatUnit(e.item.height) :
248
+ }
249
+ if (e.item.height !== 'auto') {
250
+ selectNode.style.height = formatUnit(e.item.height);
251
+ }
252
+ else {
259
253
  selectNode.removeAttribute('height');
254
+ }
260
255
  this.callBack(e);
261
256
  };
262
257
  ImageCommand.prototype.imageCaption = function (e) {
@@ -34,6 +34,11 @@ var InsertHtml = /** @class */ (function () {
34
34
  var nodeSelection = new NodeSelection();
35
35
  var nodeCutter = new NodeCutter();
36
36
  var range = nodeSelection.getRange(docElement);
37
+ if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
38
+ range.startOffset === range.endOffset && editNode.textContent.length === 0 && editNode.children[0].tagName === 'P') {
39
+ nodeSelection.setSelectionText(docElement, range.startContainer.children[0], range.startContainer.children[0], 0, 0);
40
+ range = nodeSelection.getRange(docElement);
41
+ }
37
42
  var isCursor = range.startOffset === range.endOffset && range.startOffset === 0 &&
38
43
  range.startContainer === range.endContainer;
39
44
  var isCollapsed = range.collapsed;
@@ -345,15 +350,20 @@ var InsertHtml = /** @class */ (function () {
345
350
  blockNode = range.endContainer;
346
351
  range.setEnd(blockNode, range.endContainer.textContent.length);
347
352
  }
348
- if (!isNOU(blockNode) && editNode === blockNode &&
349
- range.startContainer === editNode && range.endContainer === editNode) {
350
- blockNode = editNode.firstElementChild;
351
- range.setStart(editNode.firstElementChild, editNode.firstElementChild.textContent.length);
352
- range.setEnd(editNode.firstElementChild, editNode.firstElementChild.textContent.length);
353
- }
354
353
  if (blockNode.nodeName === 'BODY' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
355
354
  blockNode = range.startContainer;
356
355
  }
356
+ if (blockNode.closest('LI') && node && node.firstElementChild &&
357
+ ((node).firstElementChild.tagName === 'OL' || node.firstElementChild.tagName === 'UL')) {
358
+ var liNode = void 0;
359
+ while (node.firstElementChild.lastElementChild && node.firstElementChild.lastElementChild.tagName === 'LI') {
360
+ liNode = node.firstElementChild.lastElementChild;
361
+ liNode.style.removeProperty('margin-left');
362
+ liNode.style.removeProperty('margin-top');
363
+ liNode.style.removeProperty('margin-bottom');
364
+ node.firstElementChild.insertAdjacentElement('afterend', liNode);
365
+ }
366
+ }
357
367
  if (blockNode.nodeName === 'TD' || blockNode.nodeName === 'TH') {
358
368
  var tempSpan = createElement('span', { className: 'tempSpan' });
359
369
  range.insertNode(tempSpan);
@@ -83,7 +83,6 @@ var Lists = /** @class */ (function () {
83
83
  }
84
84
  }
85
85
  };
86
- // eslint-disable-next-line
87
86
  Lists.prototype.enterList = function (e) {
88
87
  var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
89
88
  var startNode = range.startContainer.nodeName === 'LI' ? range.startContainer :
@@ -113,6 +113,7 @@ var MsWordPaste = /** @class */ (function () {
113
113
  var imgSrc = [];
114
114
  var base64Src = [];
115
115
  var imgName = [];
116
+ // eslint-disable-next-line
116
117
  var linkRegex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi);
117
118
  if (imgElem.length > 0) {
118
119
  for (var i = 0; i < imgElem.length; i++) {
@@ -6,6 +6,7 @@ export declare class SelectionCommands {
6
6
  * @param {Document} docElement - specifies the document
7
7
  * @param {string} format - specifies the string value
8
8
  * @param {Node} endNode - specifies the end node
9
+ * @param {string} enterAction - specifies the enter key action
9
10
  * @param {string} value - specifies the string value
10
11
  * @param {string} selector - specifies the string
11
12
  * @returns {void}
@@ -17,6 +17,7 @@ var SelectionCommands = /** @class */ (function () {
17
17
  * @param {Document} docElement - specifies the document
18
18
  * @param {string} format - specifies the string value
19
19
  * @param {Node} endNode - specifies the end node
20
+ * @param {string} enterAction - specifies the enter key action
20
21
  * @param {string} value - specifies the string value
21
22
  * @param {string} selector - specifies the string
22
23
  * @returns {void}
@@ -31,7 +32,6 @@ var SelectionCommands = /** @class */ (function () {
31
32
  if (format === 'backgroundcolor' && value === '') {
32
33
  value = 'transparent';
33
34
  }
34
- var preventRestore = false;
35
35
  var domSelection = new NodeSelection();
36
36
  var domNode = new DOMNode(endNode, docElement);
37
37
  var nodeCutter = new NodeCutter();
@@ -43,6 +43,7 @@ var SelectionCommands = /** @class */ (function () {
43
43
  var isCollapsed = false;
44
44
  var isFormat = false;
45
45
  var isCursor = false;
46
+ var preventRestore = false;
46
47
  var isFontStyle = (['fontcolor', 'fontname', 'fontsize', 'backgroundcolor'].indexOf(format) > -1);
47
48
  if (range.collapsed) {
48
49
  if (nodes.length > 0) {
@@ -66,6 +67,9 @@ var SelectionCommands = /** @class */ (function () {
66
67
  else {
67
68
  domSelection.endOffset = domSelection.startOffset = 1;
68
69
  }
70
+ if (cursorNode.nodeName === 'BR' && cursorNode.parentNode.textContent.length === 0) {
71
+ preventRestore = true;
72
+ }
69
73
  }
70
74
  }
71
75
  isCursor = range.collapsed;
@@ -113,7 +117,53 @@ var SelectionCommands = /** @class */ (function () {
113
117
  var cursorNode = null;
114
118
  if (cursorFormat) {
115
119
  cursorNode = cursorNodes[0];
116
- InsertMethods.unwrap(cursorFormat);
120
+ if (cursorFormat.firstChild.textContent.charCodeAt(0) === 8203) {
121
+ var isCursorEqual = false;
122
+ var regEx = new RegExp(String.fromCharCode(8203), 'g');
123
+ var emptySpaceNode = void 0;
124
+ if (cursorFormat.firstChild === cursorNode) {
125
+ cursorNode.textContent = cursorNode.textContent.replace(regEx, '');
126
+ emptySpaceNode = cursorNode;
127
+ isCursorEqual = true;
128
+ }
129
+ else {
130
+ cursorFormat.firstChild.textContent = cursorFormat.firstChild.textContent.replace(regEx, '');
131
+ emptySpaceNode = cursorFormat.firstChild;
132
+ }
133
+ var pointer = void 0;
134
+ if (emptySpaceNode.textContent.length === 0) {
135
+ if (!isNOU(emptySpaceNode.previousSibling)) {
136
+ cursorNode = emptySpaceNode.previousSibling;
137
+ pointer = emptySpaceNode.textContent.length - 1;
138
+ domSelection.setCursorPoint(docElement, emptySpaceNode, pointer);
139
+ }
140
+ else if (!isNOU(emptySpaceNode.parentElement) && emptySpaceNode.parentElement.textContent.length === 0) {
141
+ var brElem = document.createElement('BR');
142
+ emptySpaceNode.parentElement.appendChild(brElem);
143
+ detach(emptySpaceNode);
144
+ cursorNode = brElem;
145
+ domSelection.setCursorPoint(docElement, cursorNode.parentElement, 0);
146
+ }
147
+ }
148
+ }
149
+ if ((['fontcolor', 'fontname', 'fontsize', 'backgroundcolor'].indexOf(format) > -1)) {
150
+ if (format === 'fontcolor') {
151
+ cursorFormat.style.color = value;
152
+ }
153
+ else if (format === 'fontname') {
154
+ cursorFormat.style.fontFamily = value;
155
+ }
156
+ else if (format === 'fontsize') {
157
+ cursorFormat.style.fontSize = value;
158
+ }
159
+ else {
160
+ cursorFormat.style.backgroundColor = value;
161
+ }
162
+ cursorNode = cursorFormat;
163
+ }
164
+ else {
165
+ InsertMethods.unwrap(cursorFormat);
166
+ }
117
167
  }
118
168
  else {
119
169
  if (cursorNodes.length > 1 && range.startOffset > 0 && (cursorNodes[0].firstElementChild &&
@@ -223,7 +223,7 @@ var TableCommand = /** @class */ (function () {
223
223
  var currentTabElm = closest(curRow, 'table');
224
224
  var thTdElm = closest(curRow, 'table').querySelectorAll('th,td');
225
225
  for (var i = 0; i < thTdElm.length; i++) {
226
- thTdElm[i].dataset.oldWidth = (thTdElm[i].offsetWidth / currentTabElm.offsetWidth * 100) + "%";
226
+ thTdElm[i].dataset.oldWidth = (thTdElm[i].offsetWidth / currentTabElm.offsetWidth * 100) + '%';
227
227
  }
228
228
  for (var i = 0; i < allRows.length; i++) {
229
229
  curCell = allRows[i].querySelectorAll(':scope > td, :scope > th')[colIndex];
@@ -236,11 +236,11 @@ var TableCommand = /** @class */ (function () {
236
236
  // eslint-disable-next-line
237
237
  (e.item.subCommand === 'InsertColumnLeft') ? curCell.parentElement.insertBefore(colTemplate, curCell) :
238
238
  this.insertAfter(colTemplate, curCell);
239
- colTemplate.style.width = currentWidth.toFixed(4) + "%";
239
+ colTemplate.style.width = currentWidth.toFixed(4) + '%';
240
240
  delete colTemplate.dataset.oldWidth;
241
241
  }
242
242
  for (var i = 0; i < thTdElm.length; i++) {
243
- thTdElm[i].style.width = (Number(thTdElm[i].dataset.oldWidth.split('%')[0]) * currentWidth / previousWidth).toFixed(4) + "%";
243
+ thTdElm[i].style.width = (Number(thTdElm[i].dataset.oldWidth.split('%')[0]) * currentWidth / previousWidth).toFixed(4) + '%';
244
244
  delete thTdElm[i].dataset.oldWidth;
245
245
  }
246
246
  e.item.selection.setSelectionText(this.parent.currentDocument, selectedCell, selectedCell, 0, 0);
@@ -35,8 +35,8 @@ var ToolbarStatus = /** @class */ (function () {
35
35
  var range = nodeSelection.getRange(docElement);
36
36
  for (var index = 0; index < nodes.length; index++) {
37
37
  while (nodes[index].nodeType === 3 && range.startContainer.nodeType === 3 && nodes[index].parentNode &&
38
- nodes[index].parentNode.lastElementChild && nodes[index].parentNode.lastElementChild.nodeName !== "BR" &&
39
- this.getImmediateBlockNode(nodes[index].parentNode, targetNode).textContent.replace(/\u200B/g, '').length === 0 &&
38
+ nodes[index].parentNode.lastElementChild && nodes[index].parentNode.lastElementChild.nodeName !== 'BR' &&
39
+ (this.getImmediateBlockNode(nodes[index].parentNode)).textContent.replace(/\u200B/g, '').length === 0 &&
40
40
  range.startContainer.textContent.replace(/\u200B/g, '').length === 0 &&
41
41
  nodeSelection.get(docElement).toString().replace(/\u200B/g, '').length === 0) {
42
42
  nodes[index] = nodes[index].parentNode.lastElementChild.firstChild;
@@ -112,7 +112,7 @@ var ToolbarStatus = /** @class */ (function () {
112
112
  }
113
113
  return nodeCollection;
114
114
  };
115
- ToolbarStatus.getImmediateBlockNode = function (node, editNode) {
115
+ ToolbarStatus.getImmediateBlockNode = function (node) {
116
116
  do {
117
117
  node = node.parentNode;
118
118
  } while (node && CONSTANT.BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0);
@@ -69,9 +69,7 @@ var EnterKeyAction = /** @class */ (function () {
69
69
  }
70
70
  else if (focusElem.textContent.length === 0) {
71
71
  var currentFocusElem = focusElem.previousSibling.lastChild;
72
- var finalFocusElem = void 0;
73
72
  while (currentFocusElem.nodeName !== '#text') {
74
- finalFocusElem = currentFocusElem;
75
73
  currentFocusElem = currentFocusElem.lastChild;
76
74
  }
77
75
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), currentFocusElem, currentFocusElem.textContent.length);
@@ -86,9 +84,9 @@ var EnterKeyAction = /** @class */ (function () {
86
84
  _this.getRangeNode();
87
85
  }
88
86
  }
89
- if (_this.range.startContainer === _this.range.endContainer && _this.range.startOffset === 0 &&
90
- _this.range.startOffset == _this.range.endOffset && _this.range.startContainer === _this.parent.inputElement) {
91
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.range.startContainer.childNodes[_this.range.startOffset], _this.range.startOffset);
87
+ if (_this.range.startContainer === _this.range.endContainer &&
88
+ _this.range.startOffset === _this.range.endOffset && _this.range.startContainer === _this.parent.inputElement) {
89
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.range.startContainer.childNodes[_this.range.startOffset], 0);
92
90
  _this.getRangeNode();
93
91
  }
94
92
  if (_this.parent.enterKey === 'P' || _this.parent.enterKey === 'DIV' ||
@@ -164,7 +162,7 @@ var EnterKeyAction = /** @class */ (function () {
164
162
  }
165
163
  _this.parent.formatter.editorManager.domNode.insertAfter(insertElm, newElem);
166
164
  detach(newElem);
167
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), insertElm, insertElm.textContent.length >= 0 ? 0 : 1);
165
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode) ? insertElm : _this.startNode, 0);
168
166
  }
169
167
  }
170
168
  e.args.preventDefault();
@@ -204,18 +202,14 @@ var EnterKeyAction = /** @class */ (function () {
204
202
  }
205
203
  else {
206
204
  var newElem = void 0;
207
- var focusElem = void 0;
208
205
  var outerBRElem = _this.parent.createElement('br');
209
206
  if (_this.range.startOffset === 0 && _this.range.endOffset === 0 &&
210
207
  !isNOU(currentParent.previousSibling) && currentParent.previousSibling.nodeName === 'BR') {
211
- focusElem = _this.range.startContainer;
212
208
  newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, currentParent, false).cloneNode(true);
213
209
  _this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
214
210
  _this.insertFocusContent();
215
211
  var currentFocusElem = outerBRElem.nextSibling;
216
- var finalFocusElem = void 0;
217
212
  while (!isNOU(currentFocusElem) && currentFocusElem.nodeName !== '#text') {
218
- finalFocusElem = currentFocusElem;
219
213
  currentFocusElem = currentFocusElem.lastChild;
220
214
  }
221
215
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), currentFocusElem, 0);
@@ -253,12 +247,6 @@ var EnterKeyAction = /** @class */ (function () {
253
247
  }
254
248
  e.args.preventDefault();
255
249
  }
256
- if (_this.range.startContainer.nodeName === '#text') {
257
- _this.range.startContainer.parentElement.scrollIntoView(false);
258
- }
259
- else {
260
- _this.range.startContainer.scrollIntoView(false);
261
- }
262
250
  _this.parent.trigger(events.actionComplete, { requestType: shiftKey_1 ? 'ShiftEnterAction' : 'EnterAction', args: e.args });
263
251
  }
264
252
  });
@@ -41,6 +41,7 @@ export declare class HtmlEditor {
41
41
  private updateReadOnly;
42
42
  private onSelectionSave;
43
43
  private onSelectionRestore;
44
+ private onKeyUp;
44
45
  private onKeyDown;
45
46
  private isOrderedList;
46
47
  private isUnOrderedList;
@@ -56,6 +56,7 @@ var HtmlEditor = /** @class */ (function () {
56
56
  this.parent.on(events.initialLoad, this.instantiateRenderer, this);
57
57
  this.parent.on(events.htmlToolbarClick, this.onToolbarClick, this);
58
58
  this.parent.on(events.keyDown, this.onKeyDown, this);
59
+ this.parent.on(events.keyUp, this.onKeyUp, this);
59
60
  this.parent.on(events.renderColorPicker, this.renderColorPicker, this);
60
61
  this.parent.on(events.initialEnd, this.render, this);
61
62
  this.parent.on(events.modelChanged, this.onPropertyChanged, this);
@@ -90,6 +91,30 @@ var HtmlEditor = /** @class */ (function () {
90
91
  this.saveSelection.restore();
91
92
  }
92
93
  };
94
+ HtmlEditor.prototype.onKeyUp = function (e) {
95
+ var args = e.args;
96
+ var restrictKeys = [8, 9, 13, 16, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
97
+ 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123];
98
+ var range = this.parent.getRange();
99
+ var regEx = new RegExp(String.fromCharCode(8203), 'g');
100
+ var pointer;
101
+ if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey) {
102
+ if (range.startContainer.textContent.charCodeAt(0) === 8203) {
103
+ pointer = range.startOffset - 1;
104
+ range.startContainer.textContent = range.startContainer.textContent.replace(regEx, '');
105
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), range.startContainer, pointer);
106
+ }
107
+ if (!isNOU(range.startContainer.previousSibling) && !isNOU(range.startContainer.previousSibling.parentElement) &&
108
+ range.startContainer.parentElement === range.startContainer.previousSibling.parentElement && range.startContainer.previousSibling.textContent.charCodeAt(0) === 8203) {
109
+ range.startContainer.previousSibling.textContent = range.startContainer.previousSibling.textContent.replace(regEx, '');
110
+ }
111
+ if (range.endContainer.textContent.charCodeAt(range.endOffset) === 8203) {
112
+ pointer = range.startOffset;
113
+ range.endContainer.textContent = range.endContainer.textContent.replace(regEx, '');
114
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), range.startContainer, pointer);
115
+ }
116
+ }
117
+ };
93
118
  HtmlEditor.prototype.onKeyDown = function (e) {
94
119
  var _this = this;
95
120
  var currentRange;
@@ -300,7 +325,12 @@ var HtmlEditor = /** @class */ (function () {
300
325
  while (this.deleteOldRangeElement.firstChild) {
301
326
  this.deleteRangeElement.appendChild(this.deleteOldRangeElement.childNodes[0]);
302
327
  }
303
- !isLiElement ? detach(this.deleteOldRangeElement) : detach(this.deleteOldRangeElement.parentElement);
328
+ if (!isLiElement) {
329
+ detach(this.deleteOldRangeElement);
330
+ }
331
+ else {
332
+ detach(this.deleteOldRangeElement.parentElement);
333
+ }
304
334
  this.deleteRangeElement.normalize();
305
335
  }
306
336
  else {
@@ -1,4 +1,4 @@
1
- import { select, isNullOrUndefined, Browser, addClass, removeClass, EventHandler, closest } from '@syncfusion/ej2-base';
1
+ import { select, isNullOrUndefined, Browser, addClass, removeClass, EventHandler, closest, isNullOrUndefined as isNOU } from '@syncfusion/ej2-base';
2
2
  import { RenderType } from '../base/enum';
3
3
  import * as events from '../base/constant';
4
4
  import { pageYOffset, hasClass, isIDevice } from '../base/util';
@@ -193,7 +193,10 @@ var QuickToolbar = /** @class */ (function () {
193
193
  else {
194
194
  var closestAnchor = closest(target, 'a');
195
195
  target = closestAnchor ? closestAnchor : target;
196
- if (target.tagName !== 'IMG' && target.tagName !== 'A' && (!closest(target, 'td,th') || !range.collapsed)) {
196
+ var startNode = this.parent.getRange().startContainer.parentElement;
197
+ var endNode = this.parent.getRange().endContainer.parentElement;
198
+ if ((isNOU(closest(startNode, 'A')) || isNOU(closest(endNode, 'A'))) && (!closest(target, 'td,th') || !range.collapsed) &&
199
+ (target.tagName !== 'IMG' || this.parent.getRange().startOffset !== this.parent.getRange().endOffset)) {
197
200
  if (this.parent.inlineMode.onSelection && range.collapsed) {
198
201
  return;
199
202
  }
@@ -11,6 +11,7 @@ export declare class XhtmlValidation {
11
11
  private enableXhtmlValidation;
12
12
  /**
13
13
  * @param {string} currentValue - specifies the string value.
14
+ * @param {number} valueLength - specifies the length of the current value.
14
15
  * @returns {void}
15
16
 
16
17
  */
@@ -29,22 +29,24 @@ var XhtmlValidation = /** @class */ (function () {
29
29
  this.ImageTags();
30
30
  this.removeTags();
31
31
  this.RemoveUnsupported();
32
- this.currentElement.innerHTML = this.selfEncloseValidation(this.currentElement.innerHTML, this.currentElement.innerText === "\n" ? this.currentElement.innerText.length : this.currentElement.innerText.trim().length);
32
+ this.currentElement.innerHTML = this.selfEncloseValidation(this.currentElement.innerHTML, this.currentElement.innerText === '\n' ?
33
+ this.currentElement.innerText.length : this.currentElement.innerText.trim().length);
33
34
  this.parent.setProperties({ value: this.currentElement.innerHTML }, true);
34
35
  }
35
36
  };
36
37
  /**
37
38
  * @param {string} currentValue - specifies the string value.
39
+ * @param {number} valueLength - specifies the length of the current value.
38
40
  * @returns {void}
39
41
 
40
42
  */
41
43
  XhtmlValidation.prototype.selfEncloseValidation = function (currentValue, valueLength) {
42
44
  if (valueLength === 0 && currentValue.indexOf('table') < 0 && currentValue.indexOf('img') < 0) {
43
45
  var arrayValue = currentValue.split('&nbsp;');
44
- arrayValue[arrayValue.length - 1] = "&#8203;" + arrayValue[arrayValue.length - 1];
46
+ arrayValue[arrayValue.length - 1] = '&#8203;' + arrayValue[arrayValue.length - 1];
45
47
  currentValue = arrayValue.join('');
46
48
  }
47
- currentValue = currentValue.replace(/<br>/g, '<br/>').replace(/<hr>/g, '<hr/>').replace(/&nbsp;/gi, ' ').replace(/ /g, ' ');
49
+ currentValue = currentValue.replace(/<br>/g, '<br/>').replace(/<hr>/g, '<hr/>').replace(/ /g, ' ');
48
50
  var valueTemp;
49
51
  var valueDupe = [];
50
52
  var valueOriginal = [];
@@ -333,11 +333,11 @@ export interface RichTextEditorModel extends ComponentModel{
333
333
 
334
334
  /**
335
335
  * Specifies tag to be inserted when enter key is pressed.
336
- *
336
+ *
337
337
  * - `P` - When the enter key is pressed a `p` tag will be inserted and the default value of the Rich Text Editor will be &lt;p&gt;&lt;br&gt;&lt;/p&gt;.
338
- *
338
+ *
339
339
  * - `DIV` - When the enter key is pressed a `div` tag will be inserted instead of the default `P` tag and the default value of the Rich Text Editor will be &lt;div&gt;&lt;br&gt;&lt;/div&gt;.
340
- *
340
+ *
341
341
  * - `BR` - When the enter key is pressed a `br` tag will be inserted instead of the default `P` tag and the default value of the Rich Text Editor will be &lt;br&gt;.
342
342
  *
343
343
  * @default 'P'
@@ -346,11 +346,11 @@ export interface RichTextEditorModel extends ComponentModel{
346
346
 
347
347
  /**
348
348
  * Specifies tags to be inserted when shift+enter key is pressed.
349
- *
349
+ *
350
350
  * - `BR` - When the shift + enter key is pressed a `br` tag will be inserted which is the default behavior.
351
- *
351
+ *
352
352
  * - `P` - When the shift + enter key is pressed a `p` tag will be inserted instead of the default `br` tag.
353
- *
353
+ *
354
354
  * - `DIV` - When the shift + enter key is pressed a `div` tag will be inserted instead of the default `br` tag.
355
355
  *
356
356
  * @default 'BR'
@@ -125,6 +125,7 @@ export declare function toObjectLowerCase(obj: {
125
125
  export declare function getEditValue(value: string, rteObj: IRichTextEditor): string;
126
126
  /**
127
127
  * @param {string} value - specifies the value
128
+ * @param {IRichTextEditor} rteObj - specifies the rich text editor instance.
128
129
  * @returns {string} - returns the string
129
130
  * @hidden
130
131
  */
@@ -398,6 +398,7 @@ export function getEditValue(value, rteObj) {
398
398
  }
399
399
  /**
400
400
  * @param {string} value - specifies the value
401
+ * @param {IRichTextEditor} rteObj - specifies the rich text editor instance.
401
402
  * @returns {string} - returns the string
402
403
  * @hidden
403
404
  */
@@ -33,6 +33,7 @@ export declare class Image {
33
33
  private changedHeightValue;
34
34
  private inputWidthValue;
35
35
  private inputHeightValue;
36
+ private removingImgName;
36
37
  private constructor();
37
38
  protected addEventListener(): void;
38
39
  protected removeEventListener(): void;
@@ -78,6 +79,7 @@ export declare class Image {
78
79
  private isUrl;
79
80
  private deleteImg;
80
81
  private imageRemovePost;
82
+ private triggerPost;
81
83
  private caption;
82
84
  private imageSize;
83
85
  private break;