@syncfusion/ej2-richtexteditor 20.2.39 → 20.2.44

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 (44) hide show
  1. package/CHANGELOG.md +33 -1
  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 +145 -16
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +145 -16
  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/editor-manager/plugin/lists.d.ts +3 -0
  13. package/src/editor-manager/plugin/lists.js +29 -0
  14. package/src/editor-manager/plugin/toolbar-status.js +1 -1
  15. package/src/rich-text-editor/actions/base-toolbar.d.ts +6 -1
  16. package/src/rich-text-editor/actions/dropdown-buttons.d.ts +6 -1
  17. package/src/rich-text-editor/actions/enter-key.d.ts +1 -0
  18. package/src/rich-text-editor/actions/enter-key.js +7 -1
  19. package/src/rich-text-editor/actions/full-screen.d.ts +1 -0
  20. package/src/rich-text-editor/actions/full-screen.js +5 -0
  21. package/src/rich-text-editor/actions/markdown-editor.d.ts +1 -0
  22. package/src/rich-text-editor/actions/markdown-editor.js +6 -0
  23. package/src/rich-text-editor/actions/quick-toolbar.d.ts +1 -0
  24. package/src/rich-text-editor/actions/quick-toolbar.js +5 -0
  25. package/src/rich-text-editor/actions/toolbar-action.d.ts +6 -1
  26. package/src/rich-text-editor/actions/toolbar.d.ts +1 -0
  27. package/src/rich-text-editor/actions/toolbar.js +8 -0
  28. package/src/rich-text-editor/base/constant.d.ts +5 -0
  29. package/src/rich-text-editor/base/constant.js +5 -0
  30. package/src/rich-text-editor/base/rich-text-editor.js +16 -5
  31. package/src/rich-text-editor/renderer/dialog-renderer.d.ts +3 -0
  32. package/src/rich-text-editor/renderer/dialog-renderer.js +18 -0
  33. package/src/rich-text-editor/renderer/image-module.d.ts +2 -1
  34. package/src/rich-text-editor/renderer/image-module.js +18 -6
  35. package/src/rich-text-editor/renderer/link-module.d.ts +1 -0
  36. package/src/rich-text-editor/renderer/link-module.js +5 -0
  37. package/src/rich-text-editor/renderer/render.d.ts +1 -0
  38. package/src/rich-text-editor/renderer/render.js +5 -0
  39. package/src/rich-text-editor/renderer/table-module.d.ts +1 -0
  40. package/src/rich-text-editor/renderer/table-module.js +9 -2
  41. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +6 -1
  42. package/src/rich-text-editor/renderer/toolbar-renderer.js +2 -1
  43. package/src/rich-text-editor/renderer/view-source.d.ts +1 -0
  44. package/src/rich-text-editor/renderer/view-source.js +5 -0
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 20.2.39
3
+ * version : 20.2.44
4
4
  * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
5
5
  * Use of this code is subject to the terms of our license.
6
6
  * A copy of the current license can be obtained at any time by e-mailing
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "_from": "@syncfusion/ej2-richtexteditor@*",
3
- "_id": "@syncfusion/ej2-richtexteditor@20.2.38",
3
+ "_id": "@syncfusion/ej2-richtexteditor@20.2.43",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-R8AtoHAIPqpoh/7JpkRUms9eRZPs7tWWTid2D9gZXd/JieNhPPEcoRKYjavpVRx/Cj4O7umyzzXHIekW+8h3Xw==",
5
+ "_integrity": "sha512-dkfDGY2MKf2ILpa7X4k3mNk6efDSuHc+C2jA9kus1T+csXHRz3mfd5zkOnx0GLeKdQ9tkuBlNj0QasFVRk5Ivg==",
6
6
  "_location": "/@syncfusion/ej2-richtexteditor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -26,8 +26,8 @@
26
26
  "/@syncfusion/ej2-react-richtexteditor",
27
27
  "/@syncfusion/ej2-vue-richtexteditor"
28
28
  ],
