@syncfusion/ej2-richtexteditor 26.1.35 → 26.1.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) 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 +80 -32
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +80 -32
  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 +11 -11
  12. package/src/editor-manager/plugin/ms-word-clean-up.js +3 -2
  13. package/src/editor-manager/plugin/video.js +12 -1
  14. package/src/rich-text-editor/actions/base-quick-toolbar.js +1 -1
  15. package/src/rich-text-editor/actions/count.js +1 -1
  16. package/src/rich-text-editor/actions/enter-key.js +31 -5
  17. package/src/rich-text-editor/actions/html-editor.js +4 -0
  18. package/src/rich-text-editor/actions/toolbar.js +2 -1
  19. package/src/rich-text-editor/base/rich-text-editor.js +1 -10
  20. package/src/rich-text-editor/renderer/image-module.d.ts +4 -0
  21. package/src/rich-text-editor/renderer/image-module.js +16 -8
  22. package/src/rich-text-editor/renderer/table-module.js +1 -1
  23. package/src/rich-text-editor/renderer/toolbar-renderer.js +2 -3
  24. package/src/rich-text-editor/renderer/video-module.js +8 -0
  25. package/styles/fluent2.css +10 -10
  26. package/styles/material3-dark.css +6 -6
  27. package/styles/material3.css +6 -6
  28. package/styles/rich-text-editor/_fluent2-definition.scss +1 -1
  29. package/styles/rich-text-editor/_layout.scss +20 -10
  30. package/styles/rich-text-editor/_material3-definition.scss +2 -2
  31. package/styles/rich-text-editor/fluent2.css +10 -10
  32. package/styles/rich-text-editor/material3-dark.css +6 -6
  33. package/styles/rich-text-editor/material3.css +6 -6
