@syncfusion/ej2-richtexteditor 19.3.46 → 19.3.55

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 (49) hide show
  1. package/CHANGELOG.md +40 -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 +79 -10
  5. package/dist/es6/ej2-richtexteditor.es2015.js.map +1 -1
  6. package/dist/es6/ej2-richtexteditor.es5.js +79 -10
  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/selection-commands.js +18 -1
  13. package/src/rich-text-editor/actions/dropdown-buttons.js +10 -0
  14. package/src/rich-text-editor/actions/enter-key.js +1 -0
  15. package/src/rich-text-editor/actions/quick-toolbar.d.ts +1 -0
  16. package/src/rich-text-editor/actions/quick-toolbar.js +20 -2
  17. package/src/rich-text-editor/base/rich-text-editor.js +1 -2
  18. package/src/rich-text-editor/renderer/image-module.d.ts +2 -0
  19. package/src/rich-text-editor/renderer/image-module.js +23 -2
  20. package/src/rich-text-editor/renderer/link-module.js +3 -2
  21. package/src/rich-text-editor/renderer/table-module.js +3 -2
  22. package/src/rich-text-editor/renderer/toolbar-renderer.js +3 -2
  23. package/styles/bootstrap-dark.css +4 -0
  24. package/styles/bootstrap.css +4 -0
  25. package/styles/bootstrap4.css +4 -0
  26. package/styles/bootstrap5-dark.css +4 -0
  27. package/styles/bootstrap5.css +4 -0
  28. package/styles/fabric-dark.css +4 -0
  29. package/styles/fabric.css +4 -0
  30. package/styles/highcontrast-light.css +4 -0
  31. package/styles/highcontrast.css +4 -0
  32. package/styles/material-dark.css +4 -0
  33. package/styles/material.css +4 -0
  34. package/styles/rich-text-editor/_layout.scss +4 -0
  35. package/styles/rich-text-editor/bootstrap-dark.css +4 -0
  36. package/styles/rich-text-editor/bootstrap.css +4 -0
  37. package/styles/rich-text-editor/bootstrap4.css +4 -0
  38. package/styles/rich-text-editor/bootstrap5-dark.css +4 -0
  39. package/styles/rich-text-editor/bootstrap5.css +4 -0
  40. package/styles/rich-text-editor/fabric-dark.css +4 -0
  41. package/styles/rich-text-editor/fabric.css +4 -0
  42. package/styles/rich-text-editor/highcontrast-light.css +4 -0
  43. package/styles/rich-text-editor/highcontrast.css +4 -0
  44. package/styles/rich-text-editor/material-dark.css +4 -0
  45. package/styles/rich-text-editor/material.css +4 -0
  46. package/styles/rich-text-editor/tailwind-dark.css +4 -0
  47. package/styles/rich-text-editor/tailwind.css +4 -0
  48. package/styles/tailwind-dark.css +4 -0
  49. package/styles/tailwind.css +4 -0
@@ -2739,7 +2739,8 @@ class ToolbarRenderer {
2739
2739
  this.parent.notify(beforeDropDownItemRender, args);
2740
2740
  }
