wip fix
This commit is contained in:
parent
d26835b204
commit
8ce421c8eb
|
|
@ -15,11 +15,31 @@ import { loadSite } from "../ed/logic/ed-site";
|
||||||
import { treeCacheBuild } from "../ed/logic/tree/build";
|
import { treeCacheBuild } from "../ed/logic/tree/build";
|
||||||
import { nav } from "./render/script/extract-nav";
|
import { nav } from "./render/script/extract-nav";
|
||||||
import { Vi } from "./vi";
|
import { Vi } from "./vi";
|
||||||
|
import parseUA from "ua-parser-js";
|
||||||
|
|
||||||
const decoder = new TextDecoder();
|
const decoder = new TextDecoder();
|
||||||
export const ViPreview = (arg: { pathname: string }) => {
|
export const ViPreview = (arg: { pathname: string }) => {
|
||||||
const p = useGlobal(EDGlobal, "EDITOR");
|
const p = useGlobal(EDGlobal, "EDITOR");
|
||||||
|
|
||||||
|
if (p.site.id) {
|
||||||
|
if (!p.mode && !!p.site.responsive) {
|
||||||
|
if (
|
||||||
|
p.site.responsive !== "mobile-only" &&
|
||||||
|
p.site.responsive !== "desktop-only"
|
||||||
|
) {
|
||||||
|
const parsed = parseUA();
|
||||||
|
p.mode = parsed.device.type === "mobile" ? "mobile" : "desktop";
|
||||||
|
if (localStorage.getItem("prasi-editor-mode")) {
|
||||||
|
p.mode = localStorage.getItem("prasi-editor-mode") as any;
|
||||||
|
}
|
||||||
|
} else if (p.site.responsive === "mobile-only") {
|
||||||
|
p.mode = "mobile";
|
||||||
|
} else if (p.site.responsive === "desktop-only") {
|
||||||
|
p.mode = "desktop";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
w.navigateOverride = (_href) => {
|
w.navigateOverride = (_href) => {
|
||||||
if (_href && _href.startsWith("/")) {
|
if (_href && _href.startsWith("/")) {
|
||||||
if (w.basepath.length > 1) {
|
if (w.basepath.length > 1) {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ export const ViRoot: FC<{}> = ({}) => {
|
||||||
<div className="flex flex-1 flex-col relative">
|
<div className="flex flex-1 flex-col relative">
|
||||||
{entry.map((id) => {
|
{entry.map((id) => {
|
||||||
const meta = is_layout ? vi.layout?.meta[id] : vi.meta[id];
|
const meta = is_layout ? vi.layout?.meta[id] : vi.meta[id];
|
||||||
console.log(is_layout, vi.layout, vi.meta, id);
|
|
||||||
if (meta) {
|
if (meta) {
|
||||||
if (Element) {
|
if (Element) {
|
||||||
return (
|
return (
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue