@tmagic/editor 1.2.0-beta.20 → 1.2.0-beta.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{tmagic-editor.mjs → tmagic-editor.js} +55 -18
- package/dist/tmagic-editor.js.map +1 -0
- package/dist/{tmagic-editor.umd.js → tmagic-editor.umd.cjs} +55 -18
- package/dist/tmagic-editor.umd.cjs.map +1 -0
- package/package.json +14 -13
- package/src/Editor.vue +6 -7
- package/src/components/Layout.vue +1 -1
- package/src/services/BaseService.ts +5 -0
- package/src/services/codeBlock.ts +7 -1
- package/src/services/componentList.ts +6 -1
- package/src/services/editor.ts +8 -3
- package/src/services/events.ts +6 -1
- package/src/services/history.ts +3 -2
- package/src/services/props.ts +6 -1
- package/src/services/storage.ts +1 -0
- package/src/services/ui.ts +12 -0
- package/types/services/BaseService.d.ts +1 -0
- package/types/services/codeBlock.d.ts +1 -0
- package/types/services/componentList.d.ts +1 -0
- package/types/services/editor.d.ts +1 -0
- package/types/services/events.d.ts +1 -0
- package/types/services/history.d.ts +1 -1
- package/types/services/props.d.ts +1 -0
- package/types/services/ui.d.ts +1 -0
- package/dist/tmagic-editor.mjs.map +0 -1
- package/dist/tmagic-editor.umd.js.map +0 -1
|
@@ -535,7 +535,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
535
535
|
const props = __props;
|
|
536
536
|
const el = ref();
|
|
537
537
|
const hasLeft = computed(() => typeof props.left !== "undefined");
|
|
538
|
-
const hasRight = computed(() => typeof props.
|
|
538
|
+
const hasRight = computed(() => typeof props.right !== "undefined");
|
|
539
539
|
const getCenterWidth = (clientWidth2, left, right) => {
|
|
540
540
|
let center2 = clientWidth2 - left - right;
|
|
541
541
|
if (center2 < props.minCenter) {
|
|
@@ -857,6 +857,10 @@ class BaseService extends EventEmitter {
|
|
|
857
857
|
this.pluginOptionsList[methodName2].push(method);
|
|
858
858
|
});
|
|
859
859
|
}
|
|
860
|
+
removeAllPlugins() {
|
|
861
|
+
this.pluginOptionsList = {};
|
|
862
|
+
this.middleware = {};
|
|
863
|
+
}
|
|
860
864
|
async doTask() {
|
|
861
865
|
this.doingTask = true;
|
|
862
866
|
let task = this.taskList.shift();
|
|
@@ -1035,7 +1039,7 @@ class CodeBlock extends BaseService {
|
|
|
1035
1039
|
this.refreshRelationDeep(node, codeDsl2);
|
|
1036
1040
|
this.setCodeDsl(codeDsl2);
|
|
1037
1041
|
}
|
|
1038
|
-
|
|
1042
|
+
resetState() {
|
|
1039
1043
|
this.state.isShowCodeEditor = false;
|
|
1040
1044
|
this.state.codeDsl = null;
|
|
1041
1045
|
this.state.id = "";
|
|
@@ -1044,6 +1048,11 @@ class CodeBlock extends BaseService {
|
|
|
1044
1048
|
this.state.combineIds = [];
|
|
1045
1049
|
this.state.undeletableList = [];
|
|
1046
1050
|
}
|
|
1051
|
+
destroy() {
|
|
1052
|
+
this.resetState();
|
|
1053
|
+
this.removeAllListeners();
|
|
1054
|
+
this.removeAllPlugins();
|
|
1055
|
+
}
|
|
1047
1056
|
refreshRelationDeep(node, codeDsl2) {
|
|
1048
1057
|
if (!node.id)
|
|
1049
1058
|
return;
|
|
@@ -1162,7 +1171,7 @@ class History extends BaseService {
|
|
|
1162
1171
|
this.setCanUndoRedo();
|
|
1163
1172
|
this.emit("page-change", this.state.pageSteps[this.state.pageId]);
|
|
1164
1173
|
}
|
|
1165
|
-
|
|
1174
|
+
resetState() {
|
|
1166
1175
|
this.state.pageId = void 0;
|
|
1167
1176
|
this.state.pageSteps = {};
|
|
1168
1177
|
this.state.canRedo = false;
|
|
@@ -1193,8 +1202,9 @@ class History extends BaseService {
|
|
|
1193
1202
|
return state;
|
|
1194
1203
|
}
|
|
1195
1204
|
destroy() {
|
|
1196
|
-
this.
|
|
1205
|
+
this.resetState();
|
|
1197
1206
|
this.removeAllListeners();
|
|
1207
|
+
this.removeAllPlugins();
|
|
1198
1208
|
}
|
|
1199
1209
|
getUndoRedo() {
|
|
1200
1210
|
if (!this.state.pageId)
|
|
@@ -1274,6 +1284,7 @@ class WebStorage extends BaseService {
|
|
|
1274
1284
|
}
|
|
1275
1285
|
destroy() {
|
|
1276
1286
|
this.removeAllListeners();
|
|
1287
|
+
this.removeAllPlugins();
|
|
1277
1288
|
}
|
|
1278
1289
|
getValueAndProtocol(value) {
|
|
1279
1290
|
let protocol2 = "";
|
|
@@ -1545,10 +1556,14 @@ class Props extends BaseService {
|
|
|
1545
1556
|
name: type
|
|
1546
1557
|
};
|
|
1547
1558
|
}
|
|
1548
|
-
|
|
1559
|
+
resetState() {
|
|
1549
1560
|
this.state.propsConfigMap = {};
|
|
1550
1561
|
this.state.propsValueMap = {};
|
|
1562
|
+
}
|
|
1563
|
+
destroy() {
|
|
1564
|
+
this.resetState();
|
|
1551
1565
|
this.removeAllListeners();
|
|
1566
|
+
this.removeAllPlugins();
|
|
1552
1567
|
}
|
|
1553
1568
|
guid(digit = 8) {
|
|
1554
1569
|
return "x".repeat(digit).replace(/[xy]/g, (c) => {
|
|
@@ -1740,7 +1755,7 @@ class Editor$1 extends BaseService {
|
|
|
1740
1755
|
if (page) {
|
|
1741
1756
|
historyService.changePage(toRaw(page));
|
|
1742
1757
|
} else {
|
|
1743
|
-
historyService.
|
|
1758
|
+
historyService.resetState();
|
|
1744
1759
|
}
|
|
1745
1760
|
if (node?.id) {
|
|
1746
1761
|
this.get("stage")?.renderer.runtime?.getApp?.()?.emit(
|
|
@@ -2119,8 +2134,7 @@ class Editor$1 extends BaseService {
|
|
|
2119
2134
|
}
|
|
2120
2135
|
});
|
|
2121
2136
|
}
|
|
2122
|
-
|
|
2123
|
-
this.removeAllListeners();
|
|
2137
|
+
resetState() {
|
|
2124
2138
|
this.set("root", null);
|
|
2125
2139
|
this.set("node", null);
|
|
2126
2140
|
this.set("nodes", []);
|
|
@@ -2131,6 +2145,11 @@ class Editor$1 extends BaseService {
|
|
|
2131
2145
|
this.set("modifiedNodeIds", /* @__PURE__ */ new Map());
|
|
2132
2146
|
this.set("pageLength", /* @__PURE__ */ new Map());
|
|
2133
2147
|
}
|
|
2148
|
+
destroy() {
|
|
2149
|
+
this.removeAllListeners();
|
|
2150
|
+
this.resetState();
|
|
2151
|
+
this.removeAllPlugins();
|
|
2152
|
+
}
|
|
2134
2153
|
resetModifiedNodeId() {
|
|
2135
2154
|
this.get("modifiedNodeIds").clear();
|
|
2136
2155
|
}
|
|
@@ -2257,10 +2276,14 @@ class Events extends BaseService {
|
|
|
2257
2276
|
getMethod(type) {
|
|
2258
2277
|
return cloneDeep(methodMap[type] || DEFAULT_METHODS);
|
|
2259
2278
|
}
|
|
2260
|
-
|
|
2279
|
+
resetState() {
|
|
2261
2280
|
eventMap = reactive({});
|
|
2262
2281
|
methodMap = reactive({});
|
|
2282
|
+
}
|
|
2283
|
+
destroy() {
|
|
2284
|
+
this.resetState();
|
|
2263
2285
|
this.removeAllListeners();
|
|
2286
|
+
this.removeAllPlugins();
|
|
2264
2287
|
}
|
|
2265
2288
|
}
|
|
2266
2289
|
const eventsService = new Events();
|
|
@@ -2535,8 +2558,19 @@ class Ui extends BaseService {
|
|
|
2535
2558
|
}
|
|
2536
2559
|
return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
|
|
2537
2560
|
}
|
|
2561
|
+
resetState() {
|
|
2562
|
+
this.set("showSrc", false);
|
|
2563
|
+
this.set("uiSelectMode", false);
|
|
2564
|
+
this.set("zoom", 1);
|
|
2565
|
+
this.set("stageContainerRect", {
|
|
2566
|
+
width: 0,
|
|
2567
|
+
height: 0
|
|
2568
|
+
});
|
|
2569
|
+
}
|
|
2538
2570
|
destroy() {
|
|
2571
|
+
this.resetState();
|
|
2539
2572
|
this.removeAllListeners();
|
|
2573
|
+
this.removeAllPlugins();
|
|
2540
2574
|
}
|
|
2541
2575
|
async setStageRect(value) {
|
|
2542
2576
|
state.stageRect = {
|
|
@@ -5745,9 +5779,13 @@ class ComponentList extends BaseService {
|
|
|
5745
5779
|
getList() {
|
|
5746
5780
|
return this.state.list;
|
|
5747
5781
|
}
|
|
5748
|
-
|
|
5782
|
+
resetState() {
|
|
5749
5783
|
this.state.list = [];
|
|
5784
|
+
}
|
|
5785
|
+
destroy() {
|
|
5786
|
+
this.resetState();
|
|
5750
5787
|
this.removeAllListeners();
|
|
5788
|
+
this.removeAllPlugins();
|
|
5751
5789
|
}
|
|
5752
5790
|
}
|
|
5753
5791
|
const componentListService = new ComponentList();
|
|
@@ -5922,13 +5960,12 @@ const _sfc_main = defineComponent({
|
|
|
5922
5960
|
}
|
|
5923
5961
|
);
|
|
5924
5962
|
onUnmounted(() => {
|
|
5925
|
-
editorService.
|
|
5926
|
-
historyService.
|
|
5927
|
-
propsService.
|
|
5928
|
-
uiService.
|
|
5929
|
-
componentListService.
|
|
5930
|
-
|
|
5931
|
-
codeBlockService.destroy();
|
|
5963
|
+
editorService.resetState();
|
|
5964
|
+
historyService.resetState();
|
|
5965
|
+
propsService.resetState();
|
|
5966
|
+
uiService.resetState();
|
|
5967
|
+
componentListService.resetState();
|
|
5968
|
+
codeBlockService.resetState();
|
|
5932
5969
|
});
|
|
5933
5970
|
const services = {
|
|
5934
5971
|
componentListService,
|
|
@@ -6075,4 +6112,4 @@ const index = {
|
|
|
6075
6112
|
};
|
|
6076
6113
|
|
|
6077
6114
|
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$e as CodeBlockList, CodeDeleteErrorType, CodeEditorMode, _sfc_main$s as CodeSelect, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$n as Icon, Keys, LayerOffset, _sfc_main$a as LayerPanel, Layout, _sfc_main$o as LayoutContainer, _sfc_main$i as PropsPanel, _sfc_main$q as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$k as ToolButton, V_GUIDE_LINE_STORAGE_KEY, beforePaste, change2Fixed, codeBlockService, debug, index as default, editorService, error, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, uiService, useStage, warn };
|
|
6078
|
-
//# sourceMappingURL=tmagic-editor.
|
|
6115
|
+
//# sourceMappingURL=tmagic-editor.js.map
|