This commit is contained in:
Rizky 2024-07-26 08:24:14 +07:00
parent 5984086a34
commit 4287466145
7 changed files with 33 additions and 14 deletions

File diff suppressed because one or more lines are too long

View File

@ -80,7 +80,15 @@ export const EdBase = () => {
const Editor = jscript.editor; const Editor = jscript.editor;
return ( return (
<div className={cx("flex flex-col flex-1", style)}> <div
className={cx("flex flex-col flex-1", style)}
onPointerLeave={() => {
w.pointer_active = false;
}}
onPointerEnter={() => {
w.pointer_active = true;
}}
>
<div className="flex justify-between"></div> <div className="flex justify-between"></div>
<div className="flex flex-1 items-stretch"> <div className="flex flex-1 items-stretch">
{p.status === "ready" && ( {p.status === "ready" && (

View File

@ -188,7 +188,7 @@ export const edInitSync = (p: PG) => {
p.render(); p.render();
}, },
async code_changes({ ts, mode, status }) { async code_changes({ ts, mode, status }) {
if (mode === "frontend") { if (mode === "frontend" && !w.pointer_active) {
if (status === "ok") { if (status === "ok") {
console.clear(); console.clear();
console.log( console.log(

View File

@ -62,6 +62,7 @@ export const initDevLiveReload = () => {
}, },
}); });
} else if (msg.type === SyncType.Event) { } else if (msg.type === SyncType.Event) {
if (w.pointer_active) return;
if (msg.event === "page_changed") { if (msg.event === "page_changed") {
const id = msg.data.map.id; const id = msg.data.map.id;
const page = base.page.cache[id]; const page = base.page.cache[id];
@ -89,7 +90,7 @@ export const initDevLiveReload = () => {
rebuildMeta(p.meta, p.root); rebuildMeta(p.meta, p.root);
console.log( console.log(
`${format(Date.now(), "HH:mm:ss")} 🚧 Component [${id}] updated ` `${format(Date.now(), "HH:mm:ss")} 🚧 Component [${msg.data.map.root.name}] updated `
); );
w.prasiContext.render(); w.prasiContext.render();
} else if (msg.event === "code_changes") { } else if (msg.event === "code_changes") {

View File

@ -177,7 +177,15 @@ export const Root = () => {
return ( return (
<Provider value={w.prasiContext}> <Provider value={w.prasiContext}>
<div className={cx("relative flex flex-1 items-center justify-center")}> <div
className={cx("relative flex flex-1 items-center justify-center")}
onPointerLeave={() => {
w.pointerActive = false;
}}
onPointerEnter={() => {
w.pointerActive = true;
}}
>
<div <div
className={cx( className={cx(
"absolute flex flex-col items-stretch flex-1 bg-white main-content-preview", "absolute flex flex-col items-stretch flex-1 bg-white main-content-preview",

View File

@ -5,6 +5,7 @@ export const w = window as unknown as {
}; };
params: any; params: any;
navigateOverride: (href: string) => void; navigateOverride: (href: string) => void;
pointerActive: boolean
_prasi: { _prasi: {
basepath: string; basepath: string;
page_id?: string; page_id?: string;

View File

@ -49,6 +49,7 @@ export const w = window as unknown as {
on: any; on: any;
off: any; off: any;
}; };
pointer_active: boolean
}; };
export type Page = { export type Page = {