@syncfusion/ej2-richtexteditor 19.3.46 → 19.3.47

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.
@@ -5761,7 +5761,10 @@ class QuickToolbar {
5761
5761
  else {
5762
5762
  const closestAnchor = closest(target, 'a');
5763
5763
  target = closestAnchor ? closestAnchor : target;
5764
- if (target.tagName !== 'IMG' && target.tagName !== 'A' && (!closest(target, 'td,th') || !range.collapsed)) {
5764
+ const startNode = this.parent.getRange().startContainer.parentElement;
5765
+ const endNode = this.parent.getRange().endContainer.parentElement;
5766
+ if ((isNullOrUndefined(closest(startNode, 'A')) || isNullOrUndefined(closest(endNode, 'A'))) && (!closest(target, 'td,th') || !range.collapsed) &&
5767
+ (target.tagName !== 'IMG' || this.parent.getRange().startOffset !== this.parent.getRange().endOffset)) {
5765
5768
  if (this.parent.inlineMode.onSelection && range.collapsed) {
5766
5769
  return;
5767
5770
  }
@@ -14415,7 +14418,24 @@ class SelectionCommands {
14415
14418
  }
14416
14419
  }
14417
14420
  }
14418
- InsertMethods.unwrap(cursorFormat);
14421
+ if ((['fontcolor', 'fontname', 'fontsize', 'backgroundcolor'].indexOf(format) > -1)) {
14422
+ if (format === 'fontcolor') {
14423
+ cursorFormat.style.color = value;
14424
+ }
14425
+ else if (format === 'fontname') {
14426
+ cursorFormat.style.fontFamily = value;
14427
+ }
14428
+ else if (format === 'fontsize') {
14429
+ cursorFormat.style.fontSize = value;
14430
+ }
14431
+ else {
14432
+ cursorFormat.style.backgroundColor = value;
14433
+ }
14434
+ cursorNode = cursorFormat;
14435
+ }
14436
+ else {
14437
+ InsertMethods.unwrap(cursorFormat);
14438
+ }
14419
14439
  }
14420
14440
  else {
14421
14441
  if (cursorNodes.length > 1 && range.startOffset > 0 && (cursorNodes[0].firstElementChild &&
@@ -19376,7 +19396,8 @@ class Link {
19376
19396
  this.contentModule = this.rendererFactory.getRenderer(RenderType.Content);
19377
19397
  const isPopupOpen = this.quickToolObj.linkQTBar.element.classList.contains('e-rte-pop');
19378
19398
  if (target.nodeName === 'A' && (target.childNodes.length > 0 && target.childNodes[0].nodeName !== 'IMG') &&
19379
- e.args.target.nodeName !== 'IMG') {
19399
+ e.args.target.nodeName !== 'IMG' &&
19400
+ !isNullOrUndefined(closest(this.parent.getRange().startContainer.parentElement, 'A')) && !isNullOrUndefined(closest(this.parent.getRange().endContainer.parentElement, 'A'))) {
19380
19401
  if (isPopupOpen) {
19381
19402
  return;
19382
19403
  }
@@ -20551,7 +20572,7 @@ class Image {
20551
20572
  const target = args.target;
20552
20573
  this.contentModule = this.rendererFactory.getRenderer(RenderType.Content);
20553
20574
  const isPopupOpen = this.quickToolObj.imageQTBar.element.classList.contains('e-rte-pop');
20554
- if (target.nodeName === 'IMG' && this.parent.quickToolbarModule) {
20575
+ if (target.nodeName === 'IMG' && this.parent.quickToolbarModule && this.parent.getRange().startOffset === this.parent.getRange().endOffset) {
20555
20576
  if (isPopupOpen) {
20556
20577
  return;
20557
20578
  }
@@ -20788,13 +20809,34 @@ class Image {
20788
20809
  }
20789
20810
  }
20790
20811
  imageRemovePost(src) {
20812
+ const proxy = this;
20813
+ let absoluteUrl = '';
20814
+ if (src.indexOf('http://') > -1 || src.indexOf('https://') > -1) {
20815
+ absoluteUrl = src;
20816
+ }
20817
+ else {
20818
+ absoluteUrl = new URL(src, document.baseURI).href;
20819
+ }
20820
+ this.removingImgName = absoluteUrl.replace(/^.*[\\\/]/, '');
20821
+ const xhr = new XMLHttpRequest();
20822
+ xhr.addEventListener("readystatechange", function () {
20823
+ if (this.readyState == 4 && this.status == 200) {
20824
+ proxy.triggerPost(this.response);
20825
+ }
20826
+ });
20827
+ xhr.open('GET', absoluteUrl);
20828
+ xhr.responseType = 'blob';
20829
+ xhr.send();
20830
+ }
20831
+ triggerPost(response) {
20791
20832
  const removeUrl = this.parent.insertImageSettings.removeUrl;
20792
20833
  if (isNullOrUndefined(removeUrl) || removeUrl === '') {
20793
20834
  return;
20794
20835
  }
20836
+ const file = new File([response], this.removingImgName);
20795
20837
  const ajax = new Ajax(removeUrl, 'POST', true, null);
20796
20838
  const formData = new FormData();
20797
- formData.append(name, src);
20839
+ formData.append('UploadFiles', file);
20798
20840
  ajax.send(formData);
20799
20841
  }
20800
20842
  caption(e) {
@@ -22538,7 +22580,9 @@ class Table {
22538
22580
  }
22539
22581
  const range = this.parent.formatter.editorManager.nodeSelection.getRange(this.contentModule.getDocument());
22540
22582
  const closestTable = closest(target, 'table');
22541
- if (target && target.nodeName !== 'A' && target.nodeName !== 'IMG' && (target.nodeName === 'TD' || target.nodeName === 'TH' ||
22583
+ const startNode = this.parent.getRange().startContainer.parentElement;
22584
+ const endNode = this.parent.getRange().endContainer.parentElement;
22585
+ if (target && target.nodeName !== 'A' && target.nodeName !== 'IMG' && startNode === endNode && (target.nodeName === 'TD' || target.nodeName === 'TH' ||
22542
22586
  target.nodeName === 'TABLE' || (closestTable && this.parent.contentModule.getEditPanel().contains(closestTable)))
22543
22587
  && !(range.startContainer.nodeType === 3 && !range.collapsed)) {
22544
22588
  const range = this.parent.formatter.editorManager.nodeSelection.getRange(this.contentModule.getDocument());
@@ -22625,7 +22669,6 @@ class Table {
22625
22669
  tdNode : target;
22626
22670
  removeClass(this.contentModule.getEditPanel().querySelectorAll('table td, table th'), CLS_TABLE_SEL);
22627
22671
  if (target && (target.tagName === 'TD' || target.tagName === 'TH')) {
22628
- target.removeAttribute('class');
22629
22672
  addClass([target], CLS_TABLE_SEL);
22630
22673
  this.activeCell = target;
22631
22674
  this.curTable = (this.curTable) ? this.curTable : closest(target, 'table');