@forgeroute/ui 0.5.36 → 0.5.38

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.
@@ -2577,8 +2577,14 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2577
2577
  this.runEditCommand(() => {
2578
2578
  document.execCommand(cmd, false, value ?? void 0);
2579
2579
  });
2580
+ if (cmd === "insertUnorderedList" || cmd === "insertOrderedList") this.styleNewLists();
2580
2581
  this.syncBlock();
2581
2582
  }
2583
+ styleNewLists() {
2584
+ (this.editorFor(this.selectedBlockId())?.nativeElement)?.querySelectorAll("ul:not([style]), ol:not([style])").forEach((list) => {
2585
+ list.setAttribute("style", `list-style-type:${list.tagName === "OL" ? "decimal" : "disc"};padding-left:40px;margin:1em 0`);
2586
+ });
2587
+ }
2582
2588
  onHeading(value) {
2583
2589
  this.execCommand("formatBlock", value);
2584
2590
  this.headingKey.update((k) => k + 1);
@@ -2636,6 +2642,14 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2636
2642
  } : b));
2637
2643
  if (changed) this.bodyEdited.set(true);
2638
2644
  }
2645
+ anchorAtSelection() {
2646
+ const sel = window.getSelection();
2647
+ if (!sel || sel.rangeCount === 0) return null;
2648
+ const range = sel.getRangeAt(0);
2649
+ const anchorOf = (node) => (node instanceof Element ? node : node.parentElement)?.closest("a") ?? null;
2650
+ const start = anchorOf(range.startContainer);
2651
+ return start && start === anchorOf(range.endContainer) && insideEditorBlock(start) ? start : null;
2652
+ }
2639
2653
  openLinkDialog() {
2640
2654
  if (!this.canWrite()) return;
2641
2655
  this.saveSelection();
@@ -2650,6 +2664,16 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
2650
2664
  this.bodyEdited.set(true);
2651
2665
  const url = this.normalizedLink();
2652
2666
  this.restoreSelection();
2667
+ const existing = this.anchorAtSelection();
2668
+ if (existing) {
2669
+ existing.setAttribute("href", url);
2670
+ existing.setAttribute("target", "_blank");
2671
+ this.syncBlock();
2672
+ this.showLinkDialog.set(false);
2673
+ this.linkUrl.set("");
2674
+ this.linkText.set("");
2675
+ return;
2676
+ }
2653
2677
  const sel = window.getSelection();
2654
2678
  if (sel && sel.rangeCount > 0 && !sel.isCollapsed) {
2655
2679
  document.execCommand("createLink", false, url);