@accelerated-agency/visual-editor 0.2.2 → 0.2.3
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/index.js +10 -43
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1843,13 +1843,10 @@ function ElementIcon({ tag }) {
|
|
|
1843
1843
|
return /* @__PURE__ */ jsx("span", { className: "shrink-0 w-5 h-5 rounded flex items-center justify-center", style: { backgroundColor: bgColor }, children: /* @__PURE__ */ jsx("svg", { width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", children: /* @__PURE__ */ jsx("rect", { x: "1.5", y: "1.5", width: "9", height: "9", rx: "1.5", stroke: iconColor, strokeWidth: "1.2" }) }) });
|
|
1844
1844
|
}
|
|
1845
1845
|
var CHANNEL = "conversion-editor";
|
|
1846
|
-
var IFRAME_LOAD_GUARD_MS = 13e4;
|
|
1847
1846
|
function IframeCanvas({ url, password, proxyBaseUrl = "", onBridgeReady, onPong }) {
|
|
1848
1847
|
const iframeElRef = useRef(null);
|
|
1849
|
-
const loadGuardRef = useRef(null);
|
|
1850
1848
|
const setSelectedElement = useMutationsStore((s) => s.setSelectedElement);
|
|
1851
1849
|
const addMutationToActive = useVariationsStore((s) => s.addMutationToActive);
|
|
1852
|
-
const [loading, setLoading] = useState(false);
|
|
1853
1850
|
useEffect(() => {
|
|
1854
1851
|
setIframeRef(iframeElRef.current);
|
|
1855
1852
|
return () => setIframeRef(null);
|
|
@@ -1888,25 +1885,6 @@ function IframeCanvas({ url, password, proxyBaseUrl = "", onBridgeReady, onPong
|
|
|
1888
1885
|
window.addEventListener("message", handleMessage);
|
|
1889
1886
|
return () => window.removeEventListener("message", handleMessage);
|
|
1890
1887
|
}, [handleMessage]);
|
|
1891
|
-
useEffect(() => {
|
|
1892
|
-
if (!url) return;
|
|
1893
|
-
setLoading(true);
|
|
1894
|
-
if (loadGuardRef.current) clearTimeout(loadGuardRef.current);
|
|
1895
|
-
loadGuardRef.current = setTimeout(() => {
|
|
1896
|
-
loadGuardRef.current = null;
|
|
1897
|
-
setLoading(false);
|
|
1898
|
-
}, IFRAME_LOAD_GUARD_MS);
|
|
1899
|
-
return () => {
|
|
1900
|
-
if (loadGuardRef.current) clearTimeout(loadGuardRef.current);
|
|
1901
|
-
};
|
|
1902
|
-
}, [url]);
|
|
1903
|
-
const clearLoadGuard = useCallback(() => {
|
|
1904
|
-
if (loadGuardRef.current) {
|
|
1905
|
-
clearTimeout(loadGuardRef.current);
|
|
1906
|
-
loadGuardRef.current = null;
|
|
1907
|
-
}
|
|
1908
|
-
setLoading(false);
|
|
1909
|
-
}, []);
|
|
1910
1888
|
let resolvedUrl;
|
|
1911
1889
|
if (url.toLowerCase() === "test") {
|
|
1912
1890
|
resolvedUrl = "/test";
|
|
@@ -1921,27 +1899,16 @@ function IframeCanvas({ url, password, proxyBaseUrl = "", onBridgeReady, onPong
|
|
|
1921
1899
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-gray-400", children: 'Load a page from the Page dropdown in the top bar, or type "test" for the local test page' })
|
|
1922
1900
|
] });
|
|
1923
1901
|
}
|
|
1924
|
-
return /* @__PURE__ */
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
"iframe",
|
|
1935
|
-
{
|
|
1936
|
-
ref: iframeElRef,
|
|
1937
|
-
src: resolvedUrl,
|
|
1938
|
-
className: "w-full h-full border-0",
|
|
1939
|
-
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups",
|
|
1940
|
-
onLoad: clearLoadGuard,
|
|
1941
|
-
onError: clearLoadGuard
|
|
1942
|
-
}
|
|
1943
|
-
)
|
|
1944
|
-
] });
|
|
1902
|
+
return /* @__PURE__ */ jsx("div", { className: "relative w-full h-full", children: /* @__PURE__ */ jsx(
|
|
1903
|
+
"iframe",
|
|
1904
|
+
{
|
|
1905
|
+
ref: iframeElRef,
|
|
1906
|
+
src: resolvedUrl,
|
|
1907
|
+
className: "w-full h-full border-0",
|
|
1908
|
+
sandbox: "allow-scripts allow-same-origin allow-forms allow-popups",
|
|
1909
|
+
title: "Visual editor page"
|
|
1910
|
+
}
|
|
1911
|
+
) });
|
|
1945
1912
|
}
|
|
1946
1913
|
function ElementOverlayToolbar() {
|
|
1947
1914
|
const selectedElement = useMutationsStore((s) => s.selectedElement);
|