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;
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 flex-1 items-stretch">
{p.status === "ready" && (

View File

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

View File

@ -62,6 +62,7 @@ export const initDevLiveReload = () => {
},
});
} else if (msg.type === SyncType.Event) {
if (w.pointer_active) return;
if (msg.event === "page_changed") {
const id = msg.data.map.id;
const page = base.page.cache[id];
@ -89,7 +90,7 @@ export const initDevLiveReload = () => {
rebuildMeta(p.meta, p.root);
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();
} else if (msg.event === "code_changes") {

View File

@ -177,7 +177,15 @@ export const Root = () => {
return (
<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
className={cx(
"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;
navigateOverride: (href: string) => void;
pointerActive: boolean
_prasi: {
basepath: string;
page_id?: string;

View File

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