@syncfusion/ej2-richtexteditor 27.1.52 → 27.1.57

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 (43) hide show
  1. package/dist/ej2-richtexteditor.min.js +10 -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 +244 -60
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +245 -59
  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 +13 -13
  12. package/src/common/config.d.ts +7 -0
  13. package/src/common/config.js +12 -0
  14. package/src/editor-manager/base/editor-manager.js +1 -1
  15. package/src/editor-manager/base/interface.d.ts +2 -2
  16. package/src/editor-manager/plugin/clearformat.js +1 -1
  17. package/src/editor-manager/plugin/dom-node.js +1 -1
  18. package/src/editor-manager/plugin/image.js +2 -0
  19. package/src/editor-manager/plugin/inserthtml.d.ts +1 -0
  20. package/src/editor-manager/plugin/inserthtml.js +34 -10
  21. package/src/editor-manager/plugin/link.js +2 -2
  22. package/src/editor-manager/plugin/lists.js +1 -1
  23. package/src/editor-manager/plugin/ms-word-clean-up.d.ts +1 -0
  24. package/src/editor-manager/plugin/ms-word-clean-up.js +16 -0
  25. package/src/editor-manager/plugin/selection-commands.js +2 -2
  26. package/src/editor-manager/plugin/toolbar-status.js +1 -1
  27. package/src/editor-manager/plugin/undo.js +3 -3
  28. package/src/rich-text-editor/actions/enter-key.js +10 -5
  29. package/src/rich-text-editor/actions/html-editor.js +2 -2
  30. package/src/rich-text-editor/actions/import-export.js +1 -1
  31. package/src/rich-text-editor/actions/paste-clean-up.js +1 -1
  32. package/src/rich-text-editor/actions/resize.d.ts +3 -0
  33. package/src/rich-text-editor/actions/resize.js +17 -0
  34. package/src/rich-text-editor/base/interface.d.ts +13 -1
  35. package/src/rich-text-editor/base/rich-text-editor.js +11 -0
  36. package/src/rich-text-editor/renderer/audio-module.js +7 -1
  37. package/src/rich-text-editor/renderer/image-module.js +57 -20
  38. package/src/rich-text-editor/renderer/link-module.js +8 -1
  39. package/src/rich-text-editor/renderer/slash-menu.js +1 -1
  40. package/src/rich-text-editor/renderer/table-module.js +3 -2
  41. package/src/rich-text-editor/renderer/video-module.js +8 -2
  42. package/src/selection/selection.d.ts +5 -0
  43. package/src/selection/selection.js +44 -1
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 27.1.52
3
+ * version : 27.1.57
4
4
  * Copyright Syncfusion Inc. 2001 - 2023. 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@27.1.51",
3
+ "_id": "@syncfusion/ej2-richtexteditor@27.1.55",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-inlHC5480ej5x2prpYyHklgio/xK2ySwJ9fde81c7VZodSANYCWTzGEM4zpNXwqGq883rUcsceZWyx77wbfPJQ==",
5
+ "_integrity": "sha512-FkQvU6rbg+RgDWBi+nu3SpZ2kwoDNif3vbSxDqbVh3crbjTrl8mnEY2l9DPXgzMI8AKbrzkywhmbz+QU7Py+Xg==",
6
6
  "_location": "/@syncfusion/ej2-richtexteditor",
7
7
  "_phantomChildren": {},
8
8
  "_requested": {
@@ -25,8 +25,8 @@
25
25
  "/@syncfusion/ej2-react-richtexteditor",
26
26
  "/@syncfusion/ej2-vue-richtexteditor"
27
27
  ],
28
- "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-27.1.51.tgz",
29
- "_shasum": "485be34e965c6976c8a1d3509ea9c399b6ab3612",
28
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-27.1.55.tgz",
29
+ "_shasum": "a888e8865fd0e8182ac49c4f745d8f6f78b6bf6a",
30
30
  "_spec": "@syncfusion/ej2-richtexteditor@*",
31
31
  "_where": "/jenkins/workspace/elease-automation_release_27.1.1/packages/included",
32
32
  "author": {
@@ -37,14 +37,14 @@
37
37
  },
38
38
  "bundleDependencies": false,
