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);
|
||||
console.log(active_meta);
|
||||
if (!active_meta) {
|
||||
alert("Please select an item/section to add component!");
|
||||
}
|
||||
|
||||
if (active_meta) {
|
||||
let item = active_meta.item as IContent;
|
||||
if (
|
||||
item.type === "item" &&
|
||||
item.component?.id &&
|
||||
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;
|
||||
if (item.type === "item" && item.component?.id) {
|
||||
if (
|
||||
item.component.props.child &&
|
||||
item.component.props.child.content
|
||||
) {
|
||||
const cmeta = getMetaById(p, item.component.props.child.content.id);
|
||||
if (cmeta) {
|
||||
active_meta = cmeta;
|
||||
item = active_meta.item;
|
||||
}
|
||||
} else {
|
||||
alert("Warning: Please edit component first before adding. ");
|
||||
return;
|
||||
if (
|
||||
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"
|
||||
value={local.value || ""}
|
||||
spellCheck={false}
|
||||
onFocus={() => {
|
||||
onFocus={(e) => {
|
||||
local.focus = true;
|
||||
e.currentTarget.select();
|
||||
local.render();
|
||||
}}
|
||||
onBlur={() => {
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ export const ViRender: FC<{
|
|||
if (!meta) return null;
|
||||
if (meta.item.hidden) return null;
|
||||
|
||||
|
||||
if (meta.item.adv?.js || meta.item.component?.id) {
|
||||
return (
|
||||
<ErrorBox meta={meta}>
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ export const viEvalScript = (
|
|||
meta.script.scope = passprop;
|
||||
}
|
||||
|
||||
|
||||
const script = meta.script;
|
||||
const exports = (window as any).exports;
|
||||
const arg = {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import { ReactNode, isValidElement } from "react";
|
||||
import { IMeta } from "../../../ed/logic/ed-global";
|
||||
import { VG } from "../global";
|
||||
import { ViChild } from "../render";
|
||||
import { ViRender } from "../render";
|
||||
import get from "lodash.get";
|
||||
|
||||
export const createViPassProp = (
|
||||
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 (
|
||||
!Array.isArray(arg.children) &&
|
||||
!isValidElement(arg.children) &&
|
||||
|
|
@ -35,7 +62,7 @@ export const createViPassProp = (
|
|||
const child_id = (arg.children as any).id;
|
||||
if (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)) {
|
||||
let is_meta = true;
|
||||
|
|
@ -47,7 +74,7 @@ export const createViPassProp = (
|
|||
if (is_meta) {
|
||||
return arg.children.map(({ 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://"))
|
||||
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_url) {
|
||||
vi.site_url = new URL(vi.site.api_url);
|
||||
|
|
|
|||
Loading…
Reference in New Issue