@syncfusion/ej2-richtexteditor 20.2.43 → 20.2.46

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 (42) hide show
  1. package/CHANGELOG.md +22 -0
  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 +121 -37
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +121 -37
  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/rich-text-editor/actions/base-toolbar.d.ts +6 -1
  15. package/src/rich-text-editor/actions/dropdown-buttons.d.ts +6 -1
  16. package/src/rich-text-editor/actions/enter-key.d.ts +1 -0
  17. package/src/rich-text-editor/actions/enter-key.js +12 -3
  18. package/src/rich-text-editor/actions/full-screen.d.ts +1 -0
  19. package/src/rich-text-editor/actions/full-screen.js +6 -0
  20. package/src/rich-text-editor/actions/markdown-editor.d.ts +1 -0
  21. package/src/rich-text-editor/actions/markdown-editor.js +6 -0
  22. package/src/rich-text-editor/actions/quick-toolbar.d.ts +1 -0
  23. package/src/rich-text-editor/actions/quick-toolbar.js +5 -0
  24. package/src/rich-text-editor/actions/toolbar-action.d.ts +6 -1
  25. package/src/rich-text-editor/actions/toolbar.d.ts +1 -0
  26. package/src/rich-text-editor/actions/toolbar.js +8 -0
  27. package/src/rich-text-editor/base/constant.d.ts +5 -0
  28. package/src/rich-text-editor/base/constant.js +5 -0
  29. package/src/rich-text-editor/base/rich-text-editor.js +8 -13
  30. package/src/rich-text-editor/renderer/dialog-renderer.d.ts +3 -0
  31. package/src/rich-text-editor/renderer/dialog-renderer.js +18 -0
  32. package/src/rich-text-editor/renderer/image-module.d.ts +1 -8
  33. package/src/rich-text-editor/renderer/image-module.js +9 -9
  34. package/src/rich-text-editor/renderer/link-module.d.ts +1 -8
  35. package/src/rich-text-editor/renderer/link-module.js +2 -7
  36. package/src/rich-text-editor/renderer/render.d.ts +1 -6
  37. package/src/rich-text-editor/renderer/render.js +2 -5
  38. package/src/rich-text-editor/renderer/table-module.d.ts +1 -0
  39. package/src/rich-text-editor/renderer/table-module.js +5 -0
  40. package/src/rich-text-editor/renderer/toolbar-renderer.d.ts +6 -1
  41. package/src/rich-text-editor/renderer/view-source.d.ts +1 -0
  42. 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.43
3
+ * version : 20.2.46
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.40",
3
+ "_id": "@syncfusion/ej2-richtexteditor@20.2.45",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-UujypHiBETmZH0BRvYEQ3Ymz7fo37930L/lnqY5z4JGCRf1pcPGRfbNAVcY40vXJOkxbEnmH5nzge0JyMK3SfA==",
5
+ "_integrity": "sha512-ej4cOLeY7dXoZNyj8rsNeaT5yHrFYM+Mi2QBJcYPvuRSK91wnoNGME4CptbxZoKegPVj2ahTr8fHvSBpTfMM3A==",
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.40.tgz",
30
- "_shasum": "d1096ffac3f968b575499b3d57ac92d8d2f85558",
29
+ "_resolved": "http://nexus.syncfusion.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-20.2.45.tgz",
30
+ "_shasum": "a037c49ba04ac66b8143621556c31764671d0931",
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.43",
42
- "@syncfusion/ej2-buttons": "~20.2.43",
43
- "@syncfusion/ej2-filemanager": "~20.2.43",
44
- "@syncfusion/ej2-inputs": "~20.2.43",
45
- "@syncfusion/ej2-navigations": "~20.2.43",
46
- "@syncfusion/ej2-popups": "~20.2.43",
47
- "@syncfusion/ej2-splitbuttons": "~20.2.43"
41
+ "@syncfusion/ej2-base": "~20.2.46",
42
+ "@syncfusion/ej2-buttons": "~20.2.46",
43
+ "@syncfusion/ej2-filemanager": "~20.2.45",
44
+ "@syncfusion/ej2-inputs": "~20.2.45",
45
+ "@syncfusion/ej2-navigations": "~20.2.46",
46
+ "@syncfusion/ej2-popups": "~20.2.45",
47
+ "@syncfusion/ej2-splitbuttons": "~20.2.45"
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.43",
73
+ "version": "20.2.46",
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);
@@ -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();
@@ -38,7 +43,7 @@ var EnterKeyAction = /** @class */ (function () {
38
43
  blockElement = curElement;
39
44
  curElement = curElement.parentElement;
40
45
  }
41
- isTableEnter = blockElement.tagName === 'TD' ? false : true;
46
+ isTableEnter = blockElement.tagName === 'TD' || blockElement.tagName === 'TBODY' ? false : true;
42
47
  }
43
48
  if (e.args.which === 13 && e.args.code === 'Enter') {
44
49
  if (isNOU(this.startNode.closest('LI')) && isNOU(this.endNode.closest('LI')) && isTableEnter &&
@@ -124,7 +129,10 @@ var EnterKeyAction = /** @class */ (function () {
124
129
  isFocusedFirst = true;
125
130
  }
126
131
  _this.removeBRElement(nearBlockNode);
127
- if (((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
132
+ var fireFoxEnterAtMiddle = Browser.userAgent.indexOf('Firefox') != -1 && _this.range.startOffset === 0 && _this.range.startContainer === _this.range.endContainer &&
133
+ _this.range.startContainer.nodeName === '#text' && !_this.parent.formatter.editorManager.domNode.isBlockNode(_this.range.startContainer.previousSibling) &&
134
+ _this.range.startContainer.parentElement === _this.range.startContainer.previousSibling.parentElement;
135
+ if (!fireFoxEnterAtMiddle && ((_this.range.startOffset === 0 && _this.range.endOffset === 0) || isFocusedFirst) &&
128
136
  !(!isNOU(_this.range.startContainer.previousSibling) &&
129
137
  (_this.range.startContainer.previousSibling.nodeName === 'IMG' || _this.range.startContainer.previousSibling.nodeName === 'BR'))) {
130
138
  var isNearBlockLengthZero = void 0;
@@ -135,7 +143,8 @@ var EnterKeyAction = /** @class */ (function () {
135
143
  isNearBlockLengthZero = false;
136
144
  }
137
145
  else {
138
- if (nearBlockNode.textContent.trim().length !== 0) {
146
+ if (nearBlockNode.textContent.trim().length !== 0 ||
147
+ nearBlockNode.childNodes[0].nodeName === 'IMG') {
139
148
  newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, nearBlockNode, false).cloneNode(true);
140
149
  isNearBlockLengthZero = false;
141
150
  }
@@ -37,4 +37,5 @@ export declare class FullScreen {
37
37
 
38
38
  */
39
39
  destroy(): void;
40
+ private moduleDestroy;
40
41
  }
@@ -57,6 +57,7 @@ var FullScreen = /** @class */ (function () {
57
57
  baseToolbar: _this.parent.getBaseToolbarObject()
58
58
  });
59
59
  }
60
+ _this.parent.refreshUI();
60
61
  _this.parent.trigger(events.actionComplete, { requestType: 'Maximize', targetItem: 'Maximize', args: event });
61
62
  }
62
63
  });
@@ -142,10 +143,12 @@ var FullScreen = /** @class */ (function () {
142
143
  FullScreen.prototype.addEventListener = function () {
143
144
  this.parent.on(events.keyDown, this.onKeyDown, this);
144
145
  this.parent.on(events.destroy, this.destroy, this);
146
+ this.parent.on(events.moduleDestroy, this.moduleDestroy, this);
145
147
  };
146
148
  FullScreen.prototype.removeEventListener = function () {
147
149
  this.parent.off(events.keyDown, this.onKeyDown);
148
150
  this.parent.off(events.destroy, this.destroy);
151
+ this.parent.off(events.moduleDestroy, this.moduleDestroy);
149
152
  };
150
153
  /**
151
154
  * destroy method
@@ -164,6 +167,9 @@ var FullScreen = /** @class */ (function () {
164
167
  }
165
168
  this.removeEventListener();
166
169
  };
170
+ FullScreen.prototype.moduleDestroy = function () {
171
+ this.parent = null;
172
+ };
167
173
  return FullScreen;
168
174
  }());
169
175
  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
  /**
@@ -855,15 +855,7 @@ var RichTextEditor = /** @class */ (function (_super) {
855
855
  if (!isNOU(this.toolbarModule)) {
856
856
  this.toolbarModule.destroy();
857
857
  }
858
- if (!isNOU(this.imageModule)) {
859
- this.imageModule.moduleDestroy();
860
- }
861
- if (!isNOU(this.linkModule)) {
862
- this.linkModule.moduleDestroy();
863
- }
864
- if (!isNOU(this.renderModule)) {
865
- this.renderModule.moduleDestroy();
866
- }
858
+ this.notify(events.moduleDestroy, {});
867
859
  return;
868
860
  }
869
861
  this.notify(events.destroy, {});
@@ -1207,7 +1199,7 @@ var RichTextEditor = /** @class */ (function (_super) {
1207
1199
  if (this.valueContainer) {
1208
1200
  this.valueContainer.value = (this.enableHtmlEncode) ? this.value : value;
1209
1201
  }
1210
- if (this.editorMode === 'HTML' && this.inputElement && this.inputElement.innerHTML.trim() !== value.trim()) {
1202
+ if (this.editorMode === 'HTML' && this.inputElement && this.inputElement.innerHTML.replace('&', '&').trim() !== value.trim()) {
1211
1203
  this.inputElement.innerHTML = value;
1212
1204
  }
1213
1205
  else if (this.editorMode === 'Markdown' && this.inputElement
@@ -2102,7 +2094,10 @@ var RichTextEditor = /** @class */ (function (_super) {
2102
2094
  RichTextEditor.prototype.restrict = function (e) {
2103
2095
  if (this.maxLength >= 0) {
2104
2096
  var element = this.editorMode === 'Markdown' ? this.contentModule.getText() :
2105
- e.currentTarget.textContent;
2097
+ (e && e.currentTarget.textContent);
2098
+ if (!element) {
2099
+ return;
2100
+ }
2106
2101
  var array = [8, 16, 17, 37, 38, 39, 40, 46, 65];
2107
2102
  var arrayKey = void 0;
2108
2103
  for (var i = 0; i <= array.length - 1; i++) {
@@ -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 };
@@ -165,14 +165,7 @@ export declare class Image {
165
165
 
166
166
  */
167
167
  destroy(): void;
168
- /**
169
- * Clears the ImageModule.
170
- *
171
- * @returns {void}
172
- * @hidden
173
-
174
- */
175
- moduleDestroy(): void;
168
+ private moduleDestroy;
176
169
  /**
177
170
  * For internal use only - Get the module name.
178
171
  *
@@ -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);
@@ -453,6 +455,10 @@ 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);
@@ -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,15 +2304,6 @@ var Image = /** @class */ (function () {
2295
2304
  this.prevSelectedImgEle = undefined;
2296
2305
  this.removeEventListener();
2297
2306
  };
2298
- /* eslint-disable */
2299
- /**
2300
- * Clears the ImageModule.
2301
- *
2302
- * @returns {void}
2303
- * @hidden
2304
-
2305
- */
2306
- /* eslint-enable */
2307
2307
  Image.prototype.moduleDestroy = function () {
2308
2308
  this.parent = null;
2309
2309
  };
@@ -48,14 +48,7 @@ export declare class Link {
48
48
 
49
49
  */
50
50
  destroy(): void;
51
- /**
52
- * Clears the Link Module.
53
- *
54
- * @returns {void}
55
- * @hidden
56
-
57
- */
58
- moduleDestroy(): void;
51
+ private moduleDestroy;
59
52
  /**
60
53
  * For internal use only - Get the module name.
61
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,13 +522,6 @@ var Link = /** @class */ (function () {
520
522
  Link.prototype.destroy = function () {
521
523
  this.removeEventListener();
522
524
  };
523
- /**
524
- * Clears the Link Module.
525
- *
526
- * @returns {void}
527
- * @hidden
528
-
529
- */
530
525
  Link.prototype.moduleDestroy = function () {
531
526
  this.parent = null;
532
527
  };
@@ -40,12 +40,7 @@ export declare class Render {
40
40
  * @returns {void}
41
41
  */
42
42
  destroy(): void;
43
- /**
44
- * Clears the Render Module.
45
- *
46
- * @returns {void}
47
- */
48
- moduleDestroy(): void;
43
+ private moduleDestroy;
49
44
  private addEventListener;
50
45
  private removeEventListener;
51
46
  private keyUp;