@syncfusion/ej2-richtexteditor 19.3.53 → 19.4.40

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 (38) hide show
  1. package/.github/PULL_REQUEST_TEMPLATE/Bug.md +41 -0
  2. package/.github/PULL_REQUEST_TEMPLATE/Feature.md +27 -0
  3. package/CHANGELOG.md +26 -0
  4. package/README.md +1 -1
  5. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  6. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  7. package/dist/es6/ej2-richtexteditor.es2015.js +200 -74
  8. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  9. package/dist/es6/ej2-richtexteditor.es5.js +199 -73
  10. package/dist/es6/ej2-richtexteditor.es5.js.map +1 -1
  11. package/dist/global/ej2-richtexteditor.min.js +2 -2
  12. package/dist/global/ej2-richtexteditor.min.js.map +1 -1
  13. package/dist/global/index.d.ts +1 -1
  14. package/package.json +12 -12
  15. package/src/editor-manager/plugin/inserthtml.js +9 -1
  16. package/src/editor-manager/plugin/lists.js +2 -1
  17. package/src/editor-manager/plugin/ms-word-clean-up.js +1 -1
  18. package/src/editor-manager/plugin/selection-commands.js +10 -5
  19. package/src/editor-manager/plugin/undo.js +10 -1
  20. package/src/rich-text-editor/actions/color-picker.d.ts +1 -0
  21. package/src/rich-text-editor/actions/color-picker.js +2 -1
  22. package/src/rich-text-editor/actions/dropdown-buttons.js +0 -10
  23. package/src/rich-text-editor/actions/enter-key.d.ts +1 -0
  24. package/src/rich-text-editor/actions/enter-key.js +85 -34
  25. package/src/rich-text-editor/actions/html-editor.js +2 -2
  26. package/src/rich-text-editor/actions/quick-toolbar.d.ts +1 -0
  27. package/src/rich-text-editor/actions/quick-toolbar.js +16 -1
  28. package/src/rich-text-editor/actions/xhtml-validation.js +1 -1
  29. package/src/rich-text-editor/base/interface.d.ts +3 -1
  30. package/src/rich-text-editor/base/rich-text-editor.js +1 -1
  31. package/src/rich-text-editor/formatter/formatter.js +3 -3
  32. package/src/rich-text-editor/renderer/image-module.js +52 -7
  33. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +1 -1
  34. package/src/rich-text-editor/renderer/toolbar-renderer.js +3 -2
  35. package/src/selection/selection.js +2 -1
  36. package/styles/rich-text-editor/_fluent-definition.scss +168 -0
  37. package/styles/rich-text-editor/_layout.scss +1 -1
  38. package/styles/rich-text-editor/icons/_fluent.scss +303 -0
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 19.3.53
3
+ * version : 19.4.40
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.47",
3
+ "_id": "@syncfusion/ej2-richtexteditor@19.4.38",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-/BK1Sra/cZEcdzxtW5HlFA0s3mWVWhVccB6Pi1jHChg5TR/EVyb1j1xfhCLxTLPrhMmDnmu5O+aD+iNnYalEdQ==",
5
+ "_integrity": "sha512-6lQRXzKBKx2rTh/eLeuOvRrNIGH+pQWuxYXfpi1Hsp2ufATyr9PRjEWAM412RFF5QJD2Ujy36dYqDh31SwcuLQ==",
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.47.tgz",
30
- "_shasum": "09553933f0e8a9ac2736013e839d1cc49f1c0a29",
29
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-19.4.38.tgz",
30
+ "_shasum": "626f34d5f0affb5b5fbd7f5f0435b6abe546d7bd",
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.53",
42
- "@syncfusion/ej2-buttons": "~19.3.53",
43
- "@syncfusion/ej2-filemanager": "~19.3.53",
44
- "@syncfusion/ej2-inputs": "~19.3.53",
45
- "@syncfusion/ej2-navigations": "~19.3.53",
46
- "@syncfusion/ej2-popups": "~19.3.53",
47
- "@syncfusion/ej2-splitbuttons": "~19.3.53"
41
+ "@syncfusion/ej2-base": "~19.4.38",
42
+ "@syncfusion/ej2-buttons": "~19.4.38",
43
+ "@syncfusion/ej2-filemanager": "~19.4.38",
44
+ "@syncfusion/ej2-inputs": "~19.4.38",
45
+ "@syncfusion/ej2-navigations": "~19.4.40",
46
+ "@syncfusion/ej2-popups": "~19.4.38",
47
+ "@syncfusion/ej2-splitbuttons": "~19.4.40"
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.53",
73
+ "version": "19.4.40",
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
  }
