+ {[
+ { label: "TXT", type: "text" },
+ { label: "OPT", type: "option" },
+ { label: "JSX", type: "content-element" },
+ ].map((e) => {
+ return (
+
{
+ if (e.type === "content-element") {
+ mprop.doc?.transact(() => {
+ mmeta.set("type", e.type as any);
+ if (!mprop.get("content")) {
+ const json = {
+ id: createId(),
+ name: name,
+ type: "item",
+ dim: { w: "full", h: "full" },
+ childs: [],
+ adv: {
+ css: "",
+ },
+ } as IItem;
+ const map = new Y.Map() as MItem;
+ syncronize(map as any, fillID(json));
+ mprop.set("content", map);
+ }
+ });
+ } else {
mmeta.set("type", e.type as any);
- if (!mprop.get("content")) {
- const json = {
- id: createId(),
- name: name,
- type: "item",
- dim: { w: "full", h: "full" },
- childs: [],
- adv: {
- css: "",
- },
- } as IItem;
- const map = new Y.Map() as MItem;
- syncronize(map as any, fillID(json));
- mprop.set("content", map);
- }
- });
- } else {
- mmeta.set("type", e.type as any);
- }
- propPopover.render();
- }}
+ }
+ propPopover.render();
+ }}
+ >
+ {e.label}
+
+ );
+ })}
+
{
+ mprop.doc?.transact(() => {
+ (mprop.parent as any)?.forEach((p: any, k: string) => {
+ console.log(k, p);
+
+ if (k === name) {
+ p.set("is_name", !p.get("is_name"));
+ } else {
+ p.set("is_name", false);
+ }
+ });
+ });
+ }}
+ >
+
- {e.label}
-
- );
- })}
+ {!mprop.get("is_name") ? (
+