import { EditorModule } from ".."; import { createProxyEffect } from "../../objects/ProxyStore/create"; import { EditorMode } from "../../typings"; import { editActions } from "./edit"; export const initActions = EditorModule.action({ // 模块初始化 init() { const { historyCtrl } = this.controls; historyCtrl.bindActions(Object.keys(editActions)); this.controls.compUICtrl.init(); createProxyEffect(this.store, (type, paths, value, oldValue) => { if (paths[0] === "designData" || paths[0] === "currCompId") { historyCtrl.record(this.store, type, paths, value, oldValue); } }); }, // 初始化数据 async initDesign(id: string) { const ret = await this.https[ this.store.isEditComp ? "getCompDetail" : "getDesignDetail" ](id); this.store.initDesignData(ret.result); }, // 切换模式 switchMode(v: EditorMode) { this.store.setMode(v); }, });