wip fix
This commit is contained in:
parent
0adcdcd699
commit
64629ac407
File diff suppressed because one or more lines are too long
|
|
@ -35,25 +35,37 @@ export const EdCompPicker = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
let active_meta = getActiveMeta(p);
|
let active_meta = getActiveMeta(p);
|
||||||
|
console.log(active_meta);
|
||||||
if (!active_meta) {
|
if (!active_meta) {
|
||||||
alert("Please select an item/section to add component!");
|
alert("Please select an item/section to add component!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (active_meta) {
|
if (active_meta) {
|
||||||
let item = active_meta.item as IContent;
|
let item = active_meta.item as IContent;
|
||||||
if (
|
if (item.type === "item" && item.component?.id) {
|
||||||
item.type === "item" &&
|
if (
|
||||||
item.component?.id &&
|
item.component.props.child &&
|
||||||
active_meta.parent?.id &&
|
item.component.props.child.content
|
||||||
item.component?.id !== active.comp_id
|
) {
|
||||||
) {
|
const cmeta = getMetaById(p, item.component.props.child.content.id);
|
||||||
active_meta = getMetaById(p, active_meta.parent.id);
|
if (cmeta) {
|
||||||
|
active_meta = cmeta;
|
||||||
if (active_meta) {
|
item = active_meta.item;
|
||||||
item = active_meta.item;
|
}
|
||||||
} else {
|
} else {
|
||||||
alert("Warning: Please edit component first before adding. ");
|
if (
|
||||||
return;
|
active_meta.parent?.id &&
|
||||||
|
item.component?.id !== active.comp_id
|
||||||
|
) {
|
||||||
|
active_meta = getMetaById(p, active_meta.parent.id);
|
||||||
|
|
||||||
|
if (active_meta) {
|
||||||
|
item = active_meta.item;
|
||||||
|
} else {
|
||||||
|
alert("Warning: Please edit component first before adding. ");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -71,8 +71,9 @@ export const EdPropInstanceText: FC<{
|
||||||
className="flex-1 outline-none border-l p-1 overflow-hidden focus:bg-blue-50"
|
className="flex-1 outline-none border-l p-1 overflow-hidden focus:bg-blue-50"
|
||||||
value={local.value || ""}
|
value={local.value || ""}
|
||||||
spellCheck={false}
|
spellCheck={false}
|
||||||
onFocus={() => {
|
onFocus={(e) => {
|
||||||
local.focus = true;
|
local.focus = true;
|
||||||
|
e.currentTarget.select();
|
||||||
local.render();
|
local.render();
|
||||||
}}
|
}}
|
||||||
onBlur={() => {
|
onBlur={() => {
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,6 @@ export const ViRender: FC<{
|
||||||
if (!meta) return null;
|
if (!meta) return null;
|
||||||
if (meta.item.hidden) return null;
|
if (meta.item.hidden) return null;
|
||||||
|
|
||||||
|
|
||||||
if (meta.item.adv?.js || meta.item.component?.id) {
|
if (meta.item.adv?.js || meta.item.component?.id) {
|
||||||
return (
|
return (
|
||||||
<ErrorBox meta={meta}>
|
<ErrorBox meta={meta}>
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ export const viEvalScript = (
|
||||||
meta.script.scope = passprop;
|
meta.script.scope = passprop;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const script = meta.script;
|
const script = meta.script;
|
||||||
const exports = (window as any).exports;
|
const exports = (window as any).exports;
|
||||||
const arg = {
|
const arg = {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
import { ReactNode, isValidElement } from "react";
|
import { ReactNode, isValidElement } from "react";
|
||||||
import { IMeta } from "../../../ed/logic/ed-global";
|
import { IMeta } from "../../../ed/logic/ed-global";
|
||||||
import { VG } from "../global";
|
import { VG } from "../global";
|
||||||
import { ViChild } from "../render";
|
import { ViRender } from "../render";
|
||||||
|
import get from "lodash.get";
|
||||||
|
|
||||||
export const createViPassProp = (
|
export const createViPassProp = (
|
||||||
vi: { meta: VG["meta"] },
|
vi: { meta: VG["meta"] },
|
||||||
|
|
@ -27,6 +28,32 @@ export const createViPassProp = (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
!Array.isArray(arg.children) &&
|
||||||
|
isValidElement(arg.children) &&
|
||||||
|
typeof arg.children === "object"
|
||||||
|
) {
|
||||||
|
const children = get(
|
||||||
|
arg.children,
|
||||||
|
"props.meta.item.component.props.child.content.childs"
|
||||||
|
) as unknown as any[];
|
||||||
|
|
||||||
|
if (Array.isArray(children)) {
|
||||||
|
let is_meta = true;
|
||||||
|
for (const c of children) {
|
||||||
|
if (!(!isValidElement(c) && typeof c === "object")) {
|
||||||
|
is_meta = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (is_meta) {
|
||||||
|
return children.map(({ id }) => {
|
||||||
|
const meta = vi.meta[id];
|
||||||
|
return <ViRender key={id} is_layout={is_layout} meta={meta} />;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!Array.isArray(arg.children) &&
|
!Array.isArray(arg.children) &&
|
||||||
!isValidElement(arg.children) &&
|
!isValidElement(arg.children) &&
|
||||||
|
|
@ -35,7 +62,7 @@ export const createViPassProp = (
|
||||||
const child_id = (arg.children as any).id;
|
const child_id = (arg.children as any).id;
|
||||||
if (child_id) {
|
if (child_id) {
|
||||||
const meta = vi.meta[child_id];
|
const meta = vi.meta[child_id];
|
||||||
return <ViChild is_layout={is_layout} meta={meta} />;
|
return <ViRender is_layout={is_layout} meta={meta} />;
|
||||||
}
|
}
|
||||||
} else if (Array.isArray(arg.children)) {
|
} else if (Array.isArray(arg.children)) {
|
||||||
let is_meta = true;
|
let is_meta = true;
|
||||||
|
|
@ -47,7 +74,7 @@ export const createViPassProp = (
|
||||||
if (is_meta) {
|
if (is_meta) {
|
||||||
return arg.children.map(({ id }) => {
|
return arg.children.map(({ id }) => {
|
||||||
const meta = vi.meta[id];
|
const meta = vi.meta[id];
|
||||||
return <ViChild key={id} is_layout={is_layout} meta={meta} />;
|
return <ViRender key={id} is_layout={is_layout} meta={meta} />;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ export const Vi: FC<{
|
||||||
if (pathname.startsWith("http://") || pathname.startsWith("https://"))
|
if (pathname.startsWith("http://") || pathname.startsWith("https://"))
|
||||||
return pathname;
|
return pathname;
|
||||||
|
|
||||||
if (["prasi.avolut.com"].includes(location.hostname)) {
|
if (["prasi.avolut.com", "localhost"].includes(location.hostname)) {
|
||||||
if (vi.site.api_url) {
|
if (vi.site.api_url) {
|
||||||
if (!vi.site_url) {
|
if (!vi.site_url) {
|
||||||
vi.site_url = new URL(vi.site.api_url);
|
vi.site_url = new URL(vi.site.api_url);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue