liwei 1 рік тому
батько
коміт
56d44b64b5

+ 7 - 1
src/modules/editor/module/actions/edit.tsx

@@ -398,7 +398,13 @@ export const editActions = EditorModule.action({
   removeComp(compId: string) {
 
     const paths = this.helper.getCompTrees(compId);
-    if (!paths[2]) return;
+    if (!paths[2]) {
+      if (this.helper.isStreamCard(compId)) {
+        this.actions.removeStreamCard(compId);
+        return;
+      }
+      return;
+    }
     compId = paths[2].id;
 
     if (this.helper.isCompCanDelete(compId)) {

+ 2 - 1
src/modules/editor/module/helpers/index.ts

@@ -108,8 +108,9 @@ export const helpers = EditorModule.helper({
     return i >= 0;
   },
   isCompCanDelete(compId: string): boolean {
-    return this.helper.isStreamCardChild(compId);
+    return this.helper.isStreamCardChild(compId) || (this.helper.isStreamCard(compId) && this.store.streamCardIds.length > 1);
   },
+
   isShowSaveComp(comp: DesignComp): boolean {
     if ( !this.helper.isStreamCardChild(comp.id) ) return false;
     return true;