@@ -5714,9 +5714,8 @@ var ToolbarRenderer = /** @__PURE__ @class */ (function () {
5714
5714
  cssClass: ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass + ' ' + 'e-rte-picker-init',
5715
5715
  created: function () {
5716
5716
  var value = (item === 'backgroundcolor') ? proxy.parent.backgroundColor.default : proxy.parent.fontColor.default;
5717
- colorPicker.setProperties({ value: value });
5718
- colorPicker.cssClass = ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass;
5719
- colorPicker.value = value;
5717
+ var cssClass = ((item === 'backgroundcolor') ? CLS_BACKGROUND_COLOR_PICKER : CLS_FONT_COLOR_PICKER) + ' ' + args.cssClass;
5718
+ colorPicker.setProperties({ value: value, cssClass: cssClass });
5720
5719
  },
5721
5720
  mode: ((item === 'backgroundcolor') ? proxy.parent.backgroundColor.mode : proxy.parent.fontColor.mode),
5722
5721
  modeSwitcher: ((item === 'backgroundcolor') ? proxy.parent.backgroundColor.modeSwitcher : proxy.parent.fontColor.modeSwitcher),
@@ -6950,7 +6949,7 @@ var Toolbar = /** @__PURE__ @class */ (function () {
6950
6949
  */
6951
6950
  Toolbar.prototype.updateItem = function (args) {
6952
6951
  var item = this.tools[args.updateItem.toLocaleLowerCase()];
6953
- if (this.parent.locale !== 'en-US') {
6952
+ if ((getTooltipText(args.updateItem.toLocaleLowerCase(), this.locator) !== 'Code View' && getTooltipText(args.updateItem.toLocaleLowerCase(), this.locator) !== 'Preview') || this.parent.locale !== 'en-US') {
6954
6953
  item.tooltip = getTooltipText(args.updateItem.toLocaleLowerCase(), this.locator);
6955
6954
  }
6956
6955
  var trgItem = this.tools[args.targetItem.toLocaleLowerCase()];
@@ -8092,7 +8091,7 @@ var BaseQuickToolbar = /** @__PURE__ @class */ (function () {
8092
8091
  _this.checkCollision(showPopupData, 'document', ((_this.parent.inlineMode.enable) ? 'inline' : (type === 'text') ? 'text' : ''));
8093
8092
  _this.popupObj.element.classList.remove('e-popup-open');
8094
8093
  removeClass([_this.element], [CLS_HIDE]);
8095
- _this.popupObj.show({ name: 'ZoomIn', duration: (Browser.isIE ? 250 : 400) });
8094
+ _this.popupObj.show({ name: 'ZoomIn', duration: (Browser.isIE ? 250 : 400) }, target);
8096
8095
  if (_this.popupObj && _this.parent.cssClass) {
8097
8096
  removeClass([_this.popupObj.element], _this.parent.cssClass.replace(/\s+/g, ' ').trim().split(' '));
8098
8097
  addClass([_this.popupObj.element], _this.parent.cssClass.replace(/\s+/g, ' ').trim().split(' '));
@@ -9012,7 +9011,7 @@ var Count = /** @__PURE__ @class */ (function () {
9012
9011
  };
9013
9012
  Count.prototype.appendCount = function () {
9014
9013
  var htmlText = this.parent.editorMode === 'Markdown' ? this.editPanel.value :
9015
- (this.parent.getText().replace(/(\r\n|\n|\r|\t)/gm, ''));
9014
+ (isNullOrUndefined(this.parent.getText()) ? '' : (this.parent.getText().replace(/(\r\n|\n|\r|\t)/gm, '')));
9016
9015
  if (this.parent.editorMode !== 'Markdown' && htmlText.indexOf('\u200B') !== -1) {
9017
9016
  this.htmlLength = htmlText.replace(/\u200B/g, '').length;
9018
9017
  }
@@ -16977,6 +16976,7 @@ var VideoCommand = /** @__PURE__ @class */ (function () {
16977
16976
  clickElement.appendChild(temp.content);
16978
16977
  this.vidElement = sourceElement = clickElement.firstElementChild;
16979
16978
  this.setStyle(sourceElement, e, this.vidElement);
16979
+ wrapElement.style.display = (e.item.cssClass === CLASS_VIDEO_INLINE) ? 'inline-block' : 'block';
16980
16980
  wrapElement.appendChild(clickElement);
16981
16981
  }
16982
16982
  else {
@@ -17109,6 +17109,16 @@ var VideoCommand = /** @__PURE__ @class */ (function () {
17109
17109
  if (!isNullOrUndefined(e.item.height) && !isNullOrUndefined(e.item.height.maxHeight)) {
17110
17110
  videoEle.style.maxHeight = formatUnit(e.item.height.maxHeight);
17111
17111
  }
17112
+ if (!isNullOrUndefined(e.item.cssClass)) {
17113
+ if (e.item.cssClass === CLASS_VIDEO_BREAK) {
17114
+ addClass([videoEle], [CLASS_VIDEO_BREAK]);
17115
+ removeClass([videoEle], [CLASS_VIDEO_INLINE]);
17116
+ }
17117
+ else {
17118
+ addClass([videoEle], [CLASS_VIDEO_INLINE]);
17119
+ removeClass([videoEle], [CLASS_VIDEO_BREAK]);
17120
+ }
17121
+ }
17112
17122
  };
17113
17123
  VideoCommand.prototype.videoDimension = function (e) {
17114
17124
  var selectNode = !(e.item.selectNode[0].classList.contains(CLASS_VIDEO_CLICK_ELEM)) ? e.item.selectNode[0] :
@@ -20298,12 +20308,13 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
20298
20308
  this.filterStyles(elm, wordPasteStyleConfig);
20299
20309
  var resultElem = void 0;
20300
20310
  var fromClass = false;
20311
+ var regex = /^(p|div|li)\.(1|10|11)$/;
20301
20312
  for (var i = 0; i < keys.length; i++) {
20302
20313
  if (keys[i].split('.')[0] === '') {
20303
20314
  resultElem = elm.getElementsByClassName(keys[i].split('.')[1]);
20304
20315
  fromClass = true;
20305
20316
  }
20306
- else if (keys[i].split('.').length === 1 && keys[i].split('.')[0].indexOf('@') >= 0) {
20317
+ else if ((keys[i].split('.').length === 1 && keys[i].split('.')[0].indexOf('@') >= 0) || (regex.test(keys[i]))) {
20307
20318
  continue;
20308
20319
  }
20309
20320
  else if (keys[i].split('.').length === 1 && keys[i].split('.')[0].indexOf('@') < 0) {
@@ -20479,7 +20490,7 @@ var MsWordPaste = /** @__PURE__ @class */ (function () {
20479
20490
  if (content && content.indexOf('mso-list:') !== -1) {
20480
20491
  var msoListValue = void 0;
20481
20492
  if (content.match(/mso-list:[^;]+;?/)) {
20482
- var changedContent = content.replace('\n', '').split(' ').join('');
20493
+ var changedContent = content.replace(new RegExp('\n', 'g'), '').split(' ').join('');
20483
20494
  msoListValue = changedContent.match(/mso-list:[^;]+;?/)[0].split(':l');
20484
20495
  listFormatOverride = isNullOrUndefined(msoListValue) ? null : parseInt(msoListValue[1].split('level')[0], 10);
20485
20496
  }
@@ -23007,6 +23018,10 @@ var HtmlEditor = /** @__PURE__ @class */ (function () {
23007
23018
  }
23008
23019
  paraElem[i].innerHTML = resultSplitContent.trim();
23009
23020
  }
23021
+ var anchorElement = divElement.childNodes[0];
23022
+ if (!isNullOrUndefined(anchorElement) && !isNullOrUndefined(anchorElement.childNodes[0]) && anchorElement.nodeName === 'SPAN' && anchorElement.childNodes[0].nodeName === 'A') {
23023
+ divElement.innerHTML = divElement.innerHTML.replace('<span>', '').replace('</span>', '');
23024
+ }
23010
23025
  if (!isNullOrUndefined(this.parent.pasteCleanupModule)) {
23011
23026
  e.callBack(divElement.innerHTML);
23012
23027
  }
@@ -26792,6 +26807,10 @@ var Image$1 = /** @__PURE__ @class */ (function () {
26792
26807
  this.rendererFactory = serviceLocator.getService('rendererFactory');
26793
26808
  this.dialogRenderObj = serviceLocator.getService('dialogRenderObject');
26794
26809
  this.addEventListener();
26810
+ this.drop = this.dragDrop.bind(this);
26811
+ this.drag = this.dragOver.bind(this);
26812
+ this.enter = this.dragEnter.bind(this);
26813
+ this.start = this.dragStart.bind(this);
26795
26814
  }
26796
26815
  Image.prototype.addEventListener = function () {
26797
26816
  if (this.parent.isDestroyed) {
@@ -26850,10 +26869,14 @@ var Image$1 = /** @__PURE__ @class */ (function () {
26850
26869
  this.parent.off(moduleDestroy, this.moduleDestroy);
26851
26870
  var dropElement = this.parent.iframeSettings.enable ? this.parent.inputElement.ownerDocument
26852
26871
  : this.parent.inputElement;
26853
- dropElement.removeEventListener('drop', this.dragDrop.bind(this), true);
26854
- dropElement.removeEventListener('dragstart', this.dragStart.bind(this), true);
26855
- dropElement.removeEventListener('dragenter', this.dragEnter.bind(this), true);
26856
- dropElement.removeEventListener('dragover', this.dragOver.bind(this), true);
26872
+ dropElement.removeEventListener('drop', this.drop, true);
26873
+ dropElement.removeEventListener('dragstart', this.drag, true);
26874
+ dropElement.removeEventListener('dragenter', this.enter, true);
26875
+ dropElement.removeEventListener('dragover', this.start, true);
26876
+ this.drop = null;
26877
+ this.drag = null;
26878
+ this.enter = null;
26879
+ this.start = null;
26857
26880
  if (!isNullOrUndefined(this.contentModule)) {
26858
26881
  EventHandler.remove(this.contentModule.getEditPanel(), Browser.touchEndEvent, this.imageClick);
26859
26882
  this.parent.formatter.editorManager.observer.off(checkUndo, this.undoStack);
@@ -26907,10 +26930,10 @@ var Image$1 = /** @__PURE__ @class */ (function () {
26907
26930
  }
26908
26931
  var dropElement = this.parent.iframeSettings.enable ? this.parent.inputElement.ownerDocument :
26909
26932
  this.parent.inputElement;
26910
- dropElement.addEventListener('drop', this.dragDrop.bind(this), true);
26911
- dropElement.addEventListener('dragstart', this.dragStart.bind(this), true);
26912
- dropElement.addEventListener('dragenter', this.dragOver.bind(this), true);
26913
- dropElement.addEventListener('dragover', this.dragOver.bind(this), true);
26933
+ dropElement.addEventListener('drop', this.drop, true);
26934
+ dropElement.addEventListener('dragstart', this.drag, true);
26935
+ dropElement.addEventListener('dragenter', this.enter, true);
26936
+ dropElement.addEventListener('dragover', this.start, true);
26914
26937
  };
26915
26938
  Image.prototype.undoStack = function (args) {
26916
26939
  if (args.subCommand.toLowerCase() === 'undo' || args.subCommand.toLowerCase() === 'redo') {
@@ -31362,6 +31385,14 @@ var Video = /** @__PURE__ @class */ (function () {
31362
31385
  if (!isNullOrUndefined(proxy.uploadUrl) && proxy.uploadUrl.url !== '') {
31363
31386
  proxy.uploadUrl.cssClass = (proxy.parent.insertVideoSettings.layoutOption === 'Inline' ?
31364
31387
  CLS_VIDEOINLINE : CLS_VIDEOBREAK);
31388
+ proxy.uploadUrl.width = {
31389
+ width: proxy.parent.insertVideoSettings.width, minWidth: proxy.parent.insertVideoSettings.minWidth,
31390
+ maxWidth: proxy.parent.getInsertImgMaxWidth()
31391
+ };
31392
+ proxy.uploadUrl.height = {
31393
+ height: proxy.parent.insertVideoSettings.height, minHeight: proxy.parent.insertVideoSettings.minHeight,
31394
+ maxHeight: proxy.parent.insertVideoSettings.maxHeight
31395
+ };
31365
31396
  proxy.dialogObj.hide({ returnValue: false });
31366
31397
  proxy.parent.formatter.process(proxy.parent, this.args, this.args.originalEvent, proxy.uploadUrl);
31367
31398
  proxy.uploadUrl.url = '';
@@ -33677,7 +33708,7 @@ var Table = /** @__PURE__ @class */ (function () {
33677
33708
  var argument = ((Browser.isDevice || (!isNullOrUndefined(args.args)
33678
33709
  && !isNullOrUndefined(args.args.originalEvent) &&
33679
33710
  args.args.originalEvent.action === 'insert-table')
33680
- || proxy.parent.inlineMode.enable || !isNullOrUndefined(proxy.parent.quickToolbarSettings.text)) ? args :
33711
+ || proxy.parent.inlineMode.enable || ((!isNullOrUndefined(proxy.parent.quickToolbarSettings.text)) && !(args instanceof PointerEvent))) ? args :
33681
33712
  this);
33682
33713
  proxy.tableInsert(proxy.rowTextBox.value, proxy.columnTextBox.value, e, argument);
33683
33714
  }
@@ -35116,8 +35147,17 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
35116
35147
  }
35117
35148
  else {
35118
35149
  var lineBreakBRElem = _this.parent.createElement('br');
35119
- _this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, _this.range.startContainer);
35120
- _this.parent.formatter.editorManager.domNode.insertAfter(lineBreakBRElem, _this.range.startContainer);
35150
+ var anchorElement = (!isNullOrUndefined(_this.range.startContainer.parentElement) && _this.range.startContainer.parentElement.nodeName === 'A'
35151
+ && _this.range.startContainer.parentElement.textContent.length === _this.range.startOffset)
35152
+ ? _this.range.startContainer.parentElement : _this.range.startContainer;
35153
+ _this.parent.formatter.editorManager.domNode.insertAfter(focusBRElem, anchorElement);
35154
+ _this.parent.formatter.editorManager.domNode.insertAfter(lineBreakBRElem, anchorElement);
35155
+ var brSibling = anchorElement.nextElementSibling;
35156
+ var brNextSibling = !isNullOrUndefined(brSibling) ? brSibling.nextElementSibling : null;
35157
+ if (!isNullOrUndefined(brSibling) && !isNullOrUndefined(brNextSibling) && !isNullOrUndefined(brNextSibling.nextElementSibling) &&
35158
+ brSibling.nodeName === 'BR' && brNextSibling.nodeName === 'BR' && brNextSibling.nextElementSibling.nodeName === 'BR') {
35159
+ brNextSibling.nextElementSibling.remove();
35160
+ }
35121
35161
  }
35122
35162
  }
35123
35163
  _this.parent.formatter.editorManager.nodeSelection.setCursorPoint(_this.parent.contentModule.getDocument(), focusBRElem, 0);
@@ -35184,6 +35224,13 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
35184
35224
  isFocusTextNode = false;
35185
35225
  }
35186
35226
  var brElm = this.parent.createElement('br');
35227
+ var findAnchorLastChild = this.startNode;
35228
+ while (findAnchorLastChild.lastChild) {
35229
+ findAnchorLastChild = findAnchorLastChild.lastChild;
35230
+ }
35231
+ var findAnchorElement = this.startNode.nodeName === 'A' && this.endNode.nodeName === 'A' &&
35232
+ !isNullOrUndefined(this.range.startContainer.parentElement) && this.range.startOffset === this.range.endOffset &&
35233
+ this.range.startContainer.textContent.trim().length === findAnchorLastChild.textContent.trim().length;
35187
35234
  if (this.startNode.nodeName === 'BR' && this.endNode.nodeName === 'BR' && this.range.startOffset === 0 && this.range.startOffset === this.range.endOffset) {
35188
35235
  this.parent.formatter.editorManager.domNode.insertAfter(brElm, this.startNode);
35189
35236
  isEmptyBrInserted = true;
@@ -35193,15 +35240,25 @@ var EnterKeyAction = /** @__PURE__ @class */ (function () {
35193
35240
  this.range.startContainer.previousSibling.nodeName === 'BR' && this.range.startContainer.textContent.length === 0) {
35194
35241
  isEmptyBrInserted = true;
35195
35242
  }
35196
- this.range.insertNode(brElm);
35243
+ if (findAnchorElement) {
35244
+ this.parent.formatter.editorManager.domNode.insertAfter(brElm, this.startNode);
35245
+ }
35246
+ else {
35247
+ this.range.insertNode(brElm);
35248
+ }
35197
35249
  }
35198
35250
  if (isEmptyBrInserted || (!isNullOrUndefined(brElm.nextElementSibling) && brElm.nextElementSibling.tagName === 'BR') || (!isNullOrUndefined(brElm.nextSibling) && brElm.nextSibling.textContent.length > 0)) {
35199
35251
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), !isNullOrUndefined(brElm.nextSibling) && isFocusTextNode ? brElm.nextSibling : brElm, 0);
35200
35252
  isEmptyBrInserted = false;
35201
35253
  }
35202
35254
  else {
35203
- var brElm2 = this.parent.createElement('br');
35204
- this.range.insertNode(brElm2);
35255
+ var brElements = this.parent.createElement('br');
35256
+ if (findAnchorElement) {
35257
+ this.parent.formatter.editorManager.domNode.insertAfter(brElements, this.startNode);
35258
+ }
35259
+ else {
35260
+ this.range.insertNode(brElements);
35261
+ }
35205
35262
  this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), brElm, 0);
35206
35263
  }
35207
35264
  };
@@ -36406,15 +36463,6 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
36406
36463
  detach(tooltipEle);
36407
36464
  }
36408
36465
  }
36409
- if (this.element.offsetParent === null) {
36410
- if (!isNullOrUndefined(this.toolbarModule)) {
36411
- this.toolbarModule.destroy();
36412
- }
36413
- this.notify(moduleDestroy, {});
36414
- _super.prototype.destroy.call(this);
36415
- this.isRendered = false;
36416
- return;
36417
- }
36418
36466
  this.notify(destroy, {});
36419
36467
  this.destroyDependentModules();
36420
36468
  this.unWireEvents();
@@ -37506,7 +37554,7 @@ var RichTextEditor = /** @__PURE__ @class */ (function (_super) {
37506
37554
  }
37507
37555
  }
37508
37556
  this.removeSelectionClassStates(valueElementWrapper);
37509
- return valueElementWrapper.innerHTML;
37557
+ return (this.editorMode === 'Markdown') ? valueElementWrapper.innerHTML.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&') : valueElementWrapper.innerHTML;
37510
37558
  };
37511
37559
  RichTextEditor.prototype.updateStatus = function (e) {
37512
37560
  if (!isNullOrUndefined(e.html) || !isNullOrUndefined(e.markdown)) {