diff --git a/app/web/src/nova/ed/panel/header/mid/page-picker.tsx b/app/web/src/nova/ed/panel/header/mid/page-picker.tsx index 3cc6bdb2..b0035677 100644 --- a/app/web/src/nova/ed/panel/header/mid/page-picker.tsx +++ b/app/web/src/nova/ed/panel/header/mid/page-picker.tsx @@ -5,6 +5,10 @@ import { TopBtn } from "../top-btn"; export const EdPagePicker = () => { const p = useGlobal(EDGlobal, "EDITOR"); + if (p.page.cur.name !== p.page.list[p.page.cur.id].page.name) { + p.page.cur.name = p.page.list[p.page.cur.id].page.name; + } + return ( { diff --git a/app/web/src/nova/vi/preview.tsx b/app/web/src/nova/vi/preview.tsx index 9c03c3c9..a22874a6 100644 --- a/app/web/src/nova/vi/preview.tsx +++ b/app/web/src/nova/vi/preview.tsx @@ -12,10 +12,11 @@ import { savePageMetaCache, } from "../ed/logic/ed-route"; import { loadSite } from "../ed/logic/ed-site"; -import { treeCacheBuild } from "../ed/logic/tree/build"; +import { treeCacheBuild, treeRebuild } from "../ed/logic/tree/build"; import { nav } from "./render/script/extract-nav"; import { Vi } from "./vi"; import parseUA from "ua-parser-js"; +import { DeadEnd } from "../../utils/ui/deadend"; const decoder = new TextDecoder(); export const ViPreview = (arg: { pathname: string }) => { @@ -66,6 +67,18 @@ export const ViPreview = (arg: { pathname: string }) => { viRoute(p); if (p.status !== "ready" && p.status !== "reload") { + if (p.status === "page-not-found") { + return ( + { + history.back(); + }} + > + Page Not Found + + ); + } + return ; } diff --git a/app/web/src/utils/ui/deadend.tsx b/app/web/src/utils/ui/deadend.tsx index d8d95953..ddb51fda 100644 --- a/app/web/src/utils/ui/deadend.tsx +++ b/app/web/src/utils/ui/deadend.tsx @@ -1,9 +1,18 @@ import { FC } from "react"; +import { treeRebuild } from "../../nova/ed/logic/tree/build"; +import { useGlobal } from "web-utils"; -export const DeadEnd: FC<{ children: any }> = ({ children }) => { +export const DeadEnd: FC<{ children: any; back: () => void }> = ({ + children, + back, +}) => { return ( -
- {children} +
+
{children}
+
+ {" "} + Go Back +
); }; diff --git a/app/web/src/utils/ui/form/input.tsx b/app/web/src/utils/ui/form/input.tsx index 133af31e..abf6749d 100644 --- a/app/web/src/utils/ui/form/input.tsx +++ b/app/web/src/utils/ui/form/input.tsx @@ -21,9 +21,14 @@ export const Input: FC< delete prop.onChange; } + let value = form[name]; + if (value instanceof URL) { + value = value.toString(); + } + return ( { form[name] = e.currentTarget.value; diff --git a/pkgs/web-utils/src/define-window.ts b/pkgs/web-utils/src/define-window.ts index 5e0ac760..72c8033a 100644 --- a/pkgs/web-utils/src/define-window.ts +++ b/pkgs/web-utils/src/define-window.ts @@ -76,7 +76,7 @@ export const defineWindow = async (awaitServerUrl = true) => { if (!_href) return null; } - history.pushState({}, "", _href); + history.pushState({ prevUrl: window.location.href }, "", _href); w.pathname = href; if (w.prasiContext && w.prasiContext.render) {