import { Dict_Apis, getPathname } from "@/dict"; import { UploadController } from "@queenjs/controllers"; import { ModuleRoot } from "queenjs"; import components from "../components"; import { CompUICtrl } from "../controllers/CompUICtrl"; import { HistoryCtrl } from "../controllers/HistoryCtrl"; import { ImagePickController } from "../controllers/ImagePickerController"; import { createProxy } from "../objects/ProxyStore/create"; import { editActions } from "./actions/edit"; import { ImgCompActions } from "./actions/image"; import { initActions } from "./actions/init"; import { helpers } from "./helpers"; import { editHelpers } from "./helpers/edit"; import { wxController } from "@/controllers/wxController"; import { ImageCropperCtrl } from "../controllers/CropperCtrl"; import { CtxMenuCtrl } from "../controllers/CtxMenuCtrl"; import { DragAddCtrl } from "../controllers/DragAddCtrl"; import { EditorCtrl } from "../controllers/EditorCtrl"; import { MediaCtrl } from "../controllers/MediaCtrl/indext"; import { PreviewCtrl } from "../controllers/PreviewCtrl"; import { ScreenCtrl } from "../controllers/ScreenCtrl"; import { SelectCtrl } from "../controllers/SelectCtrl"; import { CompObject } from "../controllers/SelectCtrl/compObj"; import { TextEditorCtrl } from "../controllers/TextEditorCtrl"; import { manualActions } from "./actions/editWithManualHistory"; import { https } from "./https"; import { store } from "./stores"; import { history } from "../objects/DesignTemp/factory"; import { PageCtrl } from "../controllers/PageCtrl"; import { PropsCtrl } from "../controllers/PropsCtrol"; export class EditorModule extends ModuleRoot { config = this.setConfig({ httpConfig: { baseURL: Dict_Apis.promotion, }, }); components = this.useComponents(components); actions = this.createActions([ initActions, editActions, ImgCompActions, manualActions, ]); https = this.createHttps(https); store = this.createStore(store); helper = this.createHelper([helpers, editHelpers]); controls = { uploader: new UploadController({ httpConfig: { baseURL: Dict_Apis.queentree, }, dir: "queenshow", }), wxCtrl: new wxController({ url: `${Dict_Apis.promotion}/wechat/share?`, }), dragAddCtrl: new DragAddCtrl(this), historyCtrl: new HistoryCtrl(this), pickCtrl: new ImagePickController(), compUICtrl: new CompUICtrl(this), selectCtrl: new SelectCtrl(this), cropCtrl: new ImageCropperCtrl(this), mediaCtrl: new MediaCtrl(this), textEditorCtrl: new TextEditorCtrl(this), screenCtrl: new ScreenCtrl(this), editorCtrl: new EditorCtrl(this), menuCtrl: new CtxMenuCtrl(this), previewCtrl: new PreviewCtrl(this), pageCtrl: new PageCtrl(this), propsCtrl: new PropsCtrl(this), }; compObjsMap = new Map(); onReady() { this.actions.init(); this.controls.uploader.ignoreDashField = true; this.controls.screenCtrl.initEvent(); this.controls.menuCtrl.initEvent(); this.controls.propsCtrl.initEvents(); } jumpIndexHtml(route = "#/") { const _params = new URLSearchParams(decodeURIComponent(location.search)); const host = _params.get("host"); let link = `${location.origin}${getPathname()}index.html?host=${host}${route}`; // if (location.host == "www.infish.cn") { // link = `${location.origin}${location.pathname}/projects/queenshowv1/index.html?host=${host}${route}`; // } location.href = link; } get selected () { return this.controls.selectCtrl.gizmo.state.transform.selected; } get gizmo() { return this.controls.selectCtrl.gizmo; } get history() { return history; } }