@yoamigo.com/core 0.4.3 → 0.4.5
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/dist/{content-helpers-kWphH5Tn.d.ts → content-helpers-DOUKazMz.d.ts} +3 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +214 -122
- package/dist/lib.js +23 -1
- package/dist/prod.d.ts +1 -1
- package/package.json +1 -1
|
@@ -150,6 +150,8 @@ interface YaLinkProps {
|
|
|
150
150
|
/** Default href if not set in content store */
|
|
151
151
|
href?: string;
|
|
152
152
|
className?: string;
|
|
153
|
+
/** Classes to apply to the wrapper span (for display/width control) */
|
|
154
|
+
wrapperClassName?: string;
|
|
153
155
|
/** Inline styles to apply to the link element */
|
|
154
156
|
style?: React$1.CSSProperties;
|
|
155
157
|
as?: 'a' | 'span';
|
|
@@ -175,7 +177,7 @@ declare module '@tiptap/core' {
|
|
|
175
177
|
};
|
|
176
178
|
}
|
|
177
179
|
}
|
|
178
|
-
declare function YaLink({ fieldId, href: defaultHref, className, style, as: Component, children, availablePages, onClick, target, rel }: YaLinkProps): react_jsx_runtime.JSX.Element;
|
|
180
|
+
declare function YaLink({ fieldId, href: defaultHref, className, wrapperClassName, style, as: Component, children, availablePages, onClick, target, rel }: YaLinkProps): react_jsx_runtime.JSX.Element;
|
|
179
181
|
|
|
180
182
|
interface BackgroundImageConfig {
|
|
181
183
|
src: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React$1, { ReactNode } from 'react';
|
|
3
|
-
export { D as BackgroundConfig, F as BackgroundImageConfig, C as ContentStoreProviderProd, q as EmbedFieldValue, r as EmbedType, I as ImageFieldValue, f as MarkdownText, g as MarkdownTextProps, O as OverlayConfig, P as PageInfo, c as StaticImage, d as StaticImageProps, M as StaticText, S as StaticTextProps, V as VideoFieldValue, y as YaContainer, B as YaContainerProps, m as YaEmbed, o as YaEmbedProps, Y as YaImage, h as YaImageProps, w as YaLink, x as YaLinkProps, j as YaVideo, l as YaVideoProps, b as background, e as embed, i as image, z as parseBackgroundConfig, p as parseEmbedUrl, A as serializeBackgroundConfig, n as serializeEmbedValue, s as serializeImageValue, k as serializeVideoValue, t as text, u as useContentStoreProd, v as video } from './content-helpers-
|
|
3
|
+
export { D as BackgroundConfig, F as BackgroundImageConfig, C as ContentStoreProviderProd, q as EmbedFieldValue, r as EmbedType, I as ImageFieldValue, f as MarkdownText, g as MarkdownTextProps, O as OverlayConfig, P as PageInfo, c as StaticImage, d as StaticImageProps, M as StaticText, S as StaticTextProps, V as VideoFieldValue, y as YaContainer, B as YaContainerProps, m as YaEmbed, o as YaEmbedProps, Y as YaImage, h as YaImageProps, w as YaLink, x as YaLinkProps, j as YaVideo, l as YaVideoProps, b as background, e as embed, i as image, z as parseBackgroundConfig, p as parseEmbedUrl, A as serializeBackgroundConfig, n as serializeEmbedValue, s as serializeImageValue, k as serializeVideoValue, t as text, u as useContentStoreProd, v as video } from './content-helpers-DOUKazMz.js';
|
|
4
4
|
export { Link, LinkProps, NavigateFunction, Router, RouterProps, ScrollRestoration, useNavigate } from './router.js';
|
|
5
5
|
export { Route, Switch, useParams } from 'wouter';
|
|
6
6
|
export { A as AssetResolverFn, C as ContentRegistry, c as contentRegistry, a as getAllContent, g as getContent, h as hasContent, r as registerContent, b as resolveAssetUrl, s as setAssetResolver } from './asset-resolver-BnIvDkVv.js';
|
package/dist/index.js
CHANGED
|
@@ -753,8 +753,30 @@ var BuilderSelectionManager = class {
|
|
|
753
753
|
scale: 1,
|
|
754
754
|
logging: false,
|
|
755
755
|
useCORS: true,
|
|
756
|
-
backgroundColor: null
|
|
756
|
+
backgroundColor: null,
|
|
757
757
|
// Preserve transparency if any
|
|
758
|
+
windowHeight: document.body.scrollHeight,
|
|
759
|
+
// Full page height
|
|
760
|
+
height: document.body.scrollHeight,
|
|
761
|
+
// Full page height
|
|
762
|
+
scrollX: 0,
|
|
763
|
+
// Render from left (no visible scroll)
|
|
764
|
+
scrollY: 0,
|
|
765
|
+
// Render from top (no visible scroll)
|
|
766
|
+
onclone: async (clonedDoc) => {
|
|
767
|
+
clonedDoc.querySelectorAll('img[loading="lazy"]').forEach((img) => {
|
|
768
|
+
img.removeAttribute("loading");
|
|
769
|
+
});
|
|
770
|
+
await Promise.all(
|
|
771
|
+
Array.from(clonedDoc.querySelectorAll("img")).map(
|
|
772
|
+
(img) => img.complete && img.naturalHeight !== 0 ? Promise.resolve() : new Promise((r) => {
|
|
773
|
+
img.onload = r;
|
|
774
|
+
img.onerror = r;
|
|
775
|
+
})
|
|
776
|
+
)
|
|
777
|
+
);
|
|
778
|
+
await clonedDoc.fonts?.ready;
|
|
779
|
+
}
|
|
758
780
|
});
|
|
759
781
|
overlays.forEach((el) => {
|
|
760
782
|
;
|
|
@@ -5213,7 +5235,7 @@ function TwitterWidgetLoader() {
|
|
|
5213
5235
|
}
|
|
5214
5236
|
|
|
5215
5237
|
// src/components/YaLink.tsx
|
|
5216
|
-
import { useEffect as useEffect15, useRef as useRef16, useState as useState15, useCallback as useCallback17, useId } from "react";
|
|
5238
|
+
import { useEffect as useEffect15, useLayoutEffect as useLayoutEffect3, useRef as useRef16, useState as useState15, useCallback as useCallback17, useId } from "react";
|
|
5217
5239
|
import { createPortal as createPortal6 } from "react-dom";
|
|
5218
5240
|
import { useEditor as useEditor2, EditorContent as EditorContent2 } from "@tiptap/react";
|
|
5219
5241
|
import { BubbleMenu } from "@tiptap/react/menus";
|
|
@@ -5366,7 +5388,7 @@ function useSafeTriangle(options = {}) {
|
|
|
5366
5388
|
}
|
|
5367
5389
|
|
|
5368
5390
|
// src/components/ya-link.css
|
|
5369
|
-
styleInject('.ya-link-wrapper {\n position: relative;\n display: inline;\n}\n.ya-link-editable {\n cursor: pointer;\n transition: outline 0.15s ease;\n}\n.ya-link-editable:hover {\n outline: 2px dashed var(--color-primary, #D4A574);\n outline-offset: 4px;\n border-radius: 4px;\n}\nbody.builder-selector-active .ya-link-editable:hover {\n outline: none;\n cursor: inherit;\n}\n.ya-link-editing {\n outline: 2px solid var(--color-primary, #D4A574);\n outline-offset: 4px;\n border-radius: 4px;\n position: relative;\n}\n.ya-link-editing .ProseMirror {\n color: #1a1a1a !important;\n caret-color: #1a1a1a;\n}\n.ya-link-editing .ProseMirror p::selection,\n.ya-link-editing .ProseMirror::selection {\n background-color: rgba(212, 165, 116, 0.4);\n color: inherit;\n}\n.ya-link-editing .ProseMirror p::-moz-selection,\n.ya-link-editing .ProseMirror::-moz-selection {\n background-color: rgba(212, 165, 116, 0.4);\n color: inherit;\n}\n.ProseMirror-gapcursor {\n display: none !important;\n}\n.ProseMirror .ProseMirror-dropcursor {\n display: none !important;\n}\nbody.builder-selector-active .ya-link-editable:not(.ya-link-editing)::selection,\nbody.builder-selector-active .ya-link-editable:not(.ya-link-editing) *::selection {\n color: inherit;\n}\nbody.builder-selector-active .ya-link-editable:not(.ya-link-editing)::-moz-selection,\nbody.builder-selector-active .ya-link-editable:not(.ya-link-editing) *::-moz-selection {\n color: inherit;\n}\n.ya-link-actions {\n display: flex;\n gap: 8px;\n z-index: 9999;\n background: rgba(26, 26, 26, 0.95);\n padding: 8px 10px;\n border-radius: 8px;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n font-family:\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n sans-serif;\n}\n.ya-link-btn {\n padding: 6px 14px;\n font-size: 12px;\n font-weight: 500;\n border-radius: 6px;\n cursor: pointer;\n transition: all 0.15s ease;\n border: none;\n}\n.ya-link-btn-cancel {\n background: #333333;\n color: #ffffff;\n border: 1px solid #555555;\n}\n.ya-link-btn-cancel:hover {\n background: #444444;\n color: #ffffff;\n border-color: #666666;\n}\n.ya-link-btn-save {\n background: #D4A574;\n color: #1a1a1a;\n}\n.ya-link-btn-save:hover {\n background: #c4956a;\n}\n.ya-href-popover {\n position:
|
|
5391
|
+
styleInject('.ya-link-wrapper {\n position: relative;\n display: inline;\n}\n.ya-link-editable {\n cursor: pointer;\n transition: outline 0.15s ease;\n}\n.ya-link-editable:hover {\n outline: 2px dashed var(--color-primary, #D4A574);\n outline-offset: 4px;\n border-radius: 4px;\n}\nbody.builder-selector-active .ya-link-editable:hover {\n outline: none;\n cursor: inherit;\n}\n.ya-link-editing {\n outline: 2px solid var(--color-primary, #D4A574);\n outline-offset: 4px;\n border-radius: 4px;\n position: relative;\n}\n.ya-link-editing .ProseMirror {\n color: #1a1a1a !important;\n caret-color: #1a1a1a;\n}\n.ya-link-editing .ProseMirror p::selection,\n.ya-link-editing .ProseMirror::selection {\n background-color: rgba(212, 165, 116, 0.4);\n color: inherit;\n}\n.ya-link-editing .ProseMirror p::-moz-selection,\n.ya-link-editing .ProseMirror::-moz-selection {\n background-color: rgba(212, 165, 116, 0.4);\n color: inherit;\n}\n.ProseMirror-gapcursor {\n display: none !important;\n}\n.ProseMirror .ProseMirror-dropcursor {\n display: none !important;\n}\nbody.builder-selector-active .ya-link-editable:not(.ya-link-editing)::selection,\nbody.builder-selector-active .ya-link-editable:not(.ya-link-editing) *::selection {\n color: inherit;\n}\nbody.builder-selector-active .ya-link-editable:not(.ya-link-editing)::-moz-selection,\nbody.builder-selector-active .ya-link-editable:not(.ya-link-editing) *::-moz-selection {\n color: inherit;\n}\n.ya-link-actions {\n display: flex;\n gap: 8px;\n z-index: 9999;\n background: rgba(26, 26, 26, 0.95);\n padding: 8px 10px;\n border-radius: 8px;\n box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);\n font-family:\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n sans-serif;\n}\n.ya-link-btn {\n padding: 6px 14px;\n font-size: 12px;\n font-weight: 500;\n border-radius: 6px;\n cursor: pointer;\n transition: all 0.15s ease;\n border: none;\n}\n.ya-link-btn-cancel {\n background: #333333;\n color: #ffffff;\n border: 1px solid #555555;\n}\n.ya-link-btn-cancel:hover {\n background: #444444;\n color: #ffffff;\n border-color: #666666;\n}\n.ya-link-btn-save {\n background: #D4A574;\n color: #1a1a1a;\n}\n.ya-link-btn-save:hover {\n background: #c4956a;\n}\n.ya-href-popover {\n position: fixed;\n z-index: 10000;\n min-width: 280px;\n max-width: 320px;\n background: #1a1a1a;\n border-radius: 12px;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);\n animation: ya-href-popover-fade-in 0.15s ease;\n overflow: hidden;\n font-family:\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n sans-serif;\n}\n@keyframes ya-href-popover-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n.ya-href-popover::before {\n content: "";\n position: absolute;\n top: -6px;\n left: 50%;\n transform: translateX(-50%);\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n border-bottom: 8px solid #1a1a1a;\n}\n.ya-href-popover-header {\n padding: 12px 16px;\n font-size: 13px;\n font-weight: 600;\n color: #ffffff;\n border-bottom: 1px solid rgba(255, 255, 255, 0.1);\n}\n.ya-href-popover-section {\n padding: 12px 16px;\n}\n.ya-href-popover-label {\n display: block;\n font-size: 11px;\n font-weight: 500;\n color: rgba(255, 255, 255, 0.6);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n margin-bottom: 8px;\n}\n.ya-href-collapsible-header {\n display: flex;\n align-items: center;\n gap: 6px;\n width: 100%;\n padding: 0;\n background: transparent;\n border: none;\n cursor: pointer;\n transition: color 0.15s ease;\n}\n.ya-href-collapsible-header:hover {\n color: rgba(255, 255, 255, 0.8);\n}\n.ya-href-chevron {\n font-size: 8px;\n color: rgba(255, 255, 255, 0.4);\n}\n.ya-href-popover-pages {\n display: flex;\n flex-direction: column;\n gap: 4px;\n max-height: 200px;\n overflow-y: auto;\n}\n.ya-href-page-btn {\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n width: 100%;\n padding: 10px 12px;\n background: rgba(255, 255, 255, 0.05);\n border: 1px solid transparent;\n border-radius: 8px;\n color: #e0e0e0;\n font-size: 13px;\n font-weight: 500;\n text-align: left;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n.ya-href-page-btn:hover {\n background: rgba(255, 255, 255, 0.1);\n border-color: rgba(255, 255, 255, 0.2);\n}\n.ya-href-page-btn.is-selected {\n background: #D4A574;\n color: #1a1a1a;\n}\n.ya-href-page-btn.is-selected .ya-href-page-path {\n color: rgba(26, 26, 26, 0.6);\n}\n.ya-href-page-path {\n font-size: 11px;\n color: rgba(255, 255, 255, 0.4);\n font-family: monospace;\n word-break: break-all;\n}\n.ya-href-external-toggle {\n display: block;\n width: 100%;\n padding: 10px 16px;\n background: transparent;\n border: none;\n border-top: 1px solid rgba(255, 255, 255, 0.1);\n color: #D4A574;\n font-size: 12px;\n font-weight: 500;\n text-align: center;\n cursor: pointer;\n transition: background 0.15s ease;\n}\n.ya-href-external-toggle:hover {\n background: rgba(255, 255, 255, 0.05);\n}\n.ya-href-url-input {\n width: 100%;\n padding: 10px 12px;\n background: rgba(255, 255, 255, 0.05);\n border: 1px solid rgba(255, 255, 255, 0.2);\n border-radius: 8px;\n color: #ffffff;\n font-size: 13px;\n outline: none;\n transition: border-color 0.15s ease;\n}\n.ya-href-url-input::placeholder {\n color: rgba(255, 255, 255, 0.4);\n}\n.ya-href-url-input:focus {\n border-color: var(--color-primary, #D4A574);\n}\n.ya-href-popover-actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n padding: 12px 16px;\n border-top: 1px solid rgba(255, 255, 255, 0.1);\n}\n.ya-href-popover--above {\n animation: ya-href-popover-fade-in-above 0.15s ease;\n}\n@keyframes ya-href-popover-fade-in-above {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n}\n.ya-href-popover--above::before {\n top: auto;\n bottom: -6px;\n border-bottom: none;\n border-top: 8px solid #1a1a1a;\n}\n.ya-link-edit-popover {\n position: fixed;\n z-index: 10000;\n background: #2a2a2a;\n border-radius: 6px;\n padding: 4px;\n display: flex;\n gap: 4px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);\n transition: opacity 100ms ease;\n font-family:\n system-ui,\n -apple-system,\n BlinkMacSystemFont,\n "Segoe UI",\n sans-serif;\n white-space: nowrap;\n}\n.ya-link-edit-popover::before {\n content: "";\n position: absolute;\n top: -5px;\n left: 50%;\n transform: translateX(-50%);\n border-left: 6px solid transparent;\n border-right: 6px solid transparent;\n border-bottom: 6px solid #2a2a2a;\n}\n.ya-link-edit-popover button {\n background: #3a3a3a;\n border: none;\n color: #fff;\n padding: 6px 12px;\n border-radius: 4px;\n cursor: pointer;\n font-size: 13px;\n font-weight: 500;\n transition: background 0.15s ease;\n}\n.ya-link-edit-popover button:hover {\n background: #4a4a4a;\n}\n');
|
|
5370
5392
|
|
|
5371
5393
|
// src/components/YaLink.tsx
|
|
5372
5394
|
import { Fragment as Fragment4, jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
@@ -5466,7 +5488,7 @@ function discoverSectionsFromDOM() {
|
|
|
5466
5488
|
});
|
|
5467
5489
|
return sections;
|
|
5468
5490
|
}
|
|
5469
|
-
function YaLink({ fieldId, href: defaultHref = "#", className, style, as: Component = "a", children, availablePages, onClick, target, rel }) {
|
|
5491
|
+
function YaLink({ fieldId, href: defaultHref = "#", className, wrapperClassName, style, as: Component = "a", children, availablePages, onClick, target, rel }) {
|
|
5470
5492
|
const { getValue, setValue, mode, saveToWorker, getPages } = useContentStore();
|
|
5471
5493
|
const [, navigate] = useLocation();
|
|
5472
5494
|
const pages = availablePages ?? getPages();
|
|
@@ -5488,10 +5510,13 @@ function YaLink({ fieldId, href: defaultHref = "#", className, style, as: Compon
|
|
|
5488
5510
|
const [currentHref, setCurrentHref] = useState15(href);
|
|
5489
5511
|
const [isExternalUrl, setIsExternalUrl] = useState15(false);
|
|
5490
5512
|
const [externalUrl, setExternalUrl] = useState15("");
|
|
5491
|
-
const [popoverPosition, setPopoverPosition] = useState15("below");
|
|
5492
5513
|
const containerRef = useRef16(null);
|
|
5493
5514
|
const hrefPopoverRef = useRef16(null);
|
|
5494
5515
|
const [actionButtonsPos, setActionButtonsPos] = useState15(null);
|
|
5516
|
+
const [editPopoverPos, setEditPopoverPos] = useState15(null);
|
|
5517
|
+
const [editPopoverVisible, setEditPopoverVisible] = useState15(false);
|
|
5518
|
+
const [editPopoverMounted, setEditPopoverMounted] = useState15(false);
|
|
5519
|
+
const [hrefPopoverPos, setHrefPopoverPos] = useState15(null);
|
|
5495
5520
|
const handleSaveTextRef = useRef16(() => {
|
|
5496
5521
|
});
|
|
5497
5522
|
const handleCancelTextRef = useRef16(() => {
|
|
@@ -5600,6 +5625,68 @@ function YaLink({ fieldId, href: defaultHref = "#", className, style, as: Compon
|
|
|
5600
5625
|
window.removeEventListener("resize", updatePosition);
|
|
5601
5626
|
};
|
|
5602
5627
|
}, [editingMode]);
|
|
5628
|
+
useEffect15(() => {
|
|
5629
|
+
const shouldShow = showEditPopover && !editingMode && mode === "inline-edit";
|
|
5630
|
+
if (shouldShow) {
|
|
5631
|
+
setEditPopoverMounted(true);
|
|
5632
|
+
requestAnimationFrame(() => {
|
|
5633
|
+
setEditPopoverVisible(true);
|
|
5634
|
+
});
|
|
5635
|
+
} else {
|
|
5636
|
+
setEditPopoverVisible(false);
|
|
5637
|
+
const timer = setTimeout(() => {
|
|
5638
|
+
setEditPopoverMounted(false);
|
|
5639
|
+
}, 100);
|
|
5640
|
+
return () => clearTimeout(timer);
|
|
5641
|
+
}
|
|
5642
|
+
}, [showEditPopover, editingMode, mode]);
|
|
5643
|
+
useLayoutEffect3(() => {
|
|
5644
|
+
if (!editPopoverMounted || !containerRef.current) {
|
|
5645
|
+
setEditPopoverPos(null);
|
|
5646
|
+
return;
|
|
5647
|
+
}
|
|
5648
|
+
const updatePosition = () => {
|
|
5649
|
+
if (!containerRef.current) return;
|
|
5650
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
5651
|
+
setEditPopoverPos({
|
|
5652
|
+
top: rect.bottom + 8,
|
|
5653
|
+
left: rect.left + rect.width / 2
|
|
5654
|
+
});
|
|
5655
|
+
};
|
|
5656
|
+
updatePosition();
|
|
5657
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
5658
|
+
window.addEventListener("resize", updatePosition);
|
|
5659
|
+
return () => {
|
|
5660
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
5661
|
+
window.removeEventListener("resize", updatePosition);
|
|
5662
|
+
};
|
|
5663
|
+
}, [editPopoverMounted]);
|
|
5664
|
+
useLayoutEffect3(() => {
|
|
5665
|
+
if (editingMode !== "link" || !containerRef.current) {
|
|
5666
|
+
setHrefPopoverPos(null);
|
|
5667
|
+
return;
|
|
5668
|
+
}
|
|
5669
|
+
const updatePosition = () => {
|
|
5670
|
+
if (!containerRef.current) return;
|
|
5671
|
+
const rect = containerRef.current.getBoundingClientRect();
|
|
5672
|
+
const popoverHeight = 350;
|
|
5673
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
5674
|
+
const spaceAbove = rect.top;
|
|
5675
|
+
const isAbove = spaceBelow < popoverHeight && spaceAbove > spaceBelow;
|
|
5676
|
+
setHrefPopoverPos({
|
|
5677
|
+
top: isAbove ? rect.top - 8 : rect.bottom + 8,
|
|
5678
|
+
left: rect.left + rect.width / 2,
|
|
5679
|
+
isAbove
|
|
5680
|
+
});
|
|
5681
|
+
};
|
|
5682
|
+
updatePosition();
|
|
5683
|
+
window.addEventListener("scroll", updatePosition, true);
|
|
5684
|
+
window.addEventListener("resize", updatePosition);
|
|
5685
|
+
return () => {
|
|
5686
|
+
window.removeEventListener("scroll", updatePosition, true);
|
|
5687
|
+
window.removeEventListener("resize", updatePosition);
|
|
5688
|
+
};
|
|
5689
|
+
}, [editingMode]);
|
|
5603
5690
|
useEffect15(() => {
|
|
5604
5691
|
if (editingMode !== "link") return;
|
|
5605
5692
|
const handleClickOutside = (event) => {
|
|
@@ -5614,19 +5701,6 @@ function YaLink({ fieldId, href: defaultHref = "#", className, style, as: Compon
|
|
|
5614
5701
|
document.addEventListener("mousedown", handleClickOutside);
|
|
5615
5702
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
5616
5703
|
}, [editingMode, originalHref]);
|
|
5617
|
-
useEffect15(() => {
|
|
5618
|
-
if (editingMode !== "link" || !containerRef.current) return;
|
|
5619
|
-
const updatePosition = () => {
|
|
5620
|
-
if (!containerRef.current) return;
|
|
5621
|
-
const rect = containerRef.current.getBoundingClientRect();
|
|
5622
|
-
const popoverHeight = 350;
|
|
5623
|
-
const spaceBelow = window.innerHeight - rect.bottom;
|
|
5624
|
-
const spaceAbove = rect.top;
|
|
5625
|
-
setPopoverPosition(spaceBelow < popoverHeight && spaceAbove > spaceBelow ? "above" : "below");
|
|
5626
|
-
};
|
|
5627
|
-
window.addEventListener("resize", updatePosition);
|
|
5628
|
-
return () => window.removeEventListener("resize", updatePosition);
|
|
5629
|
-
}, [editingMode]);
|
|
5630
5704
|
const handleSaveText = useCallback17(() => {
|
|
5631
5705
|
if (!editor) return;
|
|
5632
5706
|
let html = editor.getHTML();
|
|
@@ -5710,13 +5784,6 @@ function YaLink({ fieldId, href: defaultHref = "#", className, style, as: Compon
|
|
|
5710
5784
|
setOriginalHref(href);
|
|
5711
5785
|
setCurrentHref(href);
|
|
5712
5786
|
setSections(discoverSectionsFromDOM());
|
|
5713
|
-
if (containerRef.current) {
|
|
5714
|
-
const rect = containerRef.current.getBoundingClientRect();
|
|
5715
|
-
const popoverHeight = 350;
|
|
5716
|
-
const spaceBelow = window.innerHeight - rect.bottom;
|
|
5717
|
-
const spaceAbove = rect.top;
|
|
5718
|
-
setPopoverPosition(spaceBelow < popoverHeight && spaceAbove > spaceBelow ? "above" : "below");
|
|
5719
|
-
}
|
|
5720
5787
|
}, [href, hideEditPopover]);
|
|
5721
5788
|
const handleKeyDown = useCallback17(
|
|
5722
5789
|
(event) => {
|
|
@@ -5812,7 +5879,7 @@ function YaLink({ fieldId, href: defaultHref = "#", className, style, as: Compon
|
|
|
5812
5879
|
}
|
|
5813
5880
|
);
|
|
5814
5881
|
}
|
|
5815
|
-
return /* @__PURE__ */ jsxs9("span", { className:
|
|
5882
|
+
return /* @__PURE__ */ jsxs9("span", { className: `ya-link-wrapper ${wrapperClassName || ""}`, children: [
|
|
5816
5883
|
/* @__PURE__ */ jsx15(
|
|
5817
5884
|
Component,
|
|
5818
5885
|
{
|
|
@@ -5918,18 +5985,27 @@ function YaLink({ fieldId, href: defaultHref = "#", className, style, as: Compon
|
|
|
5918
5985
|
] }) : /* @__PURE__ */ jsx15(SafeHtml, { content: text2, mode })
|
|
5919
5986
|
}
|
|
5920
5987
|
),
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5988
|
+
editPopoverMounted && editPopoverPos && createPortal6(
|
|
5989
|
+
/* @__PURE__ */ jsxs9(
|
|
5990
|
+
"div",
|
|
5991
|
+
{
|
|
5992
|
+
ref: editPopoverRef,
|
|
5993
|
+
className: "ya-link-edit-popover",
|
|
5994
|
+
style: {
|
|
5995
|
+
top: editPopoverPos.top,
|
|
5996
|
+
left: editPopoverPos.left,
|
|
5997
|
+
transform: "translateX(-50%)",
|
|
5998
|
+
opacity: editPopoverVisible ? 1 : 0
|
|
5999
|
+
},
|
|
6000
|
+
onMouseEnter: safeTriangleHandlers.onMouseEnter,
|
|
6001
|
+
onMouseLeave: safeTriangleHandlers.onMouseLeave,
|
|
6002
|
+
children: [
|
|
6003
|
+
/* @__PURE__ */ jsx15("button", { type: "button", onClick: startEditText, children: "Edit text" }),
|
|
6004
|
+
/* @__PURE__ */ jsx15("button", { type: "button", onClick: startEditLink, children: "Edit link" })
|
|
6005
|
+
]
|
|
6006
|
+
}
|
|
6007
|
+
),
|
|
6008
|
+
document.body
|
|
5933
6009
|
),
|
|
5934
6010
|
/* @__PURE__ */ jsx15(
|
|
5935
6011
|
SafeTriangleBelow,
|
|
@@ -5941,88 +6017,104 @@ function YaLink({ fieldId, href: defaultHref = "#", className, style, as: Compon
|
|
|
5941
6017
|
onStayInside: triangleProps.onStayInside
|
|
5942
6018
|
}
|
|
5943
6019
|
),
|
|
5944
|
-
editingMode === "link" &&
|
|
5945
|
-
/* @__PURE__ */
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
|
|
5984
|
-
|
|
5985
|
-
|
|
5986
|
-
|
|
5987
|
-
]
|
|
5988
|
-
|
|
5989
|
-
|
|
5990
|
-
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5994
|
-
|
|
5995
|
-
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
|
|
5999
|
-
|
|
6000
|
-
|
|
6001
|
-
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
}
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
|
|
6020
|
+
editingMode === "link" && hrefPopoverPos && createPortal6(
|
|
6021
|
+
/* @__PURE__ */ jsxs9(
|
|
6022
|
+
"div",
|
|
6023
|
+
{
|
|
6024
|
+
ref: hrefPopoverRef,
|
|
6025
|
+
className: `ya-href-popover ${hrefPopoverPos.isAbove ? "ya-href-popover--above" : ""}`,
|
|
6026
|
+
style: {
|
|
6027
|
+
top: hrefPopoverPos.isAbove ? "auto" : hrefPopoverPos.top,
|
|
6028
|
+
bottom: hrefPopoverPos.isAbove ? window.innerHeight - hrefPopoverPos.top : "auto",
|
|
6029
|
+
left: hrefPopoverPos.left,
|
|
6030
|
+
transform: "translateX(-50%)"
|
|
6031
|
+
},
|
|
6032
|
+
children: [
|
|
6033
|
+
/* @__PURE__ */ jsx15("div", { className: "ya-href-popover-header", children: "Link destination" }),
|
|
6034
|
+
!isExternalUrl ? /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
6035
|
+
sections.length > 0 && /* @__PURE__ */ jsxs9("div", { className: "ya-href-popover-section", children: [
|
|
6036
|
+
/* @__PURE__ */ jsxs9(
|
|
6037
|
+
"button",
|
|
6038
|
+
{
|
|
6039
|
+
type: "button",
|
|
6040
|
+
className: "ya-href-popover-label ya-href-collapsible-header",
|
|
6041
|
+
onClick: () => setSectionsExpanded(!sectionsExpanded),
|
|
6042
|
+
children: [
|
|
6043
|
+
/* @__PURE__ */ jsx15("span", { className: "ya-href-chevron", children: sectionsExpanded ? "\u25BC" : "\u25B6" }),
|
|
6044
|
+
"Scroll to section (",
|
|
6045
|
+
sections.length,
|
|
6046
|
+
")"
|
|
6047
|
+
]
|
|
6048
|
+
}
|
|
6049
|
+
),
|
|
6050
|
+
sectionsExpanded && /* @__PURE__ */ jsx15("div", { className: "ya-href-popover-pages", children: sections.map((section) => /* @__PURE__ */ jsxs9(
|
|
6051
|
+
"button",
|
|
6052
|
+
{
|
|
6053
|
+
type: "button",
|
|
6054
|
+
className: `ya-href-page-btn ${currentHref === section.path ? "is-selected" : ""}`,
|
|
6055
|
+
onClick: () => handlePageSelect(section.path),
|
|
6056
|
+
children: [
|
|
6057
|
+
section.label,
|
|
6058
|
+
/* @__PURE__ */ jsx15("span", { className: "ya-href-page-path", children: section.path })
|
|
6059
|
+
]
|
|
6060
|
+
},
|
|
6061
|
+
section.path
|
|
6062
|
+
)) })
|
|
6063
|
+
] }),
|
|
6064
|
+
pages.length > 0 && /* @__PURE__ */ jsxs9("div", { className: "ya-href-popover-section", children: [
|
|
6065
|
+
/* @__PURE__ */ jsx15("label", { className: "ya-href-popover-label", children: "Navigate to page" }),
|
|
6066
|
+
/* @__PURE__ */ jsx15("div", { className: "ya-href-popover-pages", children: pages.map((page) => /* @__PURE__ */ jsxs9(
|
|
6067
|
+
"button",
|
|
6068
|
+
{
|
|
6069
|
+
type: "button",
|
|
6070
|
+
className: `ya-href-page-btn ${currentHref === page.path ? "is-selected" : ""}`,
|
|
6071
|
+
onClick: () => handlePageSelect(page.path),
|
|
6072
|
+
children: [
|
|
6073
|
+
page.label,
|
|
6074
|
+
/* @__PURE__ */ jsx15("span", { className: "ya-href-page-path", children: page.path })
|
|
6075
|
+
]
|
|
6076
|
+
},
|
|
6077
|
+
page.path
|
|
6078
|
+
)) })
|
|
6079
|
+
] }),
|
|
6080
|
+
/* @__PURE__ */ jsx15(
|
|
6081
|
+
"button",
|
|
6082
|
+
{
|
|
6083
|
+
type: "button",
|
|
6084
|
+
className: "ya-href-external-toggle",
|
|
6085
|
+
onClick: () => {
|
|
6086
|
+
setIsExternalUrl(true);
|
|
6087
|
+
setExternalUrl(currentHref.startsWith("http") ? currentHref : "");
|
|
6088
|
+
},
|
|
6089
|
+
children: "Use external URL instead"
|
|
6090
|
+
}
|
|
6091
|
+
)
|
|
6092
|
+
] }) : /* @__PURE__ */ jsxs9(Fragment4, { children: [
|
|
6093
|
+
/* @__PURE__ */ jsxs9("div", { className: "ya-href-popover-section", children: [
|
|
6094
|
+
/* @__PURE__ */ jsx15("label", { className: "ya-href-popover-label", children: "External URL" }),
|
|
6095
|
+
/* @__PURE__ */ jsx15(
|
|
6096
|
+
"input",
|
|
6097
|
+
{
|
|
6098
|
+
type: "url",
|
|
6099
|
+
className: "ya-href-url-input",
|
|
6100
|
+
placeholder: "https://example.com",
|
|
6101
|
+
value: externalUrl,
|
|
6102
|
+
onChange: (e) => setExternalUrl(e.target.value),
|
|
6103
|
+
autoFocus: true
|
|
6104
|
+
}
|
|
6105
|
+
)
|
|
6106
|
+
] }),
|
|
6107
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: "ya-href-external-toggle", onClick: () => setIsExternalUrl(false), children: "\u2190 Back to pages" })
|
|
6108
|
+
] }),
|
|
6109
|
+
/* @__PURE__ */ jsxs9("div", { className: "ya-href-popover-actions", children: [
|
|
6110
|
+
/* @__PURE__ */ jsx15("button", { type: "button", className: "ya-link-btn ya-link-btn-cancel", onClick: handleCancelLink, children: "Cancel" }),
|
|
6111
|
+
isExternalUrl ? /* @__PURE__ */ jsx15("button", { type: "button", className: "ya-link-btn ya-link-btn-save", onClick: handleExternalUrlApply, children: "Apply" }) : /* @__PURE__ */ jsx15("button", { type: "button", className: "ya-link-btn ya-link-btn-save", onClick: handleSaveLink, children: "Save" })
|
|
6112
|
+
] })
|
|
6113
|
+
]
|
|
6114
|
+
}
|
|
6115
|
+
),
|
|
6116
|
+
document.body
|
|
6117
|
+
)
|
|
6026
6118
|
] });
|
|
6027
6119
|
}
|
|
6028
6120
|
|
|
@@ -6031,7 +6123,7 @@ import { useCallback as useCallback19, useEffect as useEffect17, useRef as useRe
|
|
|
6031
6123
|
import { createPortal as createPortal8 } from "react-dom";
|
|
6032
6124
|
|
|
6033
6125
|
// src/components/Tooltip.tsx
|
|
6034
|
-
import { useState as useState16, useRef as useRef17, useEffect as useEffect16, useLayoutEffect as
|
|
6126
|
+
import { useState as useState16, useRef as useRef17, useEffect as useEffect16, useLayoutEffect as useLayoutEffect4, useCallback as useCallback18 } from "react";
|
|
6035
6127
|
import { createPortal as createPortal7 } from "react-dom";
|
|
6036
6128
|
|
|
6037
6129
|
// src/components/tooltip.css
|
|
@@ -6147,7 +6239,7 @@ function Tooltip({
|
|
|
6147
6239
|
};
|
|
6148
6240
|
}, []);
|
|
6149
6241
|
const edgePadding = 12;
|
|
6150
|
-
|
|
6242
|
+
useLayoutEffect4(() => {
|
|
6151
6243
|
if (!isVisible || !tooltipRef.current || !tooltipPosition || tooltipPosition.adjusted) {
|
|
6152
6244
|
return;
|
|
6153
6245
|
}
|
package/dist/lib.js
CHANGED
|
@@ -712,8 +712,30 @@ var BuilderSelectionManager = class {
|
|
|
712
712
|
scale: 1,
|
|
713
713
|
logging: false,
|
|
714
714
|
useCORS: true,
|
|
715
|
-
backgroundColor: null
|
|
715
|
+
backgroundColor: null,
|
|
716
716
|
// Preserve transparency if any
|
|
717
|
+
windowHeight: document.body.scrollHeight,
|
|
718
|
+
// Full page height
|
|
719
|
+
height: document.body.scrollHeight,
|
|
720
|
+
// Full page height
|
|
721
|
+
scrollX: 0,
|
|
722
|
+
// Render from left (no visible scroll)
|
|
723
|
+
scrollY: 0,
|
|
724
|
+
// Render from top (no visible scroll)
|
|
725
|
+
onclone: async (clonedDoc) => {
|
|
726
|
+
clonedDoc.querySelectorAll('img[loading="lazy"]').forEach((img) => {
|
|
727
|
+
img.removeAttribute("loading");
|
|
728
|
+
});
|
|
729
|
+
await Promise.all(
|
|
730
|
+
Array.from(clonedDoc.querySelectorAll("img")).map(
|
|
731
|
+
(img) => img.complete && img.naturalHeight !== 0 ? Promise.resolve() : new Promise((r) => {
|
|
732
|
+
img.onload = r;
|
|
733
|
+
img.onerror = r;
|
|
734
|
+
})
|
|
735
|
+
)
|
|
736
|
+
);
|
|
737
|
+
await clonedDoc.fonts?.ready;
|
|
738
|
+
}
|
|
717
739
|
});
|
|
718
740
|
overlays.forEach((el) => {
|
|
719
741
|
;
|
package/dist/prod.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as ContentStore, E as ContentStoreMode, C as ContentStoreProvider, f as MarkdownText, g as MarkdownTextProps, P as PageInfo, c as StaticImage, d as StaticImageProps, M as StaticText, S as StaticTextProps, c as YaImage, d as YaImageProps, M as YaText, S as YaTextProps, b as background, e as embed, i as image, p as parseEmbedUrl, t as text, u as useContentStore, v as video } from './content-helpers-
|
|
1
|
+
export { a as ContentStore, E as ContentStoreMode, C as ContentStoreProvider, f as MarkdownText, g as MarkdownTextProps, P as PageInfo, c as StaticImage, d as StaticImageProps, M as StaticText, S as StaticTextProps, c as YaImage, d as YaImageProps, M as YaText, S as YaTextProps, b as background, e as embed, i as image, p as parseEmbedUrl, t as text, u as useContentStore, v as video } from './content-helpers-DOUKazMz.js';
|
|
2
2
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
3
|
import React, { CSSProperties, ReactNode } from 'react';
|
|
4
4
|
export { Link, LinkProps, NavigateFunction, Router, RouterProps, ScrollRestoration, useNavigate } from './router.js';
|