2741
2741
  dropDownOpen(args) {
2742
- if (args.element.parentElement.getAttribute('id').indexOf('TableCell') > -1) {
2742
+ if (args.element.parentElement.getAttribute('id').indexOf('TableCell') > -1 && !isNullOrUndefined(args.element.parentElement.querySelector('.e-cell-merge')) &&
2743
+ (!isNullOrUndefined(args.element.parentElement.querySelector('.e-cell-horizontal-split')) || !isNullOrUndefined(args.element.parentElement.querySelector('.e-cell-vertical-split')))) {
2743
2744
  const listEle = args.element.querySelectorAll('li');
2744
2745
  if (this.parent.inputElement.querySelectorAll('.e-cell-select').length === 1) {
2745
2746
  addClass([listEle[0]], 'e-disabled');
@@ -3591,6 +3592,11 @@ class DropDownButtons {
3591
3592
  for (const prop of Object.keys(newProp)) {
3592
3593
  switch (prop) {
3593
3594
  case 'fontFamily':
3595
+ if (this.parent.inlineMode.enable) {
3596
+ if (!isNullOrUndefined(this.parent.fontFamily.default)) {
3597
+ this.getEditNode().style.fontFamily = this.parent.fontFamily.default;
3598
+ }
3599
+ }
3594
3600
  if (this.fontNameDropDown) {
3595
3601
  for (const fontFamily$$1 of Object.keys(newProp.fontFamily)) {
3596
3602
  switch (fontFamily$$1) {
@@ -3621,6 +3627,11 @@ class DropDownButtons {
3621
3627
  }
3622
3628
  break;
3623
3629
  case 'fontSize':
3630
+ if (this.parent.inlineMode) {
3631
+ if (!isNullOrUndefined(this.parent.fontSize.default)) {
3632
+ this.getEditNode().style.fontSize = this.parent.fontSize.default;
3633
+ }
3634
+ }
3624
3635
  if (this.fontSizeDropDown) {
3625
3636
  for (const fontSize$$1 of Object.keys(newProp.fontSize)) {
3626
3637
  switch (fontSize$$1) {
@@ -5649,6 +5660,11 @@ class QuickToolbar {
5649
5660
  this.parent.isBlur = false;
5650
5661
  this.parent.isRTE = true;
5651
5662
  }
5663
+ keyUpQT(e) {
5664
+ if (e.which == 27) {
5665
+ this.hideQuickToolbars();
5666
+ }
5667
+ }
5652
5668
  renderQuickToolbars() {
5653
5669
  if (this.linkQTBar || this.imageQTBar || this.textQTBar || this.tableQTBar) {
5654
5670
  return;
@@ -5663,15 +5679,19 @@ class QuickToolbar {
5663
5679
  this.renderFactory.addRenderer(RenderType.TableToolbar, this.tableQTBar);
5664
5680
  if (this.linkQTBar) {
5665
5681
  EventHandler.add(this.linkQTBar.element, 'mousedown', this.onMouseDown, this);
5682
+ EventHandler.add(this.linkQTBar.element, 'keyup', this.keyUpQT, this);
5666
5683
  }
5667
5684
  if (this.imageQTBar) {
5668
5685
  EventHandler.add(this.imageQTBar.element, 'mousedown', this.onMouseDown, this);
5686
+ EventHandler.add(this.imageQTBar.element, 'keyup', this.keyUpQT, this);
5669
5687
  }
5670
5688
  if (this.textQTBar) {
5671
5689
  EventHandler.add(this.textQTBar.element, 'mousedown', this.onMouseDown, this);
5690
+ EventHandler.add(this.textQTBar.element, 'keyup', this.keyUpQT, this);
5672
5691
  }
5673
5692
  if (this.tableQTBar) {
5674
5693
  EventHandler.add(this.tableQTBar.element, 'mousedown', this.onMouseDown, this);
5694
+ EventHandler.add(this.tableQTBar.element, 'keyup', this.keyUpQT, this);
5675
5695
  }
5676
5696
  }
5677
5697
  renderInlineQuickToolbar() {
@@ -5680,6 +5700,7 @@ class QuickToolbar {
5680
5700
  this.inlineQTBar = this.createQTBar('Inline', 'MultiRow', this.parent.toolbarSettings.items, RenderType.InlineToolbar);
5681
5701
  this.renderFactory.addRenderer(RenderType.InlineToolbar, this.inlineQTBar);
5682
5702
  EventHandler.add(this.inlineQTBar.element, 'mousedown', this.onMouseDown, this);
5703
+ EventHandler.add(this.inlineQTBar.element, 'keyup', this.keyUpQT, this);
5683
5704
  }
5684
5705
  }
5685
5706
  /**
@@ -5761,7 +5782,10 @@ class QuickToolbar {
5761
5782
  else {
5762
5783
  const closestAnchor = closest(target, 'a');
5763
5784
  target = closestAnchor ? closestAnchor : target;
5764
- if (target.tagName !== 'IMG' && target.tagName !== 'A' && (!closest(target, 'td,th') || !range.collapsed)) {
5785
+ const startNode = this.parent.getRange().startContainer.parentElement;
5786
+ const endNode = this.parent.getRange().endContainer.parentElement;
5787
+ if ((isNullOrUndefined(closest(startNode, 'A')) || isNullOrUndefined(closest(endNode, 'A'))) && (!closest(target, 'td,th') || !range.collapsed) &&
5788
+ (target.tagName !== 'IMG' || this.parent.getRange().startOffset !== this.parent.getRange().endOffset)) {
5765
5789
  if (this.parent.inlineMode.onSelection && range.collapsed) {
5766
5790
  return;
5767
5791
  }
@@ -5829,22 +5853,27 @@ class QuickToolbar {
5829
5853
  destroy() {
5830
5854
  if (this.linkQTBar) {
5831
5855
  EventHandler.remove(this.linkQTBar.element, 'mousedown', this.onMouseDown);
5856
+ EventHandler.remove(this.linkQTBar.element, 'keyup', this.keyUpQT);
5832
5857
  this.linkQTBar.destroy();
5833
5858
  }
5834
5859
  if (this.textQTBar) {
5835
5860
  EventHandler.remove(this.textQTBar.element, 'mousedown', this.onMouseDown);
5861
+ EventHandler.remove(this.textQTBar.element, 'keyup', this.keyUpQT);
5836
5862
  this.textQTBar.destroy();
5837
5863
  }
5838
5864
  if (this.imageQTBar) {
5839
5865
  EventHandler.remove(this.imageQTBar.element, 'mousedown', this.onMouseDown);
5866
+ EventHandler.remove(this.imageQTBar.element, 'keyup', this.keyUpQT);
5840
5867
  this.imageQTBar.destroy();
5841
5868
  }
5842
5869
  if (this.tableQTBar) {
5843
5870
  EventHandler.remove(this.tableQTBar.element, 'mousedown', this.onMouseDown);
5871
+ EventHandler.remove(this.tableQTBar.element, 'keyup', this.keyUpQT);
5844
5872
  this.tableQTBar.destroy();
5845
5873
  }
5846
5874
  if (this.inlineQTBar) {
5847
5875
  EventHandler.remove(this.inlineQTBar.element, 'mousedown', this.onMouseDown);
5876
+ EventHandler.remove(this.inlineQTBar.element, 'keyup', this.keyUpQT);
5848
5877
  if (isIDevice()) {
5849
5878
  EventHandler.remove(document, 'selectionchange', this.selectionChangeHandler);
5850
5879
  }
@@ -14415,7 +14444,24 @@ class SelectionCommands {
14415
14444
  }
14416
14445
  }
14417
14446
  }
14418
- InsertMethods.unwrap(cursorFormat);
14447
+ if ((['fontcolor', 'fontname', 'fontsize', 'backgroundcolor'].indexOf(format) > -1)) {
14448
+ if (format === 'fontcolor') {
14449
+ cursorFormat.style.color = value;
14450
+ }
14451
+ else if (format === 'fontname') {
14452
+ cursorFormat.style.fontFamily = value;
14453
+ }
14454
+ else if (format === 'fontsize') {
14455
+ cursorFormat.style.fontSize = value;
14456
+ }
14457
+ else {
14458
+ cursorFormat.style.backgroundColor = value;
14459
+ }
14460
+ cursorNode = cursorFormat;
14461
+ }
14462
+ else {
14463
+ InsertMethods.unwrap(cursorFormat);
14464
+ }
14419
14465
  }
14420
14466
  else {
14421
14467
  if (cursorNodes.length > 1 && range.startOffset > 0 && (cursorNodes[0].firstElementChild &&
@@ -19376,7 +19422,8 @@ class Link {
19376
19422
  this.contentModule = this.rendererFactory.getRenderer(RenderType.Content);
19377
19423
  const isPopupOpen = this.quickToolObj.linkQTBar.element.classList.contains('e-rte-pop');
19378
19424
  if (target.nodeName === 'A' && (target.childNodes.length > 0 && target.childNodes[0].nodeName !== 'IMG') &&
19379
- e.args.target.nodeName !== 'IMG') {
19425
+ e.args.target.nodeName !== 'IMG' &&
19426
+ !isNullOrUndefined(closest(this.parent.getRange().startContainer.parentElement, 'A')) && !isNullOrUndefined(closest(this.parent.getRange().endContainer.parentElement, 'A'))) {
19380
19427
  if (isPopupOpen) {
19381
19428
  return;
19382
19429
  }
@@ -20551,7 +20598,7 @@ class Image {
20551
20598
  const target = args.target;
20552
20599
  this.contentModule = this.rendererFactory.getRenderer(RenderType.Content);
20553
20600
  const isPopupOpen = this.quickToolObj.imageQTBar.element.classList.contains('e-rte-pop');
20554
- if (target.nodeName === 'IMG' && this.parent.quickToolbarModule) {
20601
+ if (target.nodeName === 'IMG' && this.parent.quickToolbarModule && this.parent.getRange().startOffset === this.parent.getRange().endOffset) {
20555
20602
  if (isPopupOpen) {
20556
20603
  return;
20557
20604
  }
@@ -20788,13 +20835,34 @@ class Image {
20788
20835
  }
20789
20836
  }
20790
20837
  imageRemovePost(src) {
20838
+ const proxy = this;
20839
+ let absoluteUrl = '';
20840
+ if (src.indexOf('http://') > -1 || src.indexOf('https://') > -1) {
20841
+ absoluteUrl = src;
20842
+ }
20843
+ else {
20844
+ absoluteUrl = new URL(src, document.baseURI).href;
20845
+ }
20846
+ this.removingImgName = absoluteUrl.replace(/^.*[\\\/]/, '');
20847
+ const xhr = new XMLHttpRequest();
20848
+ xhr.addEventListener("readystatechange", function () {
20849
+ if (this.readyState == 4 && this.status == 200) {
20850
+ proxy.triggerPost(this.response);
20851
+ }
20852
+ });
20853
+ xhr.open('GET', absoluteUrl);
20854
+ xhr.responseType = 'blob';
20855
+ xhr.send();
20856
+ }
20857
+ triggerPost(response) {
20791
20858
  const removeUrl = this.parent.insertImageSettings.removeUrl;
20792
20859
  if (isNullOrUndefined(removeUrl) || removeUrl === '') {
20793
20860
  return;
20794
20861
  }
20862
+ const file = new File([response], this.removingImgName);
20795
20863
  const ajax = new Ajax(removeUrl, 'POST', true, null);
20796
20864
  const formData = new FormData();
20797
- formData.append(name, src);
20865
+ formData.append('UploadFiles', file);
20798
20866
  ajax.send(formData);
20799
20867
  }
20800
20868
  caption(e) {
@@ -22538,7 +22606,9 @@ class Table {
22538
22606
  }
22539
22607
  const range = this.parent.formatter.editorManager.nodeSelection.getRange(this.contentModule.getDocument());
22540
22608
  const closestTable = closest(target, 'table');
22541
- if (target && target.nodeName !== 'A' && target.nodeName !== 'IMG' && (target.nodeName === 'TD' || target.nodeName === 'TH' ||
22609
+ const startNode = this.parent.getRange().startContainer.parentElement;
22610
+ const endNode = this.parent.getRange().endContainer.parentElement;
22611
+ if (target && target.nodeName !== 'A' && target.nodeName !== 'IMG' && startNode === endNode && (target.nodeName === 'TD' || target.nodeName === 'TH' ||
22542
22612
  target.nodeName === 'TABLE' || (closestTable && this.parent.contentModule.getEditPanel().contains(closestTable)))
22543
22613
  && !(range.startContainer.nodeType === 3 && !range.collapsed)) {
22544
22614
  const range = this.parent.formatter.editorManager.nodeSelection.getRange(this.contentModule.getDocument());
@@ -22625,7 +22695,6 @@ class Table {
22625
22695
  tdNode : target;
22626
22696
  removeClass(this.contentModule.getEditPanel().querySelectorAll('table td, table th'), CLS_TABLE_SEL);
22627
22697
  if (target && (target.tagName === 'TD' || target.tagName === 'TH')) {
22628
- target.removeAttribute('class');
22629
22698
  addClass([target], CLS_TABLE_SEL);
22630
22699
  this.activeCell = target;
22631
22700
  this.curTable = (this.curTable) ? this.curTable : closest(target, 'table');
@@ -24073,6 +24142,7 @@ class EnterKeyAction {
24073
24142
  detach(nearBlockNode);
24074
24143
  }
24075
24144
  }
24145
+ this.parent.formatter.editorManager.nodeSelection.setCursorPoint(this.parent.contentModule.getDocument(), insertElem.nextElementSibling, 0);
24076
24146
  }
24077
24147
  else if (nearBlockNode.textContent.length === 0 && !(!isNullOrUndefined(nearBlockNode.childNodes[0]) && nearBlockNode.childNodes[0].nodeName === 'IMG')) {
24078
24148
  if (!isNullOrUndefined(nearBlockNode.children[0]) && nearBlockNode.children[0].tagName !== 'BR') {
@@ -25594,8 +25664,7 @@ let RichTextEditor = class RichTextEditor extends Component {
25594
25664
  this.setProperties({ value: this.valueTemplate });
25595
25665
  }
25596
25666
  else {
25597
- const compiledString = compile(this.valueTemplate);
25598
- const compiledTemplate = compiledString({});
25667
+ const compiledTemplate = compile(this.valueTemplate)('', this, 'valueTemplate');
25599
25668
  for (let i = 0; i < compiledTemplate.length; i++) {
25600
25669
  const item = compiledTemplate[i];
25601
25670
  append([item], this.element);