@@ -46,8 +46,9 @@ var Lists = /** @class */ (function () {
46
46
  Lists.prototype.testCurrentList = function (range) {
47
47
  var olListStartRegex = [/^[1]+[.]+$/, /^[i]+[.]+$/, /^[a]+[.]+$/];
48
48
  if (!isNullOrUndefined(range.startContainer.textContent.slice(0, range.startOffset))) {
49
+ var currentContent = range.startContainer.textContent.replace(/\u200B/g, '').slice(0, range.startOffset).trim();
49
50
  for (var i = 0; i < olListStartRegex.length; i++) {
50
- if (olListStartRegex[i].test(range.startContainer.textContent.replace(/\u200B/g, '').slice(0, range.startOffset).trim())) {
51
+ if (olListStartRegex[i].test(currentContent) && currentContent.length === 2) {
51
52
  return true;
52
53
  }
53
54
  }
@@ -46,7 +46,7 @@ var MsWordPaste = /** @class */ (function () {
46
46
  this.parent.observer.on(EVENTS.MS_WORD_CLEANUP_PLUGIN, this.wordCleanup, this);
47
47
  };
48
48
  MsWordPaste.prototype.wordCleanup = function (e) {
49
- var wordPasteStyleConfig = e.allowedStylePropertiesArray;
49
+ var wordPasteStyleConfig = !isNOU(e.allowedStylePropertiesArray) ? e.allowedStylePropertiesArray : [];
50
50
  var listNodes = [];
51
51
  var tempHTMLContent = e.args.clipboardData.getData('text/HTML');
52
52
  var rtfData = e.args.clipboardData.getData('text/rtf');
@@ -188,6 +188,9 @@ var SelectionCommands = /** @class */ (function () {
188
188
  };
189
189
  SelectionCommands.removeFormat = function (nodes, index, formatNode, isCursor, isFormat, isFontStyle, range, nodeCutter, format, value, domSelection, endNode, domNode) {
190
190
  var splitNode = null;
191
+ var startText = range.startContainer.nodeName === '#text' ?
192
+ range.startContainer.textContent.substring(range.startOffset, range.startContainer.textContent.length) :
193
+ range.startContainer.textContent;
191
194
  if (!(range.startContainer === range.endContainer && range.startOffset === 0
192
195
  && range.endOffset === range.startContainer.length)) {
193
196
  var nodeIndex = [];
@@ -287,11 +290,13 @@ var SelectionCommands = /** @class */ (function () {
287
290
  for (var num = 0; num < child.length; num++) {
288
291
  if (child[num].nodeType !== 3 || (child[num].textContent && child[num].textContent.trim().length > 0)) {
289
292
  child[num] = InsertMethods.Wrap(child[num], this.GetFormatNode(format, value, formatNodeTagName, formatNodeStyles));
290
- if (num === 0) {
291
- range.setStartBefore(child[num]);
292
- }
293
- else if (num === child.length - 1) {
294
- range.setEndAfter(child[num]);
293
+ if (child[num].textContent === startText) {
294
+ if (num === 0) {
295
+ range.setStartBefore(child[num]);
296
+ }
297
+ else if (num === child.length - 1) {
298
+ range.setEndAfter(child[num]);
299
+ }
295
300
  }
296
301
  }
297
302
  }
@@ -1,4 +1,4 @@
1
- import { debounce, isNullOrUndefined } from '@syncfusion/ej2-base';
1
+ import { debounce, isNullOrUndefined, detach } from '@syncfusion/ej2-base';
2
2
  import { NodeSelection } from './../../selection/selection';
3
3
  import * as EVENTS from './../../common/constant';
4
4
  import { isIDevice, setEditFrameFocus } from '../../common/util';
@@ -96,6 +96,15 @@ 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;
100
+ for (var i = currentContainer.childNodes.length - 1; i >= 0; i--) {
101
+ if (!isNullOrUndefined(currentContainer.childNodes[i]) && currentContainer.childNodes[i].nodeName === '#text' &&
102
+ currentContainer.childNodes[i].textContent.length === 0 && currentContainer.childNodes[i].nodeName !== 'IMG' &&
103
+ currentContainer.childNodes[i].nodeName !== 'BR' && currentContainer.childNodes[i].nodeName && 'HR') {
104
+ detach(currentContainer.childNodes[i]);
105
+ }
106
+ }
107
+ range = new NodeSelection().getRange(this.parent.currentDocument);
99
108
  var save = new NodeSelection().save(range, this.parent.currentDocument);
100
109
  var htmlText = this.parent.editableElement.innerHTML;
101
110
  var changEle = { text: htmlText, range: save };
@@ -5,6 +5,7 @@ import { RendererFactory } from '../services/renderer-factory';
5
5
  * `Color Picker` module is used to handle ColorPicker actions.
6
6
  */
7
7
  export declare class ColorPickerInput {
8
+ private defaultColorPicker;
8
9
  private fontColorPicker;
9
10
  private backgroundColorPicker;
10
11
  private fontColorDropDown;
@@ -77,7 +77,7 @@ var ColorPickerInput = /** @class */ (function () {
77
77
  target: (targetID)
78
78
  };
79
79
  _this.backgroundColorPicker = _this.toolbarRenderer.renderColorPicker(options, 'backgroundcolor');
80
- _this.backgroundColorDropDown = _this.toolbarRenderer.renderColorPickerDropDown(options, 'backgroundcolor', _this.backgroundColorPicker);
80
+ _this.backgroundColorDropDown = _this.toolbarRenderer.renderColorPickerDropDown(options, 'backgroundcolor', _this.backgroundColorPicker, _this.defaultColorPicker);
81
81
  break;
82
82
  }
83
83
  }
@@ -112,6 +112,7 @@ var ColorPickerInput = /** @class */ (function () {
112
112
  if (this.backgroundColorDropDown && !this.backgroundColorDropDown.isDestroyed) {
113
113
  var innerEle = this.backgroundColorDropDown.element.querySelector('.e-rte-color-content');
114
114
  if (innerEle) {
115
+ this.defaultColorPicker = innerEle.children[0].style.borderBottomColor;
115
116
  detach(innerEle);
116
117
  }
117
118
  this.backgroundColorDropDown.destroy();
@@ -206,11 +206,6 @@ var DropDownButtons = /** @class */ (function () {
206
206
  var prop = _a[_i];
207
207
  switch (prop) {
208
208
  case 'fontFamily':
209
- if (this.parent.inlineMode.enable) {
210
- if (!isNullOrUndefined(this.parent.fontFamily.default)) {
211
- this.getEditNode().style.fontFamily = this.parent.fontFamily.default;
212
- }
213
- }
214
209
  if (this.fontNameDropDown) {
215
210
  for (var _b = 0, _c = Object.keys(newProp.fontFamily); _b < _c.length; _b++) {
216
211
  var fontFamily = _c[_b];
@@ -242,11 +237,6 @@ var DropDownButtons = /** @class */ (function () {
242
237
  }
243
238
  break;
244
239
  case 'fontSize':
245
- if (this.parent.inlineMode) {
246
- if (!isNullOrUndefined(this.parent.fontSize.default)) {
247
- this.getEditNode().style.fontSize = this.parent.fontSize.default;
248
- }
249
- }
250
240
  if (this.fontSizeDropDown) {
251
241
  for (var _d = 0, _e = Object.keys(newProp.fontSize); _d < _e.length; _d++) {
252
242
  var fontSize = _e[_d];
@@ -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
  }
@@ -29,9 +29,20 @@ var EnterKeyAction = /** @class */ (function () {
29
29
  EnterKeyAction.prototype.enterHandler = function (e) {
30
30
  var _this = this;
31
31
  this.getRangeNode();
32
+ var isTableEnter = true;
33
+ if (!isNOU(this.startNode.closest('TABLE')) && !isNOU(this.endNode.closest('TABLE'))) {
34
+ isTableEnter = false;
35
+ var curElement = this.startNode;
36
+ var blockElement = curElement;
37
+ while (!this.parent.formatter.editorManager.domNode.isBlockNode(curElement)) {
38
+ blockElement = curElement;
39
+ curElement = curElement.parentElement;
40
+ }
41
+ isTableEnter = blockElement.tagName === 'TD' ? false : true;
42
+ }
32
43
  if (e.args.which === 13 && e.args.code === 'Enter') {
33
- if (isNOU(this.startNode.closest('LI')) && isNOU(this.endNode.closest('LI')) && isNOU(this.startNode.closest('TABLE')) &&
34
- isNOU(this.endNode.closest('TABLE')) && isNOU(this.startNode.closest('PRE')) && isNOU(this.endNode.closest('PRE'))) {
44
+ if (isNOU(this.startNode.closest('LI')) && isNOU(this.endNode.closest('LI')) && isTableEnter &&
45
+ isNOU(this.startNode.closest('PRE')) && isNOU(this.endNode.closest('PRE'))) {
35
46
  var shiftKey_1 = e.args.shiftKey;
36
47
  var actionBeginArgs = {
37
48
  cancel: false,
@@ -89,12 +100,32 @@ var EnterKeyAction = /** @class */ (function () {
89
100
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.range.startContainer.childNodes[_this.range.startOffset], 0);
90
101
  _this.getRangeNode();
91
102
  }
92
- if (_this.parent.enterKey === 'P' || _this.parent.enterKey === 'DIV' ||
103
+ if ((_this.parent.enterKey === 'P' && !shiftKey_1) || (_this.parent.enterKey === 'DIV' && !shiftKey_1) ||
93
104
  (_this.parent.shiftEnterKey === 'P' && shiftKey_1) ||
94
105
  (_this.parent.shiftEnterKey === 'DIV' && shiftKey_1)) {
95
- var nearBlockNode = _this.parent.formatter.editorManager.domNode.blockParentNode(_this.startNode);
106
+ var nearBlockNode = void 0;
107
+ if (isTableEnter && _this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode)) {
108
+ nearBlockNode = _this.startNode;
109
+ }
110
+ else {
111
+ nearBlockNode = _this.parent.formatter.editorManager.domNode.blockParentNode(_this.startNode);
112
+ }
96
113
  var isImageNode = false;
97
- if (_this.range.startOffset === 0 && _this.range.endOffset === 0 && !(!isNOU(_this.range.startContainer.previousSibling) && _this.range.startContainer.previousSibling.nodeName === 'IMG')) {
114
+ var isFocusedFirst = false;
115
+ if (_this.range.startOffset != 0 && _this.range.endOffset != 0 && _this.range.startContainer === _this.range.endContainer &&
116
+ !(!isNOU(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG')) {
117
+ var startNodeText = _this.range.startContainer.textContent;
118
+ var splitFirstText = startNodeText.substring(0, _this.range.startOffset);
119
+ if (splitFirstText.charCodeAt(_this.range.startOffset - 1) != 160 && splitFirstText.trim().length === 0) {
120
+ isFocusedFirst = true;
121
+ }
122
+ }
123
+ else if (_this.range.startOffset === 0 && _this.range.endOffset === 0) {
124
+ isFocusedFirst = true;
125
+ }
126
+ if (((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
127
+ !(!isNOU(_this.range.startContainer.previousSibling) &&
128
+ (_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
98
129
  var isNearBlockLengthZero = void 0;
99
130
  var newElem = void 0;
100
131
  if (_this.range.startContainer.nodeName === 'IMG') {
@@ -103,7 +134,7 @@ var EnterKeyAction = /** @class */ (function () {
103
134
  isNearBlockLengthZero = false;
104
135
  }
105
136
  else {
106
- if (nearBlockNode.textContent.length !== 0) {
137
+ if (nearBlockNode.textContent.trim().length !== 0) {
107
138
  newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, false).cloneNode(true);
108
139
  isNearBlockLengthZero = false;
109
140
  }
@@ -152,7 +183,18 @@ var EnterKeyAction = /** @class */ (function () {
152
183
  }
153
184
  if (newElem.textContent.trim().length === 0) {
154
185
  var brElm = _this.parent.createElement('br');
155
- _this.startNode.appendChild(brElm);
186
+ if (_this.startNode.nodeName === 'A') {
187
+ var startParentElem = _this.startNode.parentElement;
188
+ _this.startNode.parentElement.insertBefore(brElm, _this.startNode);
189
+ detach(_this.startNode);
190
+ _this.startNode = startParentElem;
191
+ }
192
+ else {
193
+ _this.startNode.appendChild(brElm);
194
+ }
195
+ if (newElem.childNodes[0].textContent === '\n') {
196
+ detach(newElem.childNodes[0]);
197
+ }
156
198
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.startNode, 0);
157
199
  }
158
200
  if (((_this.parent.enterKey === 'P' || _this.parent.enterKey === 'DIV') && !shiftKey_1) || ((_this.parent.shiftEnterKey === 'DIV' ||
@@ -163,12 +205,13 @@ var EnterKeyAction = /** @class */ (function () {
163
205
  }
164
206
  _this.parent.formatter.editorManager.domNode.insertAfter(insertElm, newElem);
165
207
  detach(newElem);
166
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode) ? insertElm : _this.startNode, 0);
208
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), _this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode) ?
209
+ insertElm : _this.startNode, 0);
167
210
  }
168
211
  }
169
212
  e.args.preventDefault();
170
213
  }
171
- if (_this.parent.enterKey === 'BR' && !shiftKey_1) {
214
+ if ((_this.parent.enterKey === 'BR' && !shiftKey_1) || (_this.parent.shiftEnterKey === 'BR' && shiftKey_1)) {
172
215
  var currentParent = void 0;
173
216
  if (!_this.parent.formatter.editorManager.domNode.isBlockNode(_this.startNode)) {
174
217
  var currentNode = _this.startNode;
@@ -184,10 +227,16 @@ var EnterKeyAction = /** @class */ (function () {
184
227
  currentParent = _this.startNode;
185
228
  }
186
229
  var isEmptyBrInserted = false;
230
+ var currentParentLastChild = currentParent.lastChild;
231
+ while (!isNOU(currentParentLastChild) && !(currentParentLastChild.nodeName === '#text')) {
232
+ currentParentLastChild = currentParentLastChild.lastChild;
233
+ }
234
+ var isLastNodeLength = _this.range.startContainer === currentParentLastChild ?
235
+ _this.range.startContainer.textContent.length : currentParent.textContent.length;
187
236
  if (currentParent !== _this.parent.inputElement &&
188
237
  _this.parent.formatter.editorManager.domNode.isBlockNode(currentParent) &&
189
238
  _this.range.startOffset === _this.range.endOffset &&
190
- _this.range.startOffset === currentParent.textContent.length) {
239
+ _this.range.startOffset === isLastNodeLength) {
191
240
  var outerBRElem = _this.parent.createElement('br');
192
241
  _this.parent.formatter.editorManager.domNode.insertAfter(outerBRElem, currentParent);
193
242
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), outerBRElem, 0);
@@ -217,34 +266,12 @@ var EnterKeyAction = /** @class */ (function () {
217
266
  isEmptyBrInserted = true;
218
267
  }
219
268
  else {
220
- newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, currentParent, true);
221
- newElem.parentElement.insertBefore(outerBRElem, newElem);
222
- _this.insertFocusContent();
269
+ _this.insertBRElement();
223
270
  }
224
271
  }
225
272
  }
226
273
  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
- }
274
+ _this.insertBRElement();
248
275
  }
249
276
  e.args.preventDefault();
250
277
  }
@@ -254,6 +281,30 @@ var EnterKeyAction = /** @class */ (function () {
254
281
  }
255
282
  }
256
283
  };
284
+ EnterKeyAction.prototype.insertBRElement = function () {
285
+ var isEmptyBrInserted = false;
286
+ var brElm = this.parent.createElement('br');
287
+ if (this.startNode.nodeName === 'BR' && this.endNode.nodeName === 'BR' && this.range.startOffset === 0 && this.range.startOffset === this.range.endOffset) {
288
+ this.parent.formatter.editorManager.domNode.insertAfter(brElm, this.startNode);
289
+ isEmptyBrInserted = true;
290
+ }
291
+ else {
292
+ if (this.startNode === this.parent.inputElement && !isNOU(this.range.startContainer.previousSibling) &&
293
+ this.range.startContainer.previousSibling.nodeName === 'BR' && this.range.startContainer.textContent.length === 0) {
294
+ isEmptyBrInserted = true;
295
+ }
296
+ this.range.insertNode(brElm);
297
+ }
298
+ if (isEmptyBrInserted || (!isNOU(brElm.nextElementSibling) && brElm.nextElementSibling.tagName === 'BR') || (!isNOU(brElm.nextSibling) && brElm.nextSibling.textContent.length > 0)) {
299
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), !isNOU(brElm.nextSibling) ? brElm.nextSibling : brElm, 0);
300
+ isEmptyBrInserted = false;
301
+ }
302
+ else {
303
+ var brElm2 = this.parent.createElement('br');
304
+ this.range.insertNode(brElm2);
305
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), brElm, 0);
306
+ }
307
+ };
257
308
  EnterKeyAction.prototype.insertFocusContent = function () {
258
309
  if (this.range.startContainer.textContent.length === 0) {
259
310
  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' && !this.parent.readonly) {
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', '&amp;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(' ');
@@ -38,6 +38,7 @@ export declare class QuickToolbar {
38
38
  createQTBar(popupType: string, mode: string, items: (string | IToolbarItems)[], type: RenderType): BaseQuickToolbar;
39
39
  private initializeQuickToolbars;
40
40
  private onMouseDown;
41
+ private keyUpQT;
41
42
  private renderQuickToolbars;
42
43
  private renderInlineQuickToolbar;
43
44
  /**
@@ -80,6 +80,11 @@ var QuickToolbar = /** @class */ (function () {
80
80
  this.parent.isBlur = false;
81
81
  this.parent.isRTE = true;
82
82
  };
83
+ QuickToolbar.prototype.keyUpQT = function (e) {
84
+ if (e.which == 27) {
85
+ this.hideQuickToolbars();
86
+ }
87
+ };
83
88
  QuickToolbar.prototype.renderQuickToolbars = function () {
84
89
  if (this.linkQTBar || this.imageQTBar || this.textQTBar || this.tableQTBar) {
85
90
  return;
@@ -94,15 +99,19 @@ var QuickToolbar = /** @class */ (function () {
94
99
  this.renderFactory.addRenderer(RenderType.TableToolbar, this.tableQTBar);
95
100
  if (this.linkQTBar) {
96
101
  EventHandler.add(this.linkQTBar.element, 'mousedown', this.onMouseDown, this);
102
+ EventHandler.add(this.linkQTBar.element, 'keyup', this.keyUpQT, this);
97
103
  }
98
104
  if (this.imageQTBar) {
99
105
  EventHandler.add(this.imageQTBar.element, 'mousedown', this.onMouseDown, this);
106
+ EventHandler.add(this.imageQTBar.element, 'keyup', this.keyUpQT, this);
100
107
  }
101
108
  if (this.textQTBar) {
102
109
  EventHandler.add(this.textQTBar.element, 'mousedown', this.onMouseDown, this);
110
+ EventHandler.add(this.textQTBar.element, 'keyup', this.keyUpQT, this);
103
111
  }
104
112
  if (this.tableQTBar) {
105
113
  EventHandler.add(this.tableQTBar.element, 'mousedown', this.onMouseDown, this);
114
+ EventHandler.add(this.tableQTBar.element, 'keyup', this.keyUpQT, this);
106
115
  }
107
116
  };
108
117
  QuickToolbar.prototype.renderInlineQuickToolbar = function () {
@@ -111,6 +120,7 @@ var QuickToolbar = /** @class */ (function () {
111
120
  this.inlineQTBar = this.createQTBar('Inline', 'MultiRow', this.parent.toolbarSettings.items, RenderType.InlineToolbar);
112
121
  this.renderFactory.addRenderer(RenderType.InlineToolbar, this.inlineQTBar);
113
122
  EventHandler.add(this.inlineQTBar.element, 'mousedown', this.onMouseDown, this);
123
+ EventHandler.add(this.inlineQTBar.element, 'keyup', this.keyUpQT, this);
114
124
  }
115
125
  };
116
126
  /**
@@ -124,7 +134,7 @@ var QuickToolbar = /** @class */ (function () {
124
134
 
125
135
  */
126
136
  QuickToolbar.prototype.showInlineQTBar = function (x, y, target) {
127
- if (this.parent.readonly) {
137
+ if (this.parent.readonly || target.tagName.toLowerCase() === "img") {
128
138
  return;
129
139
  }
130
140
  this.inlineQTBar.showPopup(x, y, target);
@@ -265,22 +275,27 @@ var QuickToolbar = /** @class */ (function () {
265
275
  QuickToolbar.prototype.destroy = function () {
266
276
  if (this.linkQTBar) {
267
277
  EventHandler.remove(this.linkQTBar.element, 'mousedown', this.onMouseDown);
278
+ EventHandler.remove(this.linkQTBar.element, 'keyup', this.keyUpQT);
268
279
  this.linkQTBar.destroy();
269
280
  }
270
281
  if (this.textQTBar) {
271
282
  EventHandler.remove(this.textQTBar.element, 'mousedown', this.onMouseDown);
283
+ EventHandler.remove(this.textQTBar.element, 'keyup', this.keyUpQT);
272
284
  this.textQTBar.destroy();
273
285
  }
274
286
  if (this.imageQTBar) {
275
287
  EventHandler.remove(this.imageQTBar.element, 'mousedown', this.onMouseDown);
288
+ EventHandler.remove(this.imageQTBar.element, 'keyup', this.keyUpQT);
276
289
  this.imageQTBar.destroy();
277
290
  }
278
291
  if (this.tableQTBar) {
279
292
  EventHandler.remove(this.tableQTBar.element, 'mousedown', this.onMouseDown);
293
+ EventHandler.remove(this.tableQTBar.element, 'keyup', this.keyUpQT);
280
294
  this.tableQTBar.destroy();
281
295
  }
282
296
  if (this.inlineQTBar) {
283
297
  EventHandler.remove(this.inlineQTBar.element, 'mousedown', this.onMouseDown);
298
+ EventHandler.remove(this.inlineQTBar.element, 'keyup', this.keyUpQT);
284
299
  if (isIDevice()) {
285
300
  EventHandler.remove(document, 'selectionchange', this.selectionChangeHandler);
286
301
  }
@@ -29,7 +29,7 @@ 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' ?
32
+ this.currentElement.innerHTML = this.selfEncloseValidation(this.currentElement.innerHTML, this.currentElement.innerText === "\n" ?
33
33
  this.currentElement.innerText.length : this.currentElement.innerText.trim().length);
34
34
  this.parent.setProperties({ value: this.currentElement.innerHTML }, true);
35
35
  }
@@ -169,7 +169,7 @@ export interface IRenderer {
169
169
  renderPopup?(args: BaseQuickToolbar): void;
170
170
  renderDropDownButton?(args: DropDownItemModel): DropDownButton;
171
171
  renderColorPicker?(args: IColorPickerModel, item?: string): ColorPicker;
172
- renderColorPickerDropDown?(args?: IColorPickerModel, item?: string, colorPicker?: ColorPicker): DropDownButton;
172
+ renderColorPickerDropDown?(args?: IColorPickerModel, item?: string, colorPicker?: ColorPicker, defaultColor?: string): DropDownButton;
173
173
  renderListDropDown?(args: IDropDownModel): DropDownButton;
174
174
  }
175
175
  /**
@@ -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
  *
@@ -1431,7 +1431,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1431
1431
  this.setProperties({ value: this.valueTemplate });
1432
1432
  }
1433
1433
  else {
1434
- var compiledTemplate = compile(this.valueTemplate)('', this, 'valueTemplate');
1434
+ var compiledTemplate = compile(this.valueTemplate)("", this, 'valueTemplate');
1435
1435
  for (var i = 0; i < compiledTemplate.length; i++) {
1436
1436
  var item = compiledTemplate[i];
1437
1437
  append([item], this.element);
@@ -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
  });