39
39
  "dependencies": {
40
- "@syncfusion/ej2-base": "~27.1.52",
41
- "@syncfusion/ej2-buttons": "~27.1.51",
42
- "@syncfusion/ej2-dropdowns": "~27.1.52",
43
- "@syncfusion/ej2-filemanager": "~27.1.52",
44
- "@syncfusion/ej2-inputs": "~27.1.50",
45
- "@syncfusion/ej2-navigations": "~27.1.52",
46
- "@syncfusion/ej2-popups": "~27.1.50",
47
- "@syncfusion/ej2-splitbuttons": "~27.1.50"
40
+ "@syncfusion/ej2-base": "~27.1.55",
41
+ "@syncfusion/ej2-buttons": "~27.1.53",
42
+ "@syncfusion/ej2-dropdowns": "~27.1.57",
43
+ "@syncfusion/ej2-filemanager": "~27.1.55",
44
+ "@syncfusion/ej2-inputs": "~27.1.55",
45
+ "@syncfusion/ej2-navigations": "~27.1.57",
46
+ "@syncfusion/ej2-popups": "~27.1.57",
47
+ "@syncfusion/ej2-splitbuttons": "~27.1.56"
48
48
  },
49
49
  "deprecated": false,
50
50
  "description": "Essential JS 2 RichTextEditor component",
@@ -80,6 +80,6 @@
80
80
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
81
81
  },
82
82
  "typings": "index.d.ts",
83
- "version": "27.1.52",
83
+ "version": "27.1.57",
84
84
  "sideEffects": false
85
85
  }
@@ -54,6 +54,13 @@ export declare const selfClosingTags: string[];
54
54
  *
55
55
  */
56
56
  export declare const imageResizeFactor: IImageResizeFactor;
