@syncfusion/ej2-richtexteditor 26.2.7 → 26.2.9

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 (29) hide show
  1. package/dist/ej2-richtexteditor.min.js +2 -2
  2. package/dist/ej2-richtexteditor.umd.min.js +2 -2
  3. package/dist/ej2-richtexteditor.umd.min.js.map +1 -1
  4. package/dist/es6/ej2-richtexteditor.es2015.js +72 -21
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +72 -22
  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 +8 -8
  12. package/src/editor-manager/plugin/inserthtml.d.ts +1 -0
  13. package/src/editor-manager/plugin/inserthtml.js +25 -12
  14. package/src/editor-manager/plugin/lists.d.ts +1 -0
  15. package/src/editor-manager/plugin/lists.js +15 -1
  16. package/src/editor-manager/plugin/selection-commands.js +6 -0
  17. package/src/rich-text-editor/actions/html-editor.js +11 -2
  18. package/src/rich-text-editor/base/rich-text-editor.d.ts +1 -0
  19. package/src/rich-text-editor/base/rich-text-editor.js +11 -7
  20. package/src/rich-text-editor/renderer/audio-module.js +1 -0
  21. package/src/rich-text-editor/renderer/image-module.js +1 -0
  22. package/src/rich-text-editor/renderer/toolbar-renderer.js +1 -0
  23. package/src/rich-text-editor/renderer/video-module.js +1 -0
  24. package/styles/fluent2.css +5 -1033
  25. package/styles/material3-dark.css +1 -54
  26. package/styles/material3.css +3 -110
  27. package/styles/rich-text-editor/fluent2.css +5 -1033
  28. package/styles/rich-text-editor/material3-dark.css +1 -54
  29. package/styles/rich-text-editor/material3.css +3 -110
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * filename: index.d.ts
3
- * version : 26.2.7
3
+ * version : 26.2.9
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@26.2.5",
3
+ "_id": "@syncfusion/ej2-richtexteditor@26.2.8",
4
4
  "_inBundle": false,
5
- "_integrity": "sha512-FH3/ajh5xDss4l/7hmKai/Zf8+vn0cuPbN//GiPILPfKwkCX7b4iUQDycSF3gFGiATUID48cMuWp4EfO629Ibg==",
5
+ "_integrity": "sha512-32e+vCj/g/TFDS2cffJN/VSiGWWm98qhLXyVgxifCU+QoRXgpsdeI6jvmCzRC4UTlH4k+V58PYEO+UNRGt5mrQ==",
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-26.2.5.tgz",
29
- "_shasum": "f7cbd3a9c28d9420011a5af406c2a397639de4aa",
28
+ "_resolved": "https://nexus.syncfusioninternal.com/repository/ej2-hotfix-new/@syncfusion/ej2-richtexteditor/-/ej2-richtexteditor-26.2.8.tgz",
29
+ "_shasum": "9aff95f472285a7694f794e3b2820e56721cd13b",
30
30
  "_spec": "@syncfusion/ej2-richtexteditor@*",
31
31
  "_where": "/jenkins/workspace/elease-automation_release_26.1.1/packages/included",
32
32
  "author": {
@@ -38,11 +38,11 @@
38
38
  "bundleDependencies": false,
39
39
  "dependencies": {
40
40
  "@syncfusion/ej2-base": "~26.2.5",
41
- "@syncfusion/ej2-buttons": "~26.2.7",
41
+ "@syncfusion/ej2-buttons": "~26.2.9",
42
42
  "@syncfusion/ej2-filemanager": "~26.2.7",
43
43
  "@syncfusion/ej2-inputs": "~26.2.5",
44
- "@syncfusion/ej2-navigations": "~26.2.7",
45
- "@syncfusion/ej2-popups": "~26.2.5",
44
+ "@syncfusion/ej2-navigations": "~26.2.8",
45
+ "@syncfusion/ej2-popups": "~26.2.8",
46
46
  "@syncfusion/ej2-splitbuttons": "~26.2.5"
47
47
  },
48
48
  "deprecated": false,
@@ -79,6 +79,6 @@
79
79
  "url": "git+https://github.com/syncfusion/ej2-javascript-ui-controls.git"
80
80
  },