29
- "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-20.2.38.tgz",
30
- "_shasum": "332d081f0e815d62053ba5a2d14d14f9a0813411",
29
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-20.2.43.tgz",
30
+ "_shasum": "f4e01afae92f4fa91d69acc288b19b5970f99483",
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": "~20.2.38",
42
- "@syncfusion/ej2-buttons": "~20.2.38",
43
- "@syncfusion/ej2-filemanager": "~20.2.39",
44
- "@syncfusion/ej2-inputs": "~20.2.38",
45
- "@syncfusion/ej2-navigations": "~20.2.39",
46
- "@syncfusion/ej2-popups": "~20.2.39",
47
- "@syncfusion/ej2-splitbuttons": "~20.2.38"
41
+ "@syncfusion/ej2-base": "~20.2.43",
42
+ "@syncfusion/ej2-buttons": "~20.2.43",
43
+ "@syncfusion/ej2-filemanager": "~20.2.44",
44
+ "@syncfusion/ej2-inputs": "~20.2.44",
45
+ "@syncfusion/ej2-navigations": "~20.2.44",
46
+ "@syncfusion/ej2-popups": "~20.2.43",
47
+ "@syncfusion/ej2-splitbuttons": "~20.2.43"
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": "20.2.39",
73
+ "version": "20.2.44",
74
74
  "sideEffects": false
75
75
  }
