@forgeroute/ui 0.5.36 → 0.5.37
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.
- package/fesm2022/forgeroute-ui-editor.mjs +18 -0
- package/fesm2022/forgeroute-ui-editor.mjs.map +1 -1
- package/package.json +1 -1
- package/types/forgeroute-ui-conversations.d.ts +1 -1
- package/types/forgeroute-ui-editor.d.ts +2 -0
- package/types/forgeroute-ui-messaging.d.ts +5 -5
- package/types/forgeroute-ui-payments.d.ts +1 -1
- package/types/forgeroute-ui-quickbooks.d.ts +1 -1
- package/types/forgeroute-ui-square.d.ts +2 -2
- package/types/forgeroute-ui-stripe.d.ts +1 -1
|
@@ -2636,6 +2636,14 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
|
|
|
2636
2636
|
} : b));
|
|
2637
2637
|
if (changed) this.bodyEdited.set(true);
|
|
2638
2638
|
}
|
|
2639
|
+
anchorAtSelection() {
|
|
2640
|
+
const sel = window.getSelection();
|
|
2641
|
+
if (!sel || sel.rangeCount === 0) return null;
|
|
2642
|
+
const range = sel.getRangeAt(0);
|
|
2643
|
+
const anchorOf = (node) => (node instanceof Element ? node : node.parentElement)?.closest("a") ?? null;
|
|
2644
|
+
const start = anchorOf(range.startContainer);
|
|
2645
|
+
return start && start === anchorOf(range.endContainer) && insideEditorBlock(start) ? start : null;
|
|
2646
|
+
}
|
|
2639
2647
|
openLinkDialog() {
|
|
2640
2648
|
if (!this.canWrite()) return;
|
|
2641
2649
|
this.saveSelection();
|
|
@@ -2650,6 +2658,16 @@ var EmailTemplateEditorComponent = class EmailTemplateEditorComponent {
|
|
|
2650
2658
|
this.bodyEdited.set(true);
|
|
2651
2659
|
const url = this.normalizedLink();
|
|
2652
2660
|
this.restoreSelection();
|
|
2661
|
+
const existing = this.anchorAtSelection();
|
|
2662
|
+
if (existing) {
|
|
2663
|
+
existing.setAttribute("href", url);
|
|
2664
|
+
existing.setAttribute("target", "_blank");
|
|
2665
|
+
this.syncBlock();
|
|
2666
|
+
this.showLinkDialog.set(false);
|
|
2667
|
+
this.linkUrl.set("");
|
|
2668
|
+
this.linkText.set("");
|
|
2669
|
+
return;
|
|
2670
|
+
}
|
|
2653
2671
|
const sel = window.getSelection();
|
|
2654
2672
|
if (sel && sel.rangeCount > 0 && !sel.isCollapsed) {
|
|
2655
2673
|
document.execCommand("createLink", false, url);
|