This commit is contained in:
Rizky 2024-07-17 03:01:29 +07:00
parent 73bb5cee2c
commit 2f9f2fadee
5 changed files with 15 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -231,6 +231,7 @@ export const EDGlobal = {
CSS: false,
},
rename_id: "",
open_all: false,
open: {} as Record<string, string[]>,
},
popup: {

View File

@ -38,6 +38,7 @@ export const EdSideStyle: FC<{ meta: IMeta }> = ({ meta }) => {
)}
spellCheck={false}
value={local.value}
readOnly
></textarea>
}
>

View File

@ -14,6 +14,14 @@ export const expandTreeHook = (
p.ui.prevent_indent_hook = false;
return;
}
if (p.ui.tree.open_all) {
p.ui.tree.open_all = false;
local.tree?.openAll();
p.render();
return;
}
const open = JSON.parse(localStorage.getItem("prasi-tree-open") || "{}");
p.ui.tree.open = open;
@ -24,6 +32,7 @@ export const expandTreeHook = (
const cur = getMetaById(p, active.item_id);
if (cur && cur.parent?.id) {
const id = cur.parent.id;
if (id) {
shouldOpen.add(id);
@ -32,7 +41,7 @@ export const expandTreeHook = (
while (meta) {
i++;
if (i > 5000) {
console.error(
console.warn(
"WARNING: Prasi expand item parent tree exceed 5000 loop, maybe infinite loop?"
);
break;
@ -74,5 +83,5 @@ export const expandTreeHook = (
}
}
}
}, [p.page.tree, active.comp_id, active.item_id]);
}, [p.page.tree, active.comp_id, active.item_id, p.ui.tree.open_all]);
};

View File

@ -180,6 +180,7 @@ export const nodeRender: NodeRender<IMeta> = (node, prm) => {
if (node.data?.parent?.comp_id) {
active.comp_id = node.data?.parent?.comp_id;
}
p.ui.tree.open_all = true;
}
p.ui.tree.search = "";