@@ -12,6 +12,7 @@ export declare class Lists {
12
12
  private saveSelection;
13
13
  private domNode;
14
14
  private currentAction;
15
+ private commonLIParent;
15
16
  /**
16
17
  * Constructor for creating the Lists plugin
17
18
  *
@@ -27,6 +28,8 @@ export declare class Lists {
27
28
  private enterList;
28
29
  private backspaceList;
29
30
  private removeList;
31
+ private onKeyUp;
32
+ private firstListBackSpace;
30
33
  private keyDownHandler;
31
34
  private spaceKeyAction;
32
35
  private getAction;
@@ -27,6 +27,7 @@ var Lists = /** @class */ (function () {
27
27
  Lists.prototype.addEventListener = function () {
28
28
  this.parent.observer.on(EVENTS.LIST_TYPE, this.applyListsHandler, this);
29
29
  this.parent.observer.on(EVENTS.KEY_DOWN_HANDLER, this.keyDownHandler, this);
30
+ this.parent.observer.on(EVENTS.KEY_UP_HANDLER, this.onKeyUp, this);
30
31
  this.parent.observer.on(EVENTS.SPACE_ACTION, this.spaceKeyAction, this);
31
32
  };
32
33
  Lists.prototype.testList = function (elem) {
@@ -179,6 +180,7 @@ var Lists = /** @class */ (function () {
179
180
  }
180
181
  }
181
182
  this.removeList(range, e);
183
+ this.firstListBackSpace(range, e);
182
184
  };
183
185
  Lists.prototype.removeList = function (range, e) {
184
186
  var startNode = this.parent.domNode.getSelectedNode(range.startContainer, range.startOffset);
@@ -204,6 +206,33 @@ var Lists = /** @class */ (function () {
204
206
  e.event.preventDefault();
205
207
  }
206
208
  };
209
+ Lists.prototype.onKeyUp = function () {
210
+ if (!isNOU(this.commonLIParent) && !isNOU(this.commonLIParent.querySelector('.removeList'))) {
211
+ var currentLIElem = this.commonLIParent.querySelector('.removeList');
212
+ while (!isNOU(currentLIElem.firstChild)) {
213
+ this.parent.domNode.insertAfter(currentLIElem.firstChild, currentLIElem);
214
+ }
215
+ detach(currentLIElem);
216
+ }
217
+ };
218
+ Lists.prototype.firstListBackSpace = function (range, e) {
219
+ var startNode = this.parent.domNode.getSelectedNode(range.startContainer, range.startOffset);
220
+ if (!isNOU(startNode.closest('OL'))) {
221
+ this.commonLIParent = startNode.closest('OL');
222
+ }
223
+ else if (!isNOU(startNode.closest('UL'))) {
224
+ this.commonLIParent = startNode.closest('UL');
225
+ }
226
+ if (startNode.nodeName === 'LI' && range.startOffset === 0 && range.endOffset === 0 &&
227
+ isNOU(startNode.previousSibling) && !isNOU(this.commonLIParent) && isNOU(this.commonLIParent.previousSibling) &&
228
+ (isNOU(this.commonLIParent.parentElement.closest('OL')) && isNOU(this.commonLIParent.parentElement.closest('UL')) &&
229
+ isNOU(this.commonLIParent.parentElement.closest('LI')))) {
230
+ var currentElem = createElement('P');
231
+ currentElem.innerHTML = '​';
232
+ startNode.classList.add('removeList');
233
+ this.commonLIParent.parentElement.insertBefore(currentElem, this.commonLIParent);
234
+ }
235
+ };
207
236
  Lists.prototype.keyDownHandler = function (e) {
208
237
  if (e.event.which === 13) {
209
238
  this.enterList(e);
@@ -233,7 +233,7 @@ var ToolbarStatus = /** @class */ (function () {
233
233
  if ((name !== null && name !== '' && name !== undefined)
234
234
  && (fontName === null || fontName === undefined || (fontName.filter(function (value, pos) {
235
235
  var pattern = new RegExp(name, 'i');
236
- if ((value.replace(/"/g, '').replace(/ /g, '') === name.replace(/"/g, '').replace(/ /g, '')) ||
236
+ if ((value.replace(/"/g, '').replace(/ /g, '').toLowerCase() === name.replace(/"/g, '').replace(/ /g, '').toLowerCase()) ||
237
237
  (value.search(pattern) > -1)) {
238
238
  index = pos;
239
239
  }
@@ -8,7 +8,12 @@ import { RendererFactory } from '../services/renderer-factory';
8
8
  */
9
9
  export declare class BaseToolbar {
10
10
  toolbarObj: tool;
11
- protected parent: IRichTextEditor;
11
+ /**
12
+ *
13
+ * @hidden
14
+ * @private
15
+ */
16
+ parent: IRichTextEditor;
12
17
  protected locator: ServiceLocator;
13
18
  protected toolbarRenderer: IRenderer;
14
19
  protected renderFactory: RendererFactory;
@@ -17,7 +17,12 @@ export declare class DropDownButtons {
17
17
  tableRowsDropDown: DropDownButton;
18
18
  tableColumnsDropDown: DropDownButton;
19
19
  tableCellVerticalAlignDropDown: DropDownButton;
20
- protected parent: IRichTextEditor;
20
+ /**
21
+ *
22
+ * @hidden
23
+ * @private
24
+ */
25
+ parent: IRichTextEditor;
21
26
  protected locator: ServiceLocator;
22
27
  protected toolbarRenderer: IRenderer;
23
28
  protected renderFactory: RendererFactory;
@@ -10,6 +10,7 @@ export declare class EnterKeyAction {
10
10
  constructor(parent?: IRichTextEditor);
11
11
  protected addEventListener(): void;
12
12
  private destroy;
13
+ private moduleDestroy;
13
14
  private removeEventListener;
14
15
  private getRangeNode;
15
16
  private enterHandler;
@@ -11,13 +11,18 @@ var EnterKeyAction = /** @class */ (function () {
11
11
  EnterKeyAction.prototype.addEventListener = function () {
12
12
  this.parent.on(events.enterHandler, this.enterHandler, this);
13
13
  this.parent.on(events.destroy, this.destroy, this);
14
+ this.parent.on(events.moduleDestroy, this.moduleDestroy, this);
14
15
  };
15
16
  EnterKeyAction.prototype.destroy = function () {
16
17
  this.removeEventListener();
17
18
  };
19
+ EnterKeyAction.prototype.moduleDestroy = function () {
20
+ this.parent = null;
21
+ };
18
22
  EnterKeyAction.prototype.removeEventListener = function () {
19
23
  this.parent.off(events.enterHandler, this.enterHandler);
20
24
  this.parent.off(events.destroy, this.destroy);
25
+ this.parent.off(events.moduleDestroy, this.moduleDestroy);
21
26
  };
22
27
  EnterKeyAction.prototype.getRangeNode = function () {
23
28
  this.range = this.parent.getRange();
@@ -135,7 +140,8 @@ var EnterKeyAction = /** @class */ (function () {
135
140
  isNearBlockLengthZero = false;
136
141
  }
137
142
  else {
138
- if (nearBlockNode.textContent.trim().length !== 0) {
143
+ if (nearBlockNode.textContent.trim().length !== 0 ||
144
+ nearBlockNode.childNodes[0].nodeName === 'IMG') {
139
145
  newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, false).cloneNode(true);
140
146
  isNearBlockLengthZero = false;
141
147
  }
@@ -37,4 +37,5 @@ export declare class FullScreen {
37
37
 
38
38
  */
39
39
  destroy(): void;
40
+ private moduleDestroy;
40
41
  }
@@ -142,10 +142,12 @@ var FullScreen = /** @class */ (function () {
142
142
  FullScreen.prototype.addEventListener = function () {
143
143
  this.parent.on(events.keyDown, this.onKeyDown, this);
144
144
  this.parent.on(events.destroy, this.destroy, this);
145
+ this.parent.on(events.moduleDestroy, this.moduleDestroy, this);
145
146
  };
146
147
  FullScreen.prototype.removeEventListener = function () {
147
148
  this.parent.off(events.keyDown, this.onKeyDown);
148
149
  this.parent.off(events.destroy, this.destroy);
150
+ this.parent.off(events.moduleDestroy, this.moduleDestroy);
149
151
  };
150
152
  /**
151
153
  * destroy method
@@ -164,6 +166,9 @@ var FullScreen = /** @class */ (function () {
164
166
  }
165
167
  this.removeEventListener();
166
168
  };
169
+ FullScreen.prototype.moduleDestroy = function () {
170
+ this.parent = null;
171
+ };
167
172
  return FullScreen;
168
173
  }());
169
174
  export { FullScreen };
@@ -22,6 +22,7 @@ export declare class MarkdownEditor {
22
22
 
23
23
  */
24
24
  destroy(): void;
25
+ private moduleDestroy;
25
26
  private addEventListener;
26
27
  private updateReadOnly;
27
28
  private onSelectionSave;
@@ -27,6 +27,10 @@ var MarkdownEditor = /** @class */ (function () {
27
27
  MarkdownEditor.prototype.destroy = function () {
28
28
  this.removeEventListener();
29
29
  };
30
+ MarkdownEditor.prototype.moduleDestroy = function () {
31
+ this.parent = null;
32
+ this.toolbarUpdate.parent = null;
33
+ };
30
34
  MarkdownEditor.prototype.addEventListener = function () {
31
35
  if (this.parent.isDestroyed) {
32
36
  return;
@@ -42,6 +46,7 @@ var MarkdownEditor = /** @class */ (function () {
42
46
  this.parent.on(events.selectionSave, this.onSelectionSave, this);
43
47
  this.parent.on(events.selectionRestore, this.onSelectionRestore, this);
44
48
  this.parent.on(events.readOnlyMode, this.updateReadOnly, this);
49
+ this.parent.on(events.moduleDestroy, this.moduleDestroy, this);
45
50
  };
46
51
  MarkdownEditor.prototype.updateReadOnly = function () {
47
52
  if (this.parent.readonly) {
@@ -113,6 +118,7 @@ var MarkdownEditor = /** @class */ (function () {
113
118
  this.parent.off(events.selectionSave, this.onSelectionSave);
114
119
  this.parent.off(events.selectionRestore, this.onSelectionRestore);
115
120
  this.parent.off(events.readOnlyMode, this.updateReadOnly);
121
+ this.parent.off(events.moduleDestroy, this.moduleDestroy);
116
122
  };
117
123
  MarkdownEditor.prototype.render = function () {
118
124
  this.contentRenderer = this.renderFactory.getRenderer(RenderType.Content);
@@ -92,6 +92,7 @@ export declare class QuickToolbar {
92
92
 
93
93
  */
94
94
  destroy(): void;
95
+ private moduleDestroy;
95
96
  private wireInlineQTBarEvents;
96
97
  private unWireInlineQTBarEvents;
97
98
  private toolbarUpdated;
@@ -304,6 +304,9 @@ var QuickToolbar = /** @class */ (function () {
304
304
  }
305
305
  this.removeEventListener();
306
306
  };
307
+ QuickToolbar.prototype.moduleDestroy = function () {
308
+ this.parent = null;
309
+ };
307
310
  QuickToolbar.prototype.wireInlineQTBarEvents = function () {
308
311
  this.parent.on(events.mouseUp, this.mouseUpHandler, this);
309
312
  this.parent.on(events.mouseDown, this.inlineQTBarMouseDownHandler, this);
@@ -359,6 +362,7 @@ var QuickToolbar = /** @class */ (function () {
359
362
  this.parent.on(events.keyDown, this.onKeyDown, this);
360
363
  this.parent.on(events.rtlMode, this.setRtl, this);
361
364
  this.parent.on(events.bindCssClass, this.setCssClass, this);
365
+ this.parent.on(events.moduleDestroy, this.moduleDestroy, this);
362
366
  };
363
367
  QuickToolbar.prototype.onKeyDown = function (e) {
364
368
  var args = e.args;
@@ -428,6 +432,7 @@ var QuickToolbar = /** @class */ (function () {
428
432
  this.parent.off(events.keyDown, this.onKeyDown);
429
433
  this.parent.off(events.rtlMode, this.setRtl);
430
434
  this.parent.off(events.bindCssClass, this.setCssClass);
435
+ this.parent.off(events.moduleDestroy, this.moduleDestroy);
431
436
  };
432
437
  /**
433
438
  * Called internally if any of the property value changed.
@@ -3,7 +3,12 @@ import { IRichTextEditor } from '../base/interface';
3
3
  * `ToolbarAction` module is used to toolbar click action
4
4
  */
5
5
  export declare class ToolbarAction {
6
- protected parent: IRichTextEditor;
6
+ /**
7
+ *
8
+ * @hidden
9
+ * @private
10
+ */
11
+ parent: IRichTextEditor;
7
12
  private serviceLocator;
8
13
  constructor(parent?: IRichTextEditor);
9
14
  private addEventListener;
@@ -149,6 +149,7 @@ export declare class Toolbar {
149
149
 
150
150
  */
151
151
  destroy(): void;
152
+ private moduleDestroy;
152
153
  private scrollHandler;
153
154
  private getDOMVisibility;
154
155
  private mouseDownHandler;
@@ -495,6 +495,12 @@ var Toolbar = /** @class */ (function () {
495
495
  }
496
496
  }
497
497
  };
498
+ Toolbar.prototype.moduleDestroy = function () {
499
+ this.parent = null;
500
+ this.baseToolbar.parent = null;
501
+ this.toolbarActionModule.parent = null;
502
+ this.dropDownModule.parent = null;
503
+ };
498
504
  Toolbar.prototype.scrollHandler = function (e) {
499
505
  if (!this.parent.inlineMode.enable) {
500
506
  if (this.parent.toolbarSettings.enableFloating && this.getDOMVisibility(this.tbElement)) {
@@ -596,6 +602,7 @@ var Toolbar = /** @class */ (function () {
596
602
  this.parent.on(events.mouseDown, this.mouseDownHandler, this);
597
603
  this.parent.on(events.sourceCodeMouseDown, this.mouseDownHandler, this);
598
604
  this.parent.on(events.bindCssClass, this.setCssClass, this);
605
+ this.parent.on(events.moduleDestroy, this.moduleDestroy, this);
599
606
  if (!this.parent.inlineMode.enable && !isIDevice()) {
600
607
  this.parent.on(events.toolbarClick, this.toolbarClickHandler, this);
601
608
  }
@@ -620,6 +627,7 @@ var Toolbar = /** @class */ (function () {
620
627
  this.parent.off(events.mouseDown, this.mouseDownHandler);
621
628
  this.parent.off(events.sourceCodeMouseDown, this.mouseDownHandler);
622
629
  this.parent.off(events.bindCssClass, this.setCssClass);
630
+ this.parent.off(events.moduleDestroy, this.moduleDestroy);
623
631
  if (!this.parent.inlineMode.enable && !isIDevice()) {
624
632
  this.parent.off(events.toolbarClick, this.toolbarClickHandler);
625
633
  }
@@ -439,6 +439,11 @@ export declare const readOnlyMode: string;
439
439
  /**
440
440
  * @hidden
441
441
 
442
+ */
443
+ export declare const moduleDestroy: string;
444
+ /**
445
+ * @hidden
446
+
442
447
  */
443
448
  export declare const pasteClean: string;
444
449
  /**
@@ -439,6 +439,11 @@ export var readOnlyMode = 'readOnlyMode';
439
439
  /**
440
440
  * @hidden
441
441
 
442
+ */
443
+ export var moduleDestroy = 'moduleDestroy';
444
+ /**
445
+ * @hidden
446
+
442
447
  */
443
448
  export var pasteClean = 'pasteClean';
444
449
  /**
@@ -496,7 +496,7 @@ var RichTextEditor = /** @class */ (function (_super) {
496
496
  var currentEndContainer = range.endContainer;
497
497
  var currentStartOffset = range.startOffset;
498
498
  var isSameContainer = currentStartContainer === currentEndContainer ? true : false;
499
- var currentEndOffset;
499
+ var currentEndOffset = currentEndContainer.textContent.length;
500
500
  var endNode = range.endContainer.nodeName === '#text' ? range.endContainer.parentElement :
501
501
  range.endContainer;
502
502
  var closestLI = closest(endNode, 'LI');
@@ -512,7 +512,7 @@ var RichTextEditor = /** @class */ (function (_super) {
512
512
  while (currentLastElem.lastChild !== null && currentLastElem.nodeName !== '#text') {
513
513
  currentLastElem = currentLastElem.lastChild;
514
514
  }
515
- this.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), isSameContainer ? (currentLastElem.nodeName === 'BR' && !isNOU(currentLastElem.previousSibling) ? currentLastElem.previousSibling : currentLastElem) : currentStartContainer, currentLastElem, currentStartOffset, (currentLastElem.nodeName === 'BR' ? 0 : currentLastElem.textContent.length));
515
+ this.formatter.editorManager.nodeSelection.setSelectionText(this.contentModule.getDocument(), isSameContainer ? currentStartContainer : (currentLastElem.nodeName === 'BR' && !isNOU(currentLastElem.previousSibling) ? currentLastElem.previousSibling : currentStartContainer), currentEndContainer, currentStartOffset, (currentLastElem.nodeName === 'BR' ? 0 : currentEndOffset));
516
516
  }
517
517
  };
518
518
  /**
@@ -851,8 +851,11 @@ var RichTextEditor = /** @class */ (function (_super) {
851
851
  if (this.isDestroyed || !this.isRendered) {
852
852
  return;
853
853
  }
854
- if (this.element.offsetParent === null && !isNOU(this.toolbarModule)) {
855
- this.toolbarModule.destroy();
854
+ if (this.element.offsetParent === null) {
855
+ if (!isNOU(this.toolbarModule)) {
856
+ this.toolbarModule.destroy();
857
+ }
858
+ this.notify(events.moduleDestroy, {});
856
859
  return;
857
860
  }
858
861
  this.notify(events.destroy, {});
@@ -2091,7 +2094,10 @@ var RichTextEditor = /** @class */ (function (_super) {
2091
2094
  RichTextEditor.prototype.restrict = function (e) {
2092
2095
  if (this.maxLength >= 0) {
2093
2096
  var element = this.editorMode === 'Markdown' ? this.contentModule.getText() :
2094
- e.currentTarget.textContent;
2097
+ (e && e.currentTarget.textContent);
2098
+ if (!element) {
2099
+ return;
2100
+ }
2095
2101
  var array = [8, 16, 17, 37, 38, 39, 40, 46, 65];
2096
2102
  var arrayKey = void 0;
2097
2103
  for (var i = 0; i <= array.length - 1; i++) {
@@ -2146,6 +2152,11 @@ var RichTextEditor = /** @class */ (function (_super) {
2146
2152
  case 'cut':
2147
2153
  this.onCut();
2148
2154
  break;
2155
+ case 'tab':
2156
+ if (this.iframeSettings.enable) {
2157
+ this.isBlur = true;
2158
+ }
2159
+ break;
2149
2160
  }
2150
2161
  if (e.callBack && (e.event.action === 'copy' || e.event.action === 'cut' || e.event.action === 'delete')) {
2151
2162
  e.callBack({
@@ -7,6 +7,8 @@ export declare class DialogRenderer {
7
7
  dialogObj: Dialog;
8
8
  private parent;
9
9
  constructor(parent?: IRichTextEditor);
10
+ protected addEventListener(): void;
11
+ protected removeEventListener(): void;
10
12
  /**
11
13
  * dialog render method
12
14
  *
@@ -29,4 +31,5 @@ export declare class DialogRenderer {
29
31
 
30
32
  */
31
33
  close(args: Object): void;
34
+ private moduleDestroy;
32
35
  }
@@ -7,7 +7,22 @@ import * as events from '../base/constant';
7
7
  var DialogRenderer = /** @class */ (function () {
8
8
  function DialogRenderer(parent) {
9
9
  this.parent = parent;
10
+ this.addEventListener();
10
11
  }
12
+ DialogRenderer.prototype.addEventListener = function () {
13
+ if (this.parent.isDestroyed) {
14
+ return;
15
+ }
16
+ this.parent.on(events.moduleDestroy, this.moduleDestroy, this);
17
+ this.parent.on(events.destroy, this.removeEventListener, this);
18
+ };
19
+ DialogRenderer.prototype.removeEventListener = function () {
20
+ if (this.parent.isDestroyed) {
21
+ return;
22
+ }
23
+ this.parent.off(events.destroy, this.removeEventListener);
24
+ this.parent.off(events.moduleDestroy, this.moduleDestroy);
25
+ };
11
26
  /**
12
27
  * dialog render method
13
28
  *
@@ -60,6 +75,9 @@ var DialogRenderer = /** @class */ (function () {
60
75
  DialogRenderer.prototype.close = function (args) {
61
76
  this.parent.trigger(events.dialogClose, args);
62
77
  };
78
+ DialogRenderer.prototype.moduleDestroy = function () {
79
+ this.parent = null;
80
+ };
63
81
  return DialogRenderer;
64
82
  }());
65
83
  export { DialogRenderer };
@@ -30,7 +30,7 @@ export declare class Image {
30
30
  private isAllowedTypes;
31
31
  private pageX;
32
32
  private pageY;
33
- private mousex;
33
+ private mouseX;
34
34
  private dialogRenderObj;
35
35
  private deletedImg;
36
36
  private changedWidthValue;
@@ -165,6 +165,7 @@ export declare class Image {
165
165
 
166
166
  */
167
167
  destroy(): void;
168
+ private moduleDestroy;
168
169
  /**
169
170
  * For internal use only - Get the module name.
170
171
  *
@@ -17,7 +17,7 @@ var Image = /** @class */ (function () {
17
17
  this.isAllowedTypes = true;
18
18
  this.pageX = null;
19
19
  this.pageY = null;
20
- this.mousex = null;
20
+ this.mouseX = null;
21
21
  this.deletedImg = [];
22
22
  this.parent = parent;
23
23
  this.rteID = parent.element.id;
@@ -52,6 +52,7 @@ var Image = /** @class */ (function () {
52
52
  this.parent.on(events.paste, this.imagePaste, this);
53
53
  this.parent.on(events.bindCssClass, this.setCssClass, this);
54
54
  this.parent.on(events.destroy, this.removeEventListener, this);
55
+ this.parent.on(events.moduleDestroy, this.moduleDestroy, this);
55
56
  };
56
57
  Image.prototype.removeEventListener = function () {
57
58
  if (this.parent.isDestroyed) {
@@ -79,6 +80,7 @@ var Image = /** @class */ (function () {
79
80
  this.parent.off(events.paste, this.imagePaste);
80
81
  this.parent.off(events.bindCssClass, this.setCssClass);
81
82
  this.parent.off(events.destroy, this.removeEventListener);
83
+ this.parent.off(events.moduleDestroy, this.moduleDestroy);
82
84
  var dropElement = this.parent.iframeSettings.enable ? this.parent.inputElement.ownerDocument
83
85
  : this.parent.inputElement;
84
86
  dropElement.removeEventListener('drop', this.dragDrop.bind(this), true);
@@ -354,7 +356,7 @@ var Image = /** @class */ (function () {
354
356
  img.style.minWidth = this.parent.insertImageSettings.minWidth === 0 ? '20px' : formatUnit(this.parent.insertImageSettings.minWidth);
355
357
  if (this.parent.insertImageSettings.resizeByPercent) {
356
358
  if (parseInt('' + img.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
357
- var original = img.offsetWidth + this.mousex;
359
+ var original = img.offsetWidth + this.mouseX;
358
360
  var finalWidthByPerc = (original / img.offsetWidth) * (parseFloat(img.style.width).toString() == 'NaN' ? (img.offsetWidth / (parseFloat(getComputedStyle(this.parent.element).width)) * 100) : parseFloat(img.style.width));
359
361
  img.style.width = ((finalWidthByPerc > 3) ? finalWidthByPerc : 3) + '%';
360
362
  }
@@ -380,17 +382,17 @@ var Image = /** @class */ (function () {
380
382
  }
381
383
  else {
382
384
  if (this.parent.iframeSettings.enable) {
383
- img.setAttribute('width', (img.width + this.mousex).toString());
385
+ img.setAttribute('width', (img.width + this.mouseX).toString());
384
386
  }
385
387
  else {
386
- img.setAttribute('width', (img.offsetWidth + this.mousex).toString());
388
+ img.setAttribute('width', (img.offsetWidth + this.mouseX).toString());
387
389
  }
388
390
  }
389
391
  }
390
392
  else if (height > width) {
391
393
  if (this.parent.insertImageSettings.resizeByPercent) {
392
394
  if (parseInt('' + img.getBoundingClientRect().width + '', 10) !== 0 && parseInt('' + width + '', 10) !== 0) {
393
- var original = img.offsetWidth + this.mousex;
395
+ var original = img.offsetWidth + this.mouseX;
394
396
  var finalWidthByPerc = (original / img.offsetWidth) * (parseFloat(img.style.width).toString() == 'NaN' ? (img.offsetWidth / (parseFloat(getComputedStyle(this.parent.element).width)) * 100) : parseFloat(img.style.width));
395
397
  img.style.width = ((finalWidthByPerc > 3) ? finalWidthByPerc : 3) + '%';
396
398
  }
@@ -453,13 +455,17 @@ var Image = /** @class */ (function () {
453
455
  if (this.imgEle.offsetWidth >= this.parent.getInsertImgMaxWidth()) {
454
456
  this.imgEle.style.maxHeight = this.imgEle.offsetHeight + 'px';
455
457
  }
458
+ else if (isNOU(this.parent.insertImageSettings.maxHeight)) {
459
+ this.imgEle.style.maxHeight = '';
460
+ }
461
+ this.imgEle.style.maxWidth = this.parent.getInsertImgMaxWidth() + 'px';
456
462
  var pageX = this.getPointX(e);
457
463
  var pageY = this.getPointY(e);
458
464
  var mouseX = (this.resizeBtnStat.botLeft || this.resizeBtnStat.topLeft) ? -(pageX - this.pageX) : (pageX - this.pageX);
459
465
  var mouseY = (this.resizeBtnStat.topLeft || this.resizeBtnStat.topRight) ? -(pageY - this.pageY) : (pageY - this.pageY);
460
466
  var width = parseInt(this.imgDupPos.width, 10) + mouseX;
461
467
  var height = parseInt(this.imgDupPos.height, 10) + mouseY;
462
- this.mousex = mouseX;
468
+ this.mouseX = mouseX;
463
469
  this.pageX = pageX;
464
470
  this.pageY = pageY;
465
471
  if (this.resizeBtnStat.botRight) {
@@ -1407,6 +1413,9 @@ var Image = /** @class */ (function () {
1407
1413
  if (target.nodeName === 'IMG') {
1408
1414
  this.imgEle = target;
1409
1415
  }
1416
+ if (!this.parent) {
1417
+ return;
1418
+ }
1410
1419
  if (target.nodeName !== '#document') {
1411
1420
  this.parent.currentTarget = e.target;
1412
1421
  }
@@ -2295,6 +2304,9 @@ var Image = /** @class */ (function () {
2295
2304
  this.prevSelectedImgEle = undefined;
2296
2305
  this.removeEventListener();
2297
2306
  };
2307
+ Image.prototype.moduleDestroy = function () {
2308
+ this.parent = null;
2309
+ };
2298
2310
  /**
2299
2311
  * For internal use only - Get the module name.
2300
2312
  *
@@ -48,6 +48,7 @@ export declare class Link {
48
48
 
49
49
  */
50
50
  destroy(): void;
51
+ private moduleDestroy;
51
52
  /**
52
53
  * For internal use only - Get the module name.
53
54
  *
@@ -37,6 +37,7 @@ var Link = /** @class */ (function () {
37
37
  this.parent.on(events.editAreaClick, this.editAreaClickHandler, this);
38
38
  this.parent.on(events.bindCssClass, this.setCssClass, this);
39
39
  this.parent.on(events.destroy, this.destroy, this);
40
+ this.parent.on(events.moduleDestroy, this.moduleDestroy, this);
40
41
  };
41
42
  Link.prototype.onToolbarAction = function (args) {
42
43
  var item = args.args.item;
@@ -70,6 +71,7 @@ var Link = /** @class */ (function () {
70
71
  this.parent.off(events.editAreaClick, this.editAreaClickHandler);
71
72
  this.parent.off(events.bindCssClass, this.setCssClass);
72
73
  this.parent.off(events.destroy, this.destroy);
74
+ this.parent.off(events.moduleDestroy, this.moduleDestroy);
73
75
  };
74
76
  Link.prototype.onIframeMouseDown = function () {
75
77
  if (this.dialogObj) {
@@ -520,6 +522,9 @@ var Link = /** @class */ (function () {
520
522
  Link.prototype.destroy = function () {
521
523
  this.removeEventListener();
522
524
  };
525
+ Link.prototype.moduleDestroy = function () {
526
+ this.parent = null;
527
+ };
523
528
  /**
524
529
  * For internal use only - Get the module name.
525
530
  *
@@ -40,6 +40,7 @@ export declare class Render {
40
40
  * @returns {void}
41
41
  */
42
42
  destroy(): void;
43
+ private moduleDestroy;
43
44
  private addEventListener;
44
45
  private removeEventListener;
45
46
  private keyUp;