81
81
  "typings": "index.d.ts",
82
- "version": "26.2.7",
82
+ "version": "26.2.9",
83
83
  "sideEffects": false
84
84
  }
@@ -27,4 +27,5 @@ export declare class InsertHtml {
27
27
  private static removeEmptyElements;
28
28
  private static closestEle;
29
29
  private static insertTableInList;
30
+ private static alignCheck;
30
31
  }
@@ -203,7 +203,6 @@ var InsertHtml = /** @class */ (function () {
203
203
  return null;
204
204
  };
205
205
  InsertHtml.pasteInsertHTML = function (nodes, node, range, nodeSelection, nodeCutter, docElement, isCollapsed, closestParentNode, editNode, enterAction) {
206
- var _this = this;
207
206
  var isCursor = range.startOffset === range.endOffset &&
208
207
  range.startContainer === range.endContainer;
209
208
  if (isCursor && range.startContainer === editNode && editNode.textContent === '') {
@@ -282,6 +281,9 @@ var InsertHtml = /** @class */ (function () {
282
281
  var rangeElement = closest(nearestAnchor, 'span');
283
282
  rangeElement.appendChild(tempSpan);
284
283
  }
284
+ else if (nodes[0].nodeName === '#text' && nodes[0].nodeValue.includes('\u200B') && !isNOU(nodes[0].parentElement) && !isNOU(nodes[0].parentElement.previousElementSibling) && nodes[0].parentElement.previousElementSibling.classList.contains('e-mention-chip')) {
285
+ range.startContainer.parentElement.insertAdjacentElement('afterend', tempSpan);
286
+ }
285
287
  else {
286
288
  range.insertNode(tempSpan);
287
289
  }
@@ -370,17 +372,7 @@ var InsertHtml = /** @class */ (function () {
370
372
  else {
371
373
  this.cursorPos(lastSelectionNode, node, nodeSelection, docElement, editNode, enterAction);
372
374
  }
373
- var spanAligns = editNode.querySelectorAll('span[style*="text-align"]');
374
- if (spanAligns.length > 0) {
375
- spanAligns.forEach(function (spanAlign) {
376
- if (!isNOU(spanAlign)) {
377
- var blockAlign = _this.getImmediateBlockNode(spanAlign, null);
378
- if (blockAlign && blockAlign.textContent.trim() === spanAlign.textContent.trim()) {
379
- blockAlign.style.textAlign = spanAlign.style.textAlign;
380
- }
381
- }
382
- });
383
- }
375
+ this.alignCheck(editNode);
384
376
  };
385
377
  InsertHtml.placeCursorEnd = function (lastSelectionNode, node, nodeSelection, docElement, editNode) {
386
378
  lastSelectionNode = lastSelectionNode.nodeName === 'BR' ? (isNOU(lastSelectionNode.previousSibling) ? lastSelectionNode.parentNode
@@ -620,6 +612,27 @@ var InsertHtml = /** @class */ (function () {
620
612
  }
621
613
  insertNode.classList.add('ignore-table');
622
614
  };
615
+ InsertHtml.alignCheck = function (editNode) {
616
+ var spanAligns = editNode.querySelectorAll('span[style*="text-align"]');
617
+ for (var i = 0; i < spanAligns.length; i++) {
618
+ var spanAlign = spanAligns[i];
619
+ if (spanAlign) {
620
+ var blockAlign = this.getImmediateBlockNode(spanAlign, null);
621
+ if (blockAlign) {
622
+ var totalSpanText = '';
623
+ for (var j = 0; j < spanAligns.length; j++) {
624
+ var span = spanAligns[j];
625
+ if (blockAlign.contains(span)) {
626
+ totalSpanText += span.textContent;
627
+ }
628
+ }
629
+ if (blockAlign.textContent.trim() === totalSpanText.trim()) {
630
+ blockAlign.style.textAlign = spanAlign.style.textAlign;
631
+ }
632
+ }
633
+ }
634
+ }
635
+ };
623
636
  /**
624
637
  * Insert method
625
638
  *
@@ -49,4 +49,5 @@ export declare class Lists {
49
49
  private openTag;
50
50
  private closeTag;
51
51
  destroy(): void;
52
+ areAllListItemsSelected(list: HTMLElement, range: Range): boolean;
52
53
  }
@@ -323,7 +323,9 @@ var Lists = /** @class */ (function () {
323
323
  && (!isNullOrUndefined(closest(startNode, 'ul')) || !isNullOrUndefined(closest(startNode, 'ol')))
324
324
  && (!isNullOrUndefined(closest(endNode, 'ul')) || !isNullOrUndefined(closest(endNode, 'ol')))
325
325
  && ((commonAncestor.lastElementChild === closest(endNode, 'li') && commonAncestor.lastChild !== endNode)) && !range.collapsed) {
326
- detach(commonAncestor);
326
+ if (this.areAllListItemsSelected(commonAncestor, range)) {
327
+ detach(commonAncestor);
328
+ }
327
329
  }
328
330
  this.removeList(range, e);
329
331
  }
@@ -1004,6 +1006,18 @@ var Lists = /** @class */ (function () {
1004
1006
  this.domNode = null;
1005
1007
  }
1006
1008
  };
1009
+ Lists.prototype.areAllListItemsSelected = function (list, range) {
1010
+ var listItems = list.querySelectorAll('li');
1011
+ for (var i = 0; i < listItems.length; i++) {
1012
+ var listItem = listItems[i];
1013
+ var listItemRange = this.parent.currentDocument.createRange();
1014
+ listItemRange.selectNodeContents(listItem);
1015
+ if (!range.intersectsNode(listItem)) {
1016
+ return false;
1017
+ }
1018
+ }
1019
+ return true;
1020
+ };
1007
1021
  return Lists;
1008
1022
  }());
1009
1023
  export { Lists };
@@ -243,6 +243,12 @@ 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.
247
+ indexOf((cursorNodes[0].parentElement).tagName.toLowerCase()) !== -1 && cursorNodes[0].textContent.includes('\u200B')) {
248
+ var element = this.GetFormatNode(format, value);
249
+ this.applyStyles(cursorNodes, 0, element);
250
+ return cursorNodes[0];
251
+ }
246
252
  cursorNode = this.getInsertNode(docElement, range, format, value).firstChild;
247
253
  }
248
254
  return cursorNode;
@@ -216,7 +216,7 @@ var HtmlEditor = /** @class */ (function () {
216
216
  };
217
217
  HtmlEditor.prototype.onKeyUp = function (e) {
218
218
  var args = e.args;
219
- var restrictKeys = [8, 9, 13, 16, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
219
+ var restrictKeys = [8, 9, 13, 17, 18, 20, 27, 37, 38, 39, 40, 44, 45, 46, 91,
220
220
  112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123];
221
221
  var range = this.parent.getRange();
222
222
  var regEx = new RegExp('\u200B', 'g');
@@ -224,9 +224,18 @@ var HtmlEditor = /** @class */ (function () {
224
224
  range.startOffset === 1 && range.startContainer.textContent.length === 1 &&
225
225
  range.startContainer.textContent.charCodeAt(0) === 8203 &&
226
226
  range.startContainer.textContent.replace(regEx, '').length === 0;
227
+ var isMention = false;
228
+ if (range.startContainer === range.endContainer &&
229
+ range.startOffset === range.endOffset && (range.startContainer !== this.parent.inputElement && range.startOffset !== 0)) {
230
+ var mentionStartNode = range.startContainer.nodeType === 3 ?
231
+ range.startContainer : range.startContainer.childNodes[range.startOffset - 1];
232
+ isMention = args.keyCode === 16 &&
233
+ mentionStartNode.textContent.charCodeAt(0) === 8203 &&
234
+ !isNOU(mentionStartNode.previousSibling) && mentionStartNode.previousSibling.contentEditable === 'false';
235
+ }
227
236
  var pointer;
228
237
  var isRootParent = false;
229
- if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode) {
238
+ if (restrictKeys.indexOf(args.keyCode) < 0 && !args.shiftKey && !args.ctrlKey && !args.altKey && !isEmptyNode && !isMention) {
230
239
  pointer = range.startOffset;
231
240
  var container = range.startContainer;
232
241
  // Check if the container is a text node and contains a zero-width space
@@ -52,6 +52,7 @@ export declare class RichTextEditor extends Component<HTMLElement> implements IN
52
52
  private onBlurHandler;
53
53
  private onResizeHandler;
54
54
  private timeInterval;
55
+ private autoSaveTimeOut;
55
56
  private idleInterval;
56
57
  private touchModule;
57
58
  private defaultResetValue;
@@ -186,8 +186,6 @@ var RichTextEditor = /** @class */ (function (_super) {
186
186
  */
187
187
  RichTextEditor.prototype.preRender = function () {
188
188
  this.initializeValue();
189
- this.onBlurHandler = this.blurHandler.bind(this);
190
- this.onFocusHandler = this.focusHandler.bind(this);
191
189
  this.clickPoints = { clientX: 0, clientY: 0 };
192
190
  this.initialValue = this.value;
193
191
  this.serviceLocator = new ServiceLocator;
@@ -827,7 +825,7 @@ var RichTextEditor = /** @class */ (function (_super) {
827
825
  this.inputElement.innerHTML = this.enterKey !== 'BR' ? '<' + this.enterKey + '><br></' + this.enterKey + '>' : '<br>';
828
826
  this.isSelectAll = false;
829
827
  }
830
- if (selection.rangeCount > 0) {
828
+ if (selection.rangeCount > 0 && this.contentModule.getDocument().activeElement.tagName !== 'INPUT' && this.inputElement.contains(this.contentModule.getDocument().activeElement) && range.startContainer.innerHTML === '<br>' && range.startContainer.textContent === '') {
831
829
  selection.removeAllRanges();
832
830
  selection.addRange(currentRange);
833
831
  }
@@ -1090,6 +1088,10 @@ var RichTextEditor = /** @class */ (function (_super) {
1090
1088
  clearInterval(this.timeInterval);
1091
1089
  this.timeInterval = null;
1092
1090
  }
1091
+ if (!isNOU(this.autoSaveTimeOut)) {
1092
+ clearTimeout(this.autoSaveTimeOut);
1093
+ this.autoSaveTimeOut = null;
1094
+ }
1093
1095
  if (!isNOU(this.idleInterval)) {
1094
1096
  clearTimeout(this.idleInterval);
1095
1097
  this.idleInterval = null;
@@ -2124,7 +2126,7 @@ var RichTextEditor = /** @class */ (function (_super) {
2124
2126
  }
2125
2127
  this.preventDefaultResize(e);
2126
2128
  this.trigger('focus', { event: e, isInteracted: Object.keys(e).length === 0 ? false : true });
2127
- if (!isNOU(this.saveInterval) && this.saveInterval > 0 && !this.autoSaveOnIdle) {
2129
+ if (!isNOU(this.saveInterval) && this.saveInterval > 0 && !this.autoSaveOnIdle && isNOU(this.timeInterval)) {
2128
2130
  this.timeInterval = setInterval(this.updateValueOnIdle.bind(this), this.saveInterval);
2129
2131
  }
2130
2132
  EventHandler.add(document, 'mousedown', this.onDocumentClick, this);
@@ -2293,8 +2295,8 @@ var RichTextEditor = /** @class */ (function (_super) {
2293
2295
  RichTextEditor.prototype.contentChanged = function () {
2294
2296
  if (this.autoSaveOnIdle) {
2295
2297
  if (!isNOU(this.saveInterval)) {
2296
- clearTimeout(this.timeInterval);
2297
- this.timeInterval = setTimeout(this.updateIntervalValue.bind(this), this.saveInterval);
2298
+ clearTimeout(this.autoSaveTimeOut);
2299
+ this.autoSaveTimeOut = setTimeout(this.updateIntervalValue.bind(this), this.saveInterval);
2298
2300
  }
2299
2301
  }
2300
2302
  };
@@ -2437,6 +2439,9 @@ var RichTextEditor = /** @class */ (function (_super) {
2437
2439
  }
2438
2440
  };
2439
2441
  RichTextEditor.prototype.wireEvents = function () {
2442
+ this.onResizeHandler = this.resizeHandler.bind(this);
2443
+ this.onBlurHandler = this.blurHandler.bind(this);
2444
+ this.onFocusHandler = this.focusHandler.bind(this);
2440
2445
  this.element.addEventListener('focusin', this.onFocusHandler, true);
2441
2446
  this.element.addEventListener('focusout', this.onBlurHandler, true);
2442
2447
  this.on(events.contentChanged, this.contentChanged, this);
@@ -2492,7 +2497,6 @@ var RichTextEditor = /** @class */ (function (_super) {
2492
2497
  EventHandler.add(this.inputElement, 'input', this.inputHandler, this);
2493
2498
  this.wireContextEvent();
2494
2499
  this.formatter.editorManager.observer.on(CONSTANT.KEY_DOWN_HANDLER, this.editorKeyDown, this);
2495
- this.onResizeHandler = this.resizeHandler.bind(this);
2496
2500
  this.element.ownerDocument.defaultView.addEventListener('resize', this.onResizeHandler, true);
2497
2501
  if (this.iframeSettings.enable) {
2498
2502
  EventHandler.add(this.inputElement, 'focusin', this.focusHandler, this);
@@ -62,6 +62,7 @@ var Audio = /** @class */ (function () {
62
62
  EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.touchStart);
63
63
  EventHandler.remove(this.contentModule.getEditPanel(), Browser.touchEndEvent, this.audioClick);
64
64
  this.parent.element.ownerDocument.removeEventListener('mousedown', this.docClick, true);
65
+ this.docClick = null;
65
66
  }
66
67
  };
67
68
  Audio.prototype.afterRender = function () {
@@ -99,6 +99,7 @@ var Image = /** @class */ (function () {
99
99
  if (this.parent.insertImageSettings.resize) {
100
100
  EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.resizeStart);
101
101
  this.parent.element.ownerDocument.removeEventListener('mousedown', this.docClick, true);
102
+ this.docClick = null;
102
103
  EventHandler.remove(this.contentModule.getEditPanel(), 'cut', this.onCutHandler);
103
104
  EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
104
105
  }
@@ -157,6 +157,7 @@ var ToolbarRenderer = /** @class */ (function () {
157
157
  openDelay: 400,
158
158
  opensOn: 'Hover',
159
159
  beforeRender: this.tooltipBeforeRender.bind(this),
160
+ beforeOpen: this.tooltipBeforeOpen.bind(this),
160
161
  cssClass: this.parent.getCssClass(),
161
162
  windowCollision: true,
162
163
  position: 'BottomCenter'
@@ -74,6 +74,7 @@ var Video = /** @class */ (function () {
74
74
  if (this.parent.insertVideoSettings.resize) {
75
75
  EventHandler.remove(this.parent.contentModule.getEditPanel(), Browser.touchStartEvent, this.resizeStart);
76
76
  this.parent.element.ownerDocument.removeEventListener('mousedown', this.docClick, true);
77
+ this.docClick = null;
77
78
  EventHandler.remove(this.contentModule.getEditPanel(), 'cut', this.onCutHandler);
78
79
  EventHandler.remove(this.contentModule.getDocument(), Browser.touchMoveEvent, this.resizing);
79
80
  }