Browse Source

Container

bianjiang 1 year ago
parent
commit
237896554b

+ 1 - 2
src/modules/editor/module/actions/edit.ts

@@ -68,8 +68,7 @@ export const editActions = EditorModule.action({
     if (this.store.currCompId == compId) {
       return;
     }
-    this.store.currCompId = "";
-    this.store.currStreamCardId = "";
+ 
     this.store.setCurrComp(compId);
     if (this.store.currCompId == this.store.currStreamCardId) {
       this.controls.transferCtrl.destroy();

+ 3 - 0
src/modules/editor/module/helpers/index.ts

@@ -61,6 +61,7 @@ export const helpers = EditorModule.helper({
   },
   isCustomChildComp(comp: DesignComp): boolean {
     const parentComp = this.helper.findParentComp(comp.id);
+
     if (!parentComp) return false;
     const i =
       parentComp.children.default?.findIndex((d) => d === comp.id) ?? -1;
@@ -69,6 +70,8 @@ export const helpers = EditorModule.helper({
   isCompCanDelete(compId: string): boolean {
     const comp = this.helper.findComp(compId);
     if (!comp || !this.helper.isCustomChildComp(comp)) return false;
+    if (comp.compKey == "Container" && this.store.streamCardIds.length == 1)
+      return false;
     return true;
     // if (this.store.isEditComp) return true;
     // return this.store.pageCompIds.includes(compId);

+ 4 - 1
src/modules/editor/module/stores/index.ts

@@ -71,7 +71,10 @@ export const store = EditorModule.store({
       return compId;
     },
     setCurrComp(compId: string) {
-      this.store.currStreamCardId = "";
+      if (compId != "root") {
+        this.store.currStreamCardId = "";
+      }
+     
       this.store.currCompId = compId;
 
       const find = (objs: string[], id: string): boolean => {

+ 1 - 1
src/modules/editor/objects/Toolbars/default.ts

@@ -151,5 +151,5 @@ export const toolbars = createToolbars({
     onClick(comp) {
       this.actions.cancelGroupComps(comp);
     },
-  }
+  },
 });