wip fix
This commit is contained in:
parent
5633cd93ae
commit
36459857d9
File diff suppressed because one or more lines are too long
|
|
@ -38,12 +38,7 @@ export const assignMitem = (arg: {
|
|||
} else {
|
||||
let parent = meta[m.parent.id];
|
||||
|
||||
if (
|
||||
!parent.mitem &&
|
||||
m.parent.instance_id &&
|
||||
meta[m.parent.instance_id] &&
|
||||
meta[m.parent.instance_id].mitem
|
||||
) {
|
||||
if (!parent.mitem && m.parent.instance_id && meta[m.parent.instance_id]) {
|
||||
parent = meta[m.parent.instance_id];
|
||||
}
|
||||
|
||||
|
|
@ -77,17 +72,20 @@ export const assignMitem = (arg: {
|
|||
}
|
||||
} else {
|
||||
parent.mitem.get("childs")?.forEach((child) => {
|
||||
if (child && child.get && child.get("id") === m.item.id) {
|
||||
const id = child && child.get && child.get("id");
|
||||
const original_id = child && child.get && child.get("originalId");
|
||||
if (typeof id === "string" && id === m.item.id) {
|
||||
m.mitem = child;
|
||||
} else if (
|
||||
typeof original_id === "string" &&
|
||||
original_id === m.item.originalId
|
||||
) {
|
||||
m.mitem = child;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (m.item.name === "nav_menu") {
|
||||
console.log(m);
|
||||
}
|
||||
|
||||
if (m.item.component?.props) {
|
||||
for (const [prop_name, v] of Object.entries(m.item.component.props)) {
|
||||
let mprop = m.mitem?.get("component")?.get("props")?.get(prop_name);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ export const edActionCopy = async (p: PG, item: IContent) => {
|
|||
const walk = (_item: IContent) => {
|
||||
let item = _item;
|
||||
|
||||
|
||||
if (item.type !== "text") {
|
||||
if (item.type === "item" && item.component?.props) {
|
||||
for (const [k, v] of Object.entries(item.component.props)) {
|
||||
|
|
@ -23,9 +24,10 @@ export const edActionCopy = async (p: PG, item: IContent) => {
|
|||
}
|
||||
|
||||
for (const [key, child] of Object.entries(item.childs)) {
|
||||
if (child && Object.keys(child).length === 1) {
|
||||
if (child && Object.keys(child).length <= 2) {
|
||||
const meta = p.page.meta[child.id];
|
||||
if (meta) {
|
||||
console.log(meta.item);
|
||||
const new_child = deepClone(meta.item);
|
||||
item.childs[key as any] = new_child;
|
||||
walk(new_child);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ export const edActionCut = async (p: PG, item: IContent) => {
|
|||
}
|
||||
|
||||
for (const [key, child] of Object.entries(item.childs)) {
|
||||
if (child && Object.keys(child).length === 1) {
|
||||
if (child && Object.keys(child).length <= 2) {
|
||||
const meta = p.page.meta[child.id];
|
||||
if (meta) {
|
||||
const new_child = deepClone(meta.item);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ export const genComp = (p: GenMetaP, arg: GenMetaArg) => {
|
|||
for (const child of Object.values(item.childs)) {
|
||||
if (child?.name?.startsWith("jsx:")) continue;
|
||||
|
||||
if (child && Object.keys(child).length > 1) {
|
||||
if (child && Object.keys(child).length > 2) {
|
||||
genMeta(
|
||||
{ ...p, mode: "comp" },
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ export const simplifyItemChild = (item: IItem) => {
|
|||
newitem.childs = [];
|
||||
if (v && Array.isArray(v)) {
|
||||
for (const child of v) {
|
||||
newitem.childs.push({ id: child.id });
|
||||
newitem.childs.push({ id: child.id, originalId: child.originalId });
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ export const createViPassProp = (
|
|||
"props.meta.item.component.props.child.content.childs"
|
||||
) as unknown as any[];
|
||||
|
||||
console.log(children);
|
||||
|
||||
if (Array.isArray(children)) {
|
||||
let is_meta = true;
|
||||
for (const c of children) {
|
||||
|
|
@ -62,9 +60,12 @@ export const createViPassProp = (
|
|||
}
|
||||
|
||||
if (cmeta) {
|
||||
if (Object.keys(cmeta.item).length === 1 && cmeta.mitem) {
|
||||
cmeta.item = cmeta.mitem.toJSON() as any;
|
||||
if (Object.keys(cmeta.item).length <= 2) {
|
||||
if (cmeta.mitem) {
|
||||
cmeta.item = cmeta.mitem.toJSON() as any;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<ViRender
|
||||
key={item.id}
|
||||
|
|
|
|||
Loading…
Reference in New Issue