57
+ /**
58
+ * Resize factor for image in iframe editor.
59
+ *
60
+ *@hidden
61
+ *
62
+ */
63
+ export declare const iframeResizeFactor: IImageResizeFactor;
57
64
  /**
58
65
  * Mention restrict key configuration.
59
66
  *
@@ -142,6 +142,18 @@ export var imageResizeFactor = {
142
142
  botRight: [1, 1],
143
143
  botLeft: [-1, 1]
144
144
  };
145
+ /**
146
+ * Resize factor for image in iframe editor.
147
+ *
148
+ *@hidden
149
+ *
150
+ */
151
+ export var iframeResizeFactor = {
152
+ topLeft: [-1.2, -1.2],
153
+ topRight: [1.2, -1.2],
154
+ botRight: [1.2, 1.2],
155
+ botLeft: [-1.2, 1.2]
156
+ };
145
157
  /**
146
158
  * Mention restrict key configuration.
147
159
  *
@@ -39,7 +39,7 @@ var EditorManager = /** @class */ (function () {
39
39
  function EditorManager(options) {
40
40
  this.currentDocument = options.document;
41
41
  this.editableElement = options.editableElement;
42
- this.nodeSelection = new NodeSelection();
42
+ this.nodeSelection = new NodeSelection(this.editableElement);
43
43
  this.nodeCutter = new NodeCutter();
44
44
  this.domNode = new DOMNode(this.editableElement, this.currentDocument);
45
45
  this.observer = new Observer(this);
@@ -10,11 +10,11 @@ import { IFormatPainterActionValue, IFormatPainterContext } from './enum';
10
10
  */
11
11
  export interface ICommandModel {
12
12
  /**
13
- * Specifies the current document.
13
+ * Specifies the editor element's current document.
14
14
  */
15
15
  document: HTMLDocument;
16
16
  /**
17
- * Specifies the current window.
17
+ * Specifies the editable element.
18
18
  */
19
19
  editableElement: Element;
20
20
  options?: {
@@ -26,7 +26,7 @@ var ClearFormat = /** @class */ (function () {
26
26
  ClearFormat.clear = function (docElement, endNode, enterAction, selector, command) {
27
27
  this.domNode = new DOMNode(endNode, docElement);
28
28
  this.defaultTag = enterAction === 'P' ? this.defaultTag : 'div';
29
- var nodeSelection = new NodeSelection();
29
+ var nodeSelection = new NodeSelection(endNode);
30
30
  var nodeCutter = new NodeCutter();
31
31
  var range = nodeSelection.getRange(docElement);
32
32
  var nodes = range.collapsed ? nodeSelection.getSelectionNodeCollection(range) :
@@ -25,7 +25,7 @@ var DOMNode = /** @class */ (function () {
25
25
  */
26
26
  function DOMNode(parent, currentDocument) {
27
27
  this.parent = parent;
28
- this.nodeSelection = new NodeSelection();
28
+ this.nodeSelection = new NodeSelection(parent);
29
29
  this.currentDocument = currentDocument;
30
30
  this.tableSelection = new TableSelection(parent, currentDocument);
31
31
  }
@@ -119,6 +119,8 @@ var ImageCommand = /** @class */ (function () {
119
119
  (Browser.isIE ? selectedNode.previousSibling : selectedNode.previousElementSibling);
120
120
  var onImageLoadEvent_1 = function () {
121
121
  if (!isNOU(_this.parent.currentDocument)) {
122
+ imgElm_1.setAttribute('width', imgElm_1.offsetWidth.toString());
123
+ imgElm_1.setAttribute('height', imgElm_1.offsetHeight.toString());
122
124
  e.callBack({
123
125
  requestType: (e.value === 'Replace') ? (e.item.subCommand = 'Replace', 'Replace') : 'Images',
124
126
  editorMode: 'HTML',
@@ -16,6 +16,7 @@ export declare class InsertHtml {
16
16
  static Insert(docElement: Document, insertNode: Node | string, editNode?: Element, isExternal?: boolean, enterAction?: string): void;
17
17
  private static findFirstTextNode;
18
18
  private static pasteInsertHTML;
19
+ private static listCleanUp;
19
20
  private static placeCursorEnd;
20
21
  private static getNodeCollection;
21
22
  private static insertTempNode;
@@ -31,7 +31,7 @@ var InsertHtml = /** @class */ (function () {
31
31
  node = insertNode;
32
32
  }
33
33
  }
34
- var nodeSelection = new NodeSelection();
34
+ var nodeSelection = new NodeSelection(editNode);
35
35
  var nodeCutter = new NodeCutter();
36
36
  var range = nodeSelection.getRange(docElement);
37
37
  if (range.startContainer === editNode && range.startContainer === range.endContainer && range.startOffset === 0 &&
@@ -395,6 +395,26 @@ var InsertHtml = /** @class */ (function () {
395
395
  this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
396
396
  }
397
397
  this.alignCheck(editNode);
398
+ var currentRange = nodeSelection.getRange(docElement);
399
+ this.listCleanUp(currentRange);
400
+ };
401
+ InsertHtml.listCleanUp = function (range) {
402
+ if (range.startContainer.parentElement.closest('ol,ul') !== null && range.endContainer.parentElement.closest('ol,ul') !== null) {
403
+ var liElems = range.startContainer.parentElement.closest('ol,ul').querySelectorAll('li');
404
+ if (liElems.length > 0) {
405
+ liElems.forEach(function (item) {
406
+ if (!isNOU(item.firstChild) && (item.firstChild.nodeName === 'OL' || item.firstChild.nodeName === 'UL')) {
407
+ item.style.listStyleType = 'none';
408
+ }
409
+ var nestedLi = Array.from(item.children).find(function (child) {
410
+ return child.tagName === 'LI' && (child.parentElement && child.parentElement.tagName !== 'OL' && child.parentElement.tagName !== 'UL');
411
+ });
412
+ if (nestedLi) {
413
+ item.parentNode.replaceChild(nestedLi, item);
414
+ }
415
+ });
416
+ }
417
+ }
398
418
  };
399
419
  InsertHtml.placeCursorEnd = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
400
420
  lastSelectionNode = lastSelectionNode.nodeName === 'BR' ? (isNOU(lastSelectionNode.previousSibling) ? lastSelectionNode.parentNode
@@ -459,7 +479,7 @@ var InsertHtml = /** @class */ (function () {
459
479
  blockNode = range.endContainer;
460
480
  range.setEnd(blockNode, range.endContainer.textContent.length);
461
481
  }
462
- if (blockNode && blockNode.nodeName === 'BODY' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
482
+ if (blockNode && blockNode.nodeName === 'BODY' || blockNode.nodeName === 'DIV' && range.startContainer === range.endContainer && range.startContainer.nodeType === 1) {
463
483
  blockNode = range.startContainer;
464
484
  }
465
485
  if (blockNode && blockNode.closest('LI') && editNode.contains(blockNode.closest('LI')) && blockNode.nodeName !== 'TD' && blockNode.nodeName !== 'TH' && blockNode.nodeName !== 'TR' && node && node.firstElementChild &&
@@ -479,12 +499,12 @@ var InsertHtml = /** @class */ (function () {
479
499
  tempSpan.parentNode.replaceChild(node, tempSpan);
480
500
  }
481
501
  else {
482
- var nodeSelection = new NodeSelection();
502
+ var nodeSelection = new NodeSelection(editNode);
483
503
  var currentNode = this.getNodeCollection(range, nodeSelection, node)[this.getNodeCollection(range, nodeSelection, node).length - 1];
484
504
  var splitedElm = void 0;
485
- if ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR' ||
505
+ if (currentNode && ((currentNode.nodeName === 'BR' || currentNode.nodeName === 'HR' ||
486
506
  (currentNode.nodeName === '#text' && !isNOU(currentNode.parentElement) && currentNode.parentElement.nodeName === 'LI')) &&
487
- (!isNOU(currentNode.parentElement) && currentNode.parentElement.textContent.trim().length === 0)) {
507
+ (!isNOU(currentNode.parentElement) && currentNode.parentElement.textContent.trim().length === 0))) {
488
508
  splitedElm = currentNode;
489
509
  if (currentNode.parentElement.nodeName === 'LI' && !isNOU(currentNode.nextSibling) &&
490
510
  currentNode.nextSibling.nodeName === 'BR') {
@@ -497,16 +517,20 @@ var InsertHtml = /** @class */ (function () {
497
517
  return;
498
518
  }
499
519
  }
500
- else if ((currentNode.nodeName === '#text' || currentNode.nodeName === 'BR') && !isNOU(currentNode.parentElement) &&
520
+ else if (currentNode && ((currentNode.nodeName === '#text' || currentNode.nodeName === 'BR') && !isNOU(currentNode.parentElement) &&
501
521
  (currentNode.parentElement.nodeName === 'LI' || currentNode.parentElement.closest('LI') || (blockNode === editNode && currentNode.parentElement === blockNode)) &&
502
- currentNode.parentElement.textContent.trim().length > 0) {
522
+ currentNode.parentElement.textContent.trim().length > 0)) {
503
523
  splitedElm = currentNode;
504
524
  if (currentNode.parentElement.nodeName === 'LI' && !isNOU(currentNode.nextSibling) &&
505
525
  currentNode.nextSibling.nodeName === 'BR') {
506
526
  detach(currentNode.nextSibling);
507
527
  }
508
528
  if (!range.collapsed) {
529
+ var startContainer = range.startContainer;
530
+ var startOffset = range.startOffset;
509
531
  this.removeListfromPaste(range);
532
+ range.setStart(startContainer, startOffset);
533
+ range.setEnd(startContainer, startOffset);
510
534
  }
511
535
  range.insertNode(node);
512
536
  this.contentsDeleted = true;
@@ -546,9 +570,9 @@ var InsertHtml = /** @class */ (function () {
546
570
  };
547
571
  // eslint-disable-next-line
548
572
  InsertHtml.getImmediateBlockNode = function (node, editNode) {
549
- do {
573
+ while (node && CONSTANT.BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0) {
550
574
  node = node.parentNode;
551
- } while (node && CONSTANT.BLOCK_TAGS.indexOf(node.nodeName.toLocaleLowerCase()) < 0);
575
+ }
552
576
  return node;
553
577
  };
554
578
  InsertHtml.removingComments = function (elm) {
@@ -664,7 +688,7 @@ var InsertHtml = /** @class */ (function () {
664
688
  var value = range.startContainer;
665
689
  if (!isNOU(value) && value.nodeName === 'LI' && !isNOU(value.parentElement) && (value.parentElement.nodeName === 'OL' || value.parentElement.nodeName === 'UL') && value.textContent.trim() === '') {
666
690
  value.parentElement.querySelectorAll('li').forEach(function (item) {
667
- if (item.textContent.trim() === '') {
691
+ if (item.textContent.trim() === '' && item !== value) {
668
692
  item.remove();
669
693
  }
670
694
  });
@@ -86,7 +86,7 @@ var LinkCommand = /** @class */ (function () {
86
86
  }
87
87
  }
88
88
  else {
89
- var domSelection = new NodeSelection();
89
+ var domSelection = new NodeSelection(this.parent.editableElement);
90
90
  var range = domSelection.getRange(this.parent.currentDocument);
91
91
  if (range.endContainer.nodeName === '#text' && range.startContainer.textContent.length === (range.endOffset + 1) &&
92
92
  range.endContainer.textContent.charAt(range.endOffset) === ' ' && (!isNOU(range.endContainer.nextSibling) && range.endContainer.nextSibling.nodeName === 'A')) {
@@ -132,7 +132,7 @@ var LinkCommand = /** @class */ (function () {
132
132
  }
133
133
  };
134
134
  LinkCommand.prototype.createLinkNode = function (e) {
135
- var domSelection = new NodeSelection();
135
+ var domSelection = new NodeSelection(this.parent.editableElement);
136
136
  var nodeCutter = new NodeCutter();
137
137
  var range = domSelection.getRange(this.parent.currentDocument);
138
138
  var nodes = this.getSelectionNodes(domSelection.getNodeCollection(range));
@@ -312,7 +312,7 @@ var Lists = /** @class */ (function () {
312
312
  if (e.event.which === 8) {
313
313
  this.backspaceList(e);
314
314
  }
315
- if ((e.event.which === 46 && e.event.action === 'delete') || (e.event.which === 88 && e.event.action === 'cut')) {
315
+ if ((e.event.which === 46 && e.event.action === 'delete')) {
316
316
  var range = this.parent.nodeSelection.getRange(this.parent.currentDocument);
317
317
  var commonAncestor = range.commonAncestorContainer;
318
318
  var startEle = range.startContainer;
@@ -55,5 +55,6 @@ export declare class MsWordPaste {
55
55
  private processMargin;
56
56
  private removeEmptyAnchorTag;
57
57
  private findSource;
58
+ private handleOneNoteContent;
58
59
  destroy(): void;
59
60
  }
@@ -1,6 +1,7 @@
1
1
  import * as EVENTS from '../../common/constant';
2
2
  import { createElement, isNullOrUndefined as isNOU, detach, addClass, Browser } from '@syncfusion/ej2-base';
3
3
  import { PASTE_SOURCE } from '../base/constant';
4
+ import { InsertMethods } from './insert-methods';
4
5
  /**
5
6
  * PasteCleanup for MsWord content
6
7
  *
@@ -99,6 +100,9 @@ var MsWordPaste = /** @class */ (function () {
99
100
  e.callBack(elm.innerHTML, this.cropImageDimensions, source);
100
101
  }
101
102
  else {
103
+ if (source === PASTE_SOURCE[2]) {
104
+ this.handleOneNoteContent(elm);
105
+ }
102
106
  e.callBack(elm.innerHTML, null, source);
103
107
  }
104
108
  };
@@ -1093,6 +1097,18 @@ var MsWordPaste = /** @class */ (function () {
1093
1097
  }
1094
1098
  return 'html';
1095
1099
  };
1100
+ MsWordPaste.prototype.handleOneNoteContent = function (element) {
1101
+ var allListElements = element.querySelectorAll('ul, ol');
1102
+ if (allListElements.length > 0) {
1103
+ for (var i = 0; i < allListElements.length; i++) {
1104
+ // Removing the ul and ol parent node for the p tag
1105
+ var currentList = allListElements[i];
1106
+ if (currentList.querySelectorAll('li').length === 0 && currentList.childNodes.length > 0) {
1107
+ InsertMethods.unwrap(currentList);
1108
+ }
1109
+ }
1110
+ }
1111
+ };
1096
1112
  MsWordPaste.prototype.destroy = function () {
1097
1113
  this.removeEventListener();
1098
1114
  };
@@ -34,7 +34,7 @@ var SelectionCommands = /** @class */ (function () {
34
34
  if (format === 'backgroundcolor' && value === '') {
35
35
  value = 'transparent';
36
36
  }
37
- var domSelection = new NodeSelection();
37
+ var domSelection = new NodeSelection(endNode);
38
38
  var domNode = new DOMNode(endNode, docElement);
39
39
  var nodeCutter = new NodeCutter();
40
40
  var isFormatted = new IsFormatted();
@@ -243,7 +243,7 @@ var SelectionCommands = /** @class */ (function () {
243
243
  if (cursorNodes.length === 1 && range.startOffset === 0 && (cursorNodes[0].nodeName === 'BR' || (isNOU(cursorNodes[0].nextSibling) ? false : cursorNodes[0].nextSibling.nodeName === 'BR'))) {
244
244
  detach(cursorNodes[0].nodeName === '#text' ? cursorNodes[0].nextSibling : cursorNodes[0]);
245
245
  }
246
- if (!isNOU(cursorNodes[0].parentElement) && IsFormatted.inlineTags.
246
+ if (!isNOU(cursorNodes[0] && cursorNodes[0].parentElement) && IsFormatted.inlineTags.
247
247
  indexOf((cursorNodes[0].parentElement).tagName.toLowerCase()) !== -1 && cursorNodes[0].textContent.includes('\u200B')) {
248
248
  var element = this.GetFormatNode(format, value);
249
249
  var tempNode = cursorNodes[0];
@@ -29,7 +29,7 @@ var ToolbarStatus = /** @class */ (function () {
29
29
  ToolbarStatus.get = function (docElement, rootNode, formatNode, fontSize, fontName, documentNode) {
30
30
  var formatCollection = JSON.parse(JSON.stringify(statusCollection));
31
31
  var nodeCollection = JSON.parse(JSON.stringify(statusCollection));
32
- var nodeSelection = new NodeSelection();
32
+ var nodeSelection = new NodeSelection(rootNode);
33
33
  var range = nodeSelection.getRange(docElement);
34
34
  var nodes = documentNode ? [documentNode] : range.collapsed ? nodeSelection.getNodeCollection(range) :
35
35
  nodeSelection.getSelectionNodeCollectionBr(range);
@@ -139,7 +139,7 @@ var UndoRedoManager = /** @class */ (function () {
139
139
  if (!this.parent.currentDocument) {
140
140
  return;
141
141
  }
142
- var range = new NodeSelection().getRange(this.parent.currentDocument);
142
+ var range = new NodeSelection(this.parent.editableElement).getRange(this.parent.currentDocument);
143
143
  var currentContainer = this.parent.editableElement === range.startContainer.parentElement ?
144
144
  range.startContainer.parentElement : range.startContainer;
145
145
  for (var i = currentContainer.childNodes.length - 1; i >= 0; i--) {
@@ -149,8 +149,8 @@ var UndoRedoManager = /** @class */ (function () {
149
149
  detach(currentContainer.childNodes[i]);
150
150
  }
151
151
  }
152
- range = new NodeSelection().getRange(this.parent.currentDocument);
153
- var save = new NodeSelection().save(range, this.parent.currentDocument);
152
+ range = new NodeSelection(this.parent.editableElement).getRange(this.parent.currentDocument);
153
+ var save = new NodeSelection(this.parent.editableElement).save(range, this.parent.currentDocument);
154
154
  var clonedElement = this.parent.editableElement.cloneNode(true);
155
155
  var fragment = document.createDocumentFragment();
156
156
  while (clonedElement.firstChild) {
@@ -427,11 +427,16 @@ var EnterKeyAction = /** @class */ (function () {
427
427
  else if (!isNOU(currentParent) && currentParent !== _this.parent.inputElement && currentParent.nodeName !== 'BR') {
428
428
  if (currentParent.textContent.trim().length === 0 || (currentParent.textContent.trim().length === 1 &&
429
429
  currentParent.textContent.charCodeAt(0) === 8203)) {
430
- var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, currentParent, true).cloneNode(true);
431
- _this.parent.formatter.editorManager.domNode.insertAfter(newElem, currentParent);
432
- var outerBRElem = _this.parent.createElement('br');
433
- newElem.parentElement.insertBefore(outerBRElem, newElem);
434
- _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), newElem, 0);
430
+ if (currentParent.childElementCount > 1 && currentParent.lastElementChild.nodeName === 'IMG') {
431
+ _this.insertBRElement();
432
+ }
433
+ else {
434
+ var newElem = _this.parent.formatter.editorManager.nodeCutter.SplitNode(_this.range, currentParent, true).cloneNode(true);
435
+ _this.parent.formatter.editorManager.domNode.insertAfter(newElem, currentParent);
436
+ var outerBRElem = _this.parent.createElement('br');
437
+ newElem.parentElement.insertBefore(outerBRElem, newElem);
438
+ _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), newElem, 0);
439
+ }
435
440
  }
436
441
  else {
437
442
  var newElem = void 0;
@@ -89,7 +89,7 @@ var HtmlEditor = /** @class */ (function () {
89
89
  if (this.parent.isDestroyed) {
90
90
  return;
91
91
  }
92
- this.nodeSelectionObj = new NodeSelection();
92
+ this.nodeSelectionObj = new NodeSelection(this.parent.inputElement);
93
93
  this.parent.on(events.initialLoad, this.instantiateRenderer, this);
94
94
  this.parent.on(events.htmlToolbarClick, this.onToolbarClick, this);
95
95
  this.parent.on(events.keyDown, this.onKeyDown, this);
@@ -803,7 +803,7 @@ var HtmlEditor = /** @class */ (function () {
803
803
  urlText = urlText.slice(0, urlTextRange);
804
804
  // eslint-disable-next-line
805
805
  var regex = new RegExp(/([^\S]|^)(((https?\:\/\/)|(www\.))(\S+))/gi);
806
- if (selectNodeEle[0].nodeName !== 'A' && urlText.match(regex)) {
806
+ if (selectNodeEle[0] && selectNodeEle[0].nodeName !== 'A' && urlText.match(regex)) {
807
807
  var selection = this.nodeSelectionObj.save(range, this.parent.contentModule.getDocument());
808
808
  var url = urlText.indexOf('http') > -1 ? urlText : 'http://' + urlText;
809
809
  var selectParent = this.parent.formatter.editorManager.nodeSelection.getParentNodeCollection(range);
@@ -21,7 +21,7 @@ var ImportExport = /** @class */ (function () {
21
21
  saveUrl: this.parent.importWord.serviceUrl
22
22
  },
23
23
  success: function (args) {
24
- _this.parent.executeCommand('insertHTML', args.e.currentTarget.response, { undo: true });
24
+ _this.parent.executeCommand('importWord', args.e.currentTarget.response, { undo: true });
25
25
  }
26
26
  });
27
27
  this.parent.setProperties({ enableXhtml: true }, true);
@@ -40,7 +40,7 @@ var PasteCleanup = /** @class */ (function () {
40
40
  this.isDestroyed = false;
41
41
  }
42
42
  PasteCleanup.prototype.addEventListener = function () {
43
- this.nodeSelectionObj = new NodeSelection();
43
+ this.nodeSelectionObj = new NodeSelection(this.parent.inputElement);
44
44
  if (this.parent.isDestroyed) {
45
45
  return;
46
46
  }
@@ -9,6 +9,8 @@ export declare class Resize {
9
9
  protected touchMoveEvent: string;
10
10
  protected touchEndEvent: string;
11
11
  private isDestroyed;
12
+ private isResizing;
13
+ private iframeMouseUpBoundFn;
12
14
  private constructor();
13
15
  private addEventListener;
14
16
  private renderResizable;
@@ -21,6 +23,7 @@ export declare class Resize {
21
23
  private unwireResizeEvents;
22
24
  private destroy;
23
25
  private removeEventListener;
26
+ private iframeMouseUp;
24
27
  /**
25
28
  * For internal use only - Get the module name.
26
29
  *
@@ -9,6 +9,8 @@ var Resize = /** @class */ (function () {
9
9
  this.parent = parent;
10
10
  this.addEventListener();
11
11
  this.isDestroyed = false;
12
+ this.isResizing = false;
13
+ this.iframeMouseUpBoundFn = this.iframeMouseUp.bind(this);
12
14
  }
13
15
  Resize.prototype.addEventListener = function () {
14
16
  if (this.parent.isDestroyed) {
@@ -28,6 +30,7 @@ var Resize = /** @class */ (function () {
28
30
  this.parent.rootContainer.classList.add('e-resize-enabled');
29
31
  if (this.parent.iframeSettings.enable) {
30
32
  this.parent.inputElement.classList.add('e-resize-enabled');
33
+ this.parent.contentModule.getDocument().addEventListener('mouseup', this.iframeMouseUpBoundFn);
31
34
  }
32
35
  this.touchStartEvent = (Browser.info.name === 'msie') ? 'pointerdown' : 'touchstart';
33
36
  EventHandler.add(this.resizer, 'mousedown', this.resizeStart, this);
@@ -35,6 +38,7 @@ var Resize = /** @class */ (function () {
35
38
  };
36
39
  Resize.prototype.resizeStart = function (e) {
37
40
  var _this = this;
41
+ this.isResizing = false;
38
42
  if (e.cancelable) {
39
43
  e.preventDefault();
40
44
  }
@@ -49,6 +53,7 @@ var Resize = /** @class */ (function () {
49
53
  };
50
54
  Resize.prototype.performResize = function (e) {
51
55
  var _this = this;
56
+ this.isResizing = true;
52
57
  var args = { event: e, requestType: 'editor' };
53
58
  this.parent.trigger(events.onResize, args, function (resizingArgs) {
54
59
  if (resizingArgs.cancel) {
@@ -75,9 +80,14 @@ var Resize = /** @class */ (function () {
75
80
  this.parent.element.style.height = eventType.clientY - boundRect.top + 'px';
76
81
  this.parent.element.style.width = (!this.parent.enableRtl) ? eventType.clientX - boundRect.left + 'px' : boundRect.right - eventType.clientX + 'px';
77
82
  }
83
+ var rteContent = this.parent.element.querySelector('#' + this.parent.getID() + '_source-view');
84
+ if (!isNullOrUndefined(rteContent)) {
85
+ rteContent.style.height = this.parent.element.style.height;
86
+ }
78
87
  this.parent.refreshUI();
79
88
  };
80
89
  Resize.prototype.stopResize = function (e) {
90
+ this.isResizing = false;
81
91
  this.parent.refreshUI();
82
92
  this.unwireResizeEvents();
83
93
  var args = { event: e, requestType: 'editor' };
@@ -127,6 +137,7 @@ var Resize = /** @class */ (function () {
127
137
  }
128
138
  if (this.parent.iframeSettings.enable && !isNullOrUndefined(this.parent.inputElement)) {
129
139
  this.parent.inputElement.classList.remove('e-resize-enabled');
140
+ this.parent.contentModule.getDocument().removeEventListener('mouseup', this.iframeMouseUpBoundFn);
130
141
  }
131
142
  if (this.resizer) {
132
143
  EventHandler.remove(this.resizer, 'mousedown', this.resizeStart);
@@ -134,6 +145,12 @@ var Resize = /** @class */ (function () {
134
145
  detach(this.resizer);
135
146
  }
136
147
  this.parent.off(events.destroy, this.destroy);
148
+ this.iframeMouseUpBoundFn = null;
149
+ };
150
+ Resize.prototype.iframeMouseUp = function (e) {
151
+ if (this.isResizing) {
152
+ this.stopResize(e);
153
+ }
137
154
  };
138
155
  /**
139
156
  * For internal use only - Get the module name.
@@ -246,7 +246,19 @@ export interface IRenderer {
246
246
  inlineQTBar?: BaseQuickToolbar;
247
247
  renderPanel?(): void;
248
248
  setPanel?(panel: Element): void;
249
+ /**
250
+ * Retrieves the parent element of the content editable div.
251
+ * If the editor is in iframe mode, it returns the `iframe` element.
252
+ * Otherwise, it returns the parent element with the class `e-rte-content`.
253
+ *
254
+ * @returns {Element} - The parent element of the content editable div or the `iframe` element.
255
+ */
249
256
  getPanel?(): Element;
257
+ /**
258
+ * Retrieves the content editable `div` element of the RichTextEditor.
259
+ * If the editor is in iframe mode, it returns the `body` element of the iframe.
260
+ *
261
+ */
250
262
  getEditPanel?(): Element;
251
263
  getText?(): string;
252
264
  getDocument?(): Document;
@@ -1411,7 +1423,7 @@ export declare const executeGroup: {
1411
1423
  /**
1412
1424
  * Defines types to be used as CommandName.
1413
1425
  */
1414
- export declare type CommandName = 'bold' | 'italic' | 'underline' | 'strikeThrough' | 'superscript' | 'subscript' | 'uppercase' | 'lowercase' | 'fontColor' | 'fontName' | 'fontSize' | 'backColor' | 'justifyCenter' | 'justifyFull' | 'justifyLeft' | 'justifyRight' | 'undo' | 'createLink' | 'formatBlock' | 'heading' | 'indent' | 'insertHTML' | 'insertOrderedList' | 'insertUnorderedList' | 'insertParagraph' | 'outdent' | 'redo' | 'removeFormat' | 'insertText' | 'insertImage' | 'insertAudio' | 'insertVideo' | 'insertHorizontalRule' | 'insertBrOnReturn' | 'insertCode' | 'insertTable' | 'editImage' | 'editLink' | 'applyFormatPainter' | 'copyFormatPainter' | 'escapeFormatPainter' | 'emojiPicker' | 'InlineCode';
1426
+ export declare type CommandName = 'bold' | 'italic' | 'underline' | 'strikeThrough' | 'superscript' | 'subscript' | 'uppercase' | 'lowercase' | 'fontColor' | 'fontName' | 'fontSize' | 'backColor' | 'justifyCenter' | 'justifyFull' | 'justifyLeft' | 'justifyRight' | 'undo' | 'createLink' | 'formatBlock' | 'heading' | 'indent' | 'insertHTML' | 'insertOrderedList' | 'insertUnorderedList' | 'insertParagraph' | 'outdent' | 'redo' | 'removeFormat' | 'insertText' | 'insertImage' | 'insertAudio' | 'insertVideo' | 'insertHorizontalRule' | 'insertBrOnReturn' | 'insertCode' | 'insertTable' | 'editImage' | 'editLink' | 'applyFormatPainter' | 'copyFormatPainter' | 'escapeFormatPainter' | 'emojiPicker' | 'InlineCode' | 'importWord';
1415
1427
  /**
1416
1428
  * @hidden
1417
1429
 
@@ -357,6 +357,17 @@ var RichTextEditor = /** @class */ (function (_super) {
357
357
  * @public
358
358
  */
359
359
  RichTextEditor.prototype.executeCommand = function (commandName, value, option) {
360
+ if (commandName === 'importWord') {
361
+ var importContainer = this.createElement('div');
362
+ importContainer.innerHTML = value;
363
+ var tableElement = importContainer.querySelectorAll('table:not(.e-rte-table):not(.e-rte-paste-table)');
364
+ for (var i = 0; i < tableElement.length; i++) {
365
+ tableElement[i].classList.add('e-rte-paste-table');
366
+ }
367
+ value = importContainer.innerHTML;
368
+ importContainer.remove();
369
+ commandName = 'insertHTML';
370
+ }
360
371
  value = this.htmlPurifier(commandName, value);
361
372
  var internalValue;
362
373
  if (this.editorMode === 'HTML') {
@@ -844,6 +844,9 @@ var Audio = /** @class */ (function () {
844
844
  proxy.uploadUrl.cssClass = (proxy.parent.insertAudioSettings.layoutOption === 'Inline' ?
845
845
  classes.CLS_AUDIOINLINE : classes.CLS_AUDIOBREAK);
846
846
  proxy.dialogObj.hide({ returnValue: false });
847
+ if (proxy.dialogObj !== null) {
848
+ return;
849
+ }
847
850
  proxy.parent.formatter.process(proxy.parent, this.args, this.args.originalEvent, proxy.uploadUrl);
848
851
  proxy.uploadUrl.url = '';
849
852
  }
@@ -862,8 +865,11 @@ var Audio = /** @class */ (function () {
862
865
  url: url, selection: this.selection, fileName: name_1,
863
866
  selectParent: this.selectParent
864
867
  };
865
- proxy.parent.formatter.process(proxy.parent, this.args, this.args.originalEvent, value);
866
868
  proxy.dialogObj.hide({ returnValue: false });
869
+ if (proxy.dialogObj !== null) {
870
+ return;
871
+ }
872
+ proxy.parent.formatter.process(proxy.parent, this.args, this.args.originalEvent, value);
867
873
  }
868
874
  };
869
875
  /* eslint-disable */