|
@@ -10,6 +10,9 @@ export const store = EditorModule.store({
|
|
|
currCompId: "root",
|
|
|
currStreamCardId: "",
|
|
|
designData: new DesignTemp(),
|
|
|
+
|
|
|
+ groupModeStatus: false,
|
|
|
+ groupIds: [] as string[],
|
|
|
}),
|
|
|
getters: {
|
|
|
isEditMode(): boolean {
|
|
@@ -24,7 +27,7 @@ export const store = EditorModule.store({
|
|
|
isPreview(state) {
|
|
|
return state.mode === "preview";
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
currComp(state) {
|
|
|
return state.designData.compMap[state.currCompId];
|
|
|
},
|
|
@@ -34,9 +37,9 @@ export const store = EditorModule.store({
|
|
|
pageCompIds(state): string[] {
|
|
|
return state.designData.compMap.root?.children.default || [];
|
|
|
},
|
|
|
- streamCardIds(state):string[] {
|
|
|
+ streamCardIds(state): string[] {
|
|
|
return state.designData.compMap.root?.children.default || [];
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
actions: {
|
|
|
setCompData(id: string, data: any) {
|
|
@@ -45,6 +48,13 @@ export const store = EditorModule.store({
|
|
|
setMode(v: EditorMode) {
|
|
|
this.store.mode = v;
|
|
|
},
|
|
|
+ setGroupMode(status: boolean) {
|
|
|
+ this.store.groupModeStatus = status;
|
|
|
+ this.store.groupIds = [];
|
|
|
+ if (this.store.currCompId) {
|
|
|
+ this.store.groupIds.push(this.store.currCompId);
|
|
|
+ }
|
|
|
+ },
|
|
|
initDesignData(data: Partial<DesignTemp>) {
|
|
|
this.store.designData = new DesignTemp(data);
|
|
|
},
|
|
@@ -68,44 +78,42 @@ export const store = EditorModule.store({
|
|
|
return compId;
|
|
|
},
|
|
|
setCurrComp(compId: string) {
|
|
|
-
|
|
|
-
|
|
|
this.store.currStreamCardId = "";
|
|
|
this.store.currCompId = compId;
|
|
|
|
|
|
- const find = (objs:string[], id:string):boolean=>{
|
|
|
- if (!objs || objs.length < 1) return false
|
|
|
+ const find = (objs: string[], id: string): boolean => {
|
|
|
+ if (!objs || objs.length < 1) return false;
|
|
|
|
|
|
if (objs.includes(id)) return true;
|
|
|
-
|
|
|
+
|
|
|
let n = objs.length;
|
|
|
let f = false;
|
|
|
- while(n--) {
|
|
|
- f = find(this.store.designData.compMap[objs[n]].children.default as any, id)
|
|
|
+ while (n--) {
|
|
|
+ f = find(
|
|
|
+ this.store.designData.compMap[objs[n]].children.default as any,
|
|
|
+ id
|
|
|
+ );
|
|
|
if (f) {
|
|
|
- break
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
return f;
|
|
|
- }
|
|
|
- const ids = this.store.streamCardIds
|
|
|
- if (ids.indexOf(compId) > - 1) {
|
|
|
+ };
|
|
|
+ const ids = this.store.streamCardIds;
|
|
|
+ if (ids.indexOf(compId) > -1) {
|
|
|
this.store.currStreamCardId = compId;
|
|
|
}
|
|
|
let i = ids.length;
|
|
|
- while(i--) {
|
|
|
- const isFind = find(this.store.designData.compMap[ids[i]].children.default as any, compId)
|
|
|
+ while (i--) {
|
|
|
+ const isFind = find(
|
|
|
+ this.store.designData.compMap[ids[i]].children.default as any,
|
|
|
+ compId
|
|
|
+ );
|
|
|
if (isFind) {
|
|
|
this.store.currStreamCardId = ids[i];
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // if (this.store.currStreamCardId != compId) {
|
|
|
-
|
|
|
- // }
|
|
|
-
|
|
|
- console.log("streamCard=>", this.store.currStreamCardId, "compId=>", this.store.currCompId)
|
|
|
},
|
|
|
|
|
|
deleteComp(compId: string) {
|
|
@@ -136,10 +144,6 @@ export const store = EditorModule.store({
|
|
|
const { pageCompIds } = this.store;
|
|
|
const [selComp] = pageCompIds.splice(selIndex, 1);
|
|
|
pageCompIds.splice(targetIndex, 0, selComp);
|
|
|
-
|
|
|
- // const currStreamCardId = this.store.currStreamCardId;
|
|
|
- // this.store.setCurrComp("")
|
|
|
- // this.store.currStreamCardId = currStreamCardId;
|
|
|
},
|
|
|
setTextEditingState(state: boolean) {
|
|
|
this.store.textEditingState = state;
|