|
@@ -10,17 +10,19 @@ export const editActions = EditorModule.action({
|
|
|
let compId: string;
|
|
|
if (
|
|
|
index === undefined &&
|
|
|
- this.store.currComp?.compKey === "Container" &&
|
|
|
- this.store.pageCompIds.includes(this.store.currComp.id)
|
|
|
+ this.store.currComp?.compKey === "Container"
|
|
|
+ // this.store.pageCompIds.includes(this.store.currComp.id)
|
|
|
) {
|
|
|
compId = await this.store.insertCompContainer(
|
|
|
compKey,
|
|
|
this.store.currComp
|
|
|
);
|
|
|
+ this.actions.pickComp(compId);
|
|
|
+ this.actions.setCompPosition(this.store.currComp);
|
|
|
} else {
|
|
|
compId = await this.store.insertDesignContent(compKey, index);
|
|
|
+ this.actions.pickComp(compId);
|
|
|
}
|
|
|
- this.actions.pickComp(compId);
|
|
|
},
|
|
|
// 切换当前组件
|
|
|
pickComp(compId: string) {
|
|
@@ -47,6 +49,11 @@ export const editActions = EditorModule.action({
|
|
|
this.store.deleteComp(compId);
|
|
|
}
|
|
|
},
|
|
|
+ // 保存容器为组件
|
|
|
+ saveAsComp(comp: DesignComp) {
|
|
|
+ // todo: 保存为组件
|
|
|
+ console.log("comp: ", comp);
|
|
|
+ },
|
|
|
// 移动组件顺序
|
|
|
moveComp(selIndex: number, targetIndex: number) {
|
|
|
if (selIndex === targetIndex) return;
|