@tmagic/editor 1.1.0-beta.5 → 1.1.0-beta.6
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.es.js → tmagic-editor.mjs} +1383 -1199
- package/dist/tmagic-editor.mjs.map +1 -0
- package/dist/tmagic-editor.umd.js +1396 -1211
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +21 -19
- package/src/Editor.vue +14 -12
- package/src/components/ContentMenu.vue +87 -99
- package/src/components/ScrollViewer.vue +1 -1
- package/src/components/ToolButton.vue +150 -167
- package/src/fields/UISelect.vue +50 -70
- package/src/index.ts +1 -0
- package/src/layouts/AddPageBox.vue +2 -2
- package/src/layouts/Framework.vue +1 -1
- package/src/layouts/NavMenu.vue +2 -2
- package/src/layouts/PropsPanel.vue +1 -1
- package/src/layouts/Resizer.vue +1 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +2 -2
- package/src/layouts/sidebar/LayerMenu.vue +2 -2
- package/src/layouts/sidebar/LayerPanel.vue +3 -3
- package/src/layouts/sidebar/Sidebar.vue +1 -1
- package/src/layouts/sidebar/TabPane.vue +2 -2
- package/src/layouts/workspace/PageBar.vue +53 -64
- package/src/layouts/workspace/Stage.vue +195 -222
- package/src/layouts/workspace/ViewerMenu.vue +142 -146
- package/src/layouts/workspace/Workspace.vue +11 -11
- package/src/services/BaseService.ts +1 -1
- package/src/services/componentList.ts +3 -3
- package/src/services/editor.ts +114 -133
- package/src/services/events.ts +1 -1
- package/src/services/history.ts +1 -1
- package/src/services/props.ts +18 -5
- package/src/services/storage.ts +133 -0
- package/src/services/ui.ts +2 -2
- package/src/type.ts +22 -6
- package/src/utils/config.ts +1 -1
- package/src/utils/editor.ts +1 -1
- package/src/utils/operator.ts +210 -0
- package/src/utils/props.ts +2 -2
- package/src/utils/scroll-viewer.ts +1 -1
- package/tsconfig.build.json +13 -0
- package/{dist/types/src → types}/Editor.vue.d.ts +7 -8
- package/types/components/ContentMenu.vue.d.ts +116 -0
- package/types/components/Icon.vue.d.ts +13 -0
- package/types/components/ScrollViewer.vue.d.ts +22 -0
- package/types/components/ToolButton.vue.d.ts +109 -0
- package/types/fields/Code.vue.d.ts +23 -0
- package/{dist/types/src → types}/fields/CodeLink.vue.d.ts +4 -6
- package/types/fields/UISelect.vue.d.ts +87 -0
- package/{dist/types/src → types}/index.d.ts +4 -1
- package/types/layouts/AddPageBox.vue.d.ts +4 -0
- package/{dist/types/src → types}/layouts/CodeEditor.vue.d.ts +11 -13
- package/types/layouts/Framework.vue.d.ts +22 -0
- package/types/layouts/NavMenu.vue.d.ts +25 -0
- package/types/layouts/PropsPanel.vue.d.ts +245 -0
- package/types/layouts/Resizer.vue.d.ts +12 -0
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +14 -0
- package/types/layouts/sidebar/LayerMenu.vue.d.ts +100 -0
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +1099 -0
- package/{dist/types/src → types}/layouts/sidebar/Sidebar.vue.d.ts +3 -5
- package/types/layouts/sidebar/TabPane.vue.d.ts +14 -0
- package/types/layouts/workspace/PageBar.vue.d.ts +54 -0
- package/types/layouts/workspace/Stage.vue.d.ts +46 -0
- package/types/layouts/workspace/ViewerMenu.vue.d.ts +88 -0
- package/types/layouts/workspace/Workspace.vue.d.ts +6 -0
- package/{dist/types/src → types}/services/BaseService.d.ts +0 -0
- package/types/services/componentList.d.ts +14 -0
- package/{dist/types/src → types}/services/editor.d.ts +26 -11
- package/{dist/types/src → types}/services/events.d.ts +0 -0
- package/{dist/types/src → types}/services/history.d.ts +0 -0
- package/{dist/types/src → types}/services/props.d.ts +6 -0
- package/types/services/storage.d.ts +56 -0
- package/{dist/types/src → types}/services/ui.d.ts +1 -1
- package/{dist/types/src → types}/type.d.ts +15 -0
- package/{dist/types/src → types}/utils/compose.d.ts +1 -1
- package/{dist/types/src → types}/utils/config.d.ts +0 -0
- package/{dist/types/src → types}/utils/editor.d.ts +2 -2
- package/{dist/types/src → types}/utils/index.d.ts +0 -0
- package/{dist/types/src → types}/utils/logger.d.ts +0 -0
- package/types/utils/operator.d.ts +44 -0
- package/{dist/types/src → types}/utils/polyfills.d.ts +0 -0
- package/{dist/types/src → types}/utils/props.d.ts +2 -2
- package/{dist/types/src → types}/utils/scroll-viewer.d.ts +0 -0
- package/{dist/types/src → types}/utils/undo-redo.d.ts +0 -0
- package/dist/tmagic-editor.es.js.map +0 -1
- package/dist/types/src/components/Icon.vue.d.ts +0 -14
- package/dist/types/src/components/ScrollViewer.vue.d.ts +0 -24
- package/dist/types/src/fields/Code.vue.d.ts +0 -25
- package/dist/types/src/layouts/AddPageBox.vue.d.ts +0 -5
- package/dist/types/src/layouts/Framework.vue.d.ts +0 -24
- package/dist/types/src/layouts/NavMenu.vue.d.ts +0 -27
- package/dist/types/src/layouts/PropsPanel.vue.d.ts +0 -13
- package/dist/types/src/layouts/Resizer.vue.d.ts +0 -14
- package/dist/types/src/layouts/sidebar/ComponentListPanel.vue.d.ts +0 -16
- package/dist/types/src/layouts/sidebar/TabPane.vue.d.ts +0 -16
- package/dist/types/src/layouts/workspace/Workspace.vue.d.ts +0 -8
- package/dist/types/src/shims-vue.d.ts +0 -6
- package/dist/types/src/vite-env.d.ts +0 -1
- package/src/vite-env.d.ts +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, ref, watchEffect, inject,
|
|
1
|
+
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, ref, watchEffect, inject, createElementBlock, createVNode, unref, withCtx, withModifiers, createCommentVNode, createTextVNode, toDisplayString, watch, onMounted, onUnmounted, reactive, toRaw, createElementVNode, renderSlot, Fragment, normalizeClass, resolveDynamicComponent, markRaw, renderList, normalizeProps, mergeProps, getCurrentInstance, Teleport, nextTick, toHandlers, createSlots, provide } from 'vue';
|
|
2
2
|
import serialize from 'serialize-javascript';
|
|
3
|
-
import { Delete,
|
|
4
|
-
import { throttle, cloneDeep, mergeWith,
|
|
3
|
+
import { Delete, Close, Plus, Edit, Grid, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, ArrowDown, Files, DocumentCopy, Coin, ArrowLeftBold, CaretBottom, ArrowRightBold, Top, Bottom } from '@element-plus/icons-vue';
|
|
4
|
+
import { throttle, cloneDeep, mergeWith, isEmpty, uniq } from 'lodash-es';
|
|
5
5
|
import * as monaco from 'monaco-editor';
|
|
6
6
|
import StageCore, { GuidesType, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS } from '@tmagic/stage';
|
|
7
7
|
import { NodeType } from '@tmagic/schema';
|
|
8
|
-
import {
|
|
8
|
+
import { isPop, getNodePath, isNumber, isPage, toLine, removeClassNameByClassName } from '@tmagic/utils';
|
|
9
9
|
import { EventEmitter } from 'events';
|
|
10
10
|
import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
|
|
11
11
|
import Gesto from 'gesto';
|
|
@@ -19,14 +19,6 @@ if (typeof globalThis === "undefined") {
|
|
|
19
19
|
window.globalThis = window;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
var _export_sfc = (sfc, props) => {
|
|
23
|
-
const target = sfc.__vccOpts || sfc;
|
|
24
|
-
for (const [key, val] of props) {
|
|
25
|
-
target[key] = val;
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
22
|
const _sfc_main$m = defineComponent({
|
|
31
23
|
name: "m-fields-vs-code",
|
|
32
24
|
props: ["model", "name", "config", "prop"],
|
|
@@ -44,7 +36,16 @@ const _sfc_main$m = defineComponent({
|
|
|
44
36
|
};
|
|
45
37
|
}
|
|
46
38
|
});
|
|
47
|
-
|
|
39
|
+
|
|
40
|
+
const _export_sfc = (sfc, props) => {
|
|
41
|
+
const target = sfc.__vccOpts || sfc;
|
|
42
|
+
for (const [key, val] of props) {
|
|
43
|
+
target[key] = val;
|
|
44
|
+
}
|
|
45
|
+
return target;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
48
49
|
const _component_magic_code_editor = resolveComponent("magic-code-editor");
|
|
49
50
|
return openBlock(), createBlock(_component_magic_code_editor, {
|
|
50
51
|
style: normalizeStyle(`height: ${_ctx.height}`),
|
|
@@ -53,7 +54,7 @@ function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
53
54
|
onSave: _ctx.save
|
|
54
55
|
}, null, 8, ["style", "init-values", "language", "onSave"]);
|
|
55
56
|
}
|
|
56
|
-
|
|
57
|
+
const Code = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$g]]);
|
|
57
58
|
|
|
58
59
|
const _sfc_main$l = defineComponent({
|
|
59
60
|
name: "m-fields-code-link",
|
|
@@ -110,7 +111,8 @@ const _sfc_main$l = defineComponent({
|
|
|
110
111
|
};
|
|
111
112
|
}
|
|
112
113
|
});
|
|
113
|
-
|
|
114
|
+
|
|
115
|
+
function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
114
116
|
const _component_m_fields_link = resolveComponent("m-fields-link");
|
|
115
117
|
return openBlock(), createBlock(_component_m_fields_link, {
|
|
116
118
|
config: _ctx.formConfig,
|
|
@@ -119,26 +121,21 @@ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
119
121
|
onChange: _ctx.changeHandler
|
|
120
122
|
}, null, 8, ["config", "model", "onChange"]);
|
|
121
123
|
}
|
|
122
|
-
|
|
124
|
+
const CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$f]]);
|
|
123
125
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
name: "m-fields-ui-select",
|
|
126
|
+
const _hoisted_1$d = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
|
|
127
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
128
|
+
__name: "UISelect",
|
|
128
129
|
props: {
|
|
129
|
-
labelWidth:
|
|
130
|
-
config:
|
|
131
|
-
model:
|
|
132
|
-
prop:
|
|
133
|
-
|
|
134
|
-
default() {
|
|
135
|
-
return "";
|
|
136
|
-
}
|
|
137
|
-
},
|
|
138
|
-
name: String
|
|
130
|
+
labelWidth: null,
|
|
131
|
+
config: null,
|
|
132
|
+
model: null,
|
|
133
|
+
prop: null,
|
|
134
|
+
name: null
|
|
139
135
|
},
|
|
140
136
|
emits: ["change"],
|
|
141
|
-
setup(
|
|
137
|
+
setup(__props, { emit }) {
|
|
138
|
+
const props = __props;
|
|
142
139
|
const services = inject("services");
|
|
143
140
|
const mForm = inject("mForm");
|
|
144
141
|
const val = computed(() => props.model[props.name]);
|
|
@@ -160,92 +157,84 @@ const _sfc_main$k = defineComponent({
|
|
|
160
157
|
cancelHandler();
|
|
161
158
|
}
|
|
162
159
|
};
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
},
|
|
180
|
-
cancelHandler,
|
|
181
|
-
deleteHandler() {
|
|
182
|
-
if (props.model) {
|
|
183
|
-
props.model[props.name] = "";
|
|
184
|
-
emit("change", "");
|
|
185
|
-
mForm?.$emit("field-change", props.prop, "");
|
|
186
|
-
}
|
|
160
|
+
const toName = computed(() => {
|
|
161
|
+
const config = services?.editorService.getNodeById(val.value);
|
|
162
|
+
return config?.name || "";
|
|
163
|
+
});
|
|
164
|
+
const startSelect = () => {
|
|
165
|
+
if (!services?.uiService)
|
|
166
|
+
return;
|
|
167
|
+
services.uiService.set("uiSelectMode", true);
|
|
168
|
+
uiSelectMode.value = true;
|
|
169
|
+
globalThis.document.addEventListener("ui-select", clickHandler);
|
|
170
|
+
};
|
|
171
|
+
const deleteHandler = () => {
|
|
172
|
+
if (props.model) {
|
|
173
|
+
props.model[props.name] = "";
|
|
174
|
+
emit("change", "");
|
|
175
|
+
mForm?.$emit("field-change", props.prop, "");
|
|
187
176
|
}
|
|
188
177
|
};
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
class: "m-fields-ui-select",
|
|
198
|
-
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.cancelHandler && _ctx.cancelHandler(...args))
|
|
199
|
-
}, [
|
|
200
|
-
createVNode(_component_el_button, {
|
|
201
|
-
type: "danger",
|
|
202
|
-
icon: _ctx.Delete,
|
|
203
|
-
text: "",
|
|
204
|
-
style: { "padding": "0" }
|
|
205
|
-
}, {
|
|
206
|
-
default: withCtx(() => [
|
|
207
|
-
_hoisted_1$d
|
|
208
|
-
]),
|
|
209
|
-
_: 1
|
|
210
|
-
}, 8, ["icon"])
|
|
211
|
-
])) : (openBlock(), createElementBlock("div", {
|
|
212
|
-
key: 1,
|
|
213
|
-
class: "m-fields-ui-select",
|
|
214
|
-
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.startSelect && _ctx.startSelect(...args)),
|
|
215
|
-
style: { "display": "flex" }
|
|
216
|
-
}, [
|
|
217
|
-
createVNode(_component_el_tooltip, { content: "\u6E05\u9664" }, {
|
|
218
|
-
default: withCtx(() => [
|
|
219
|
-
_ctx.val ? (openBlock(), createBlock(_component_el_button, {
|
|
220
|
-
key: 0,
|
|
221
|
-
style: { "padding": "0" },
|
|
222
|
-
type: "danger",
|
|
223
|
-
icon: _ctx.Close,
|
|
224
|
-
text: "",
|
|
225
|
-
onClick: withModifiers(_ctx.deleteHandler, ["stop"])
|
|
226
|
-
}, null, 8, ["icon", "onClick"])) : createCommentVNode("", true)
|
|
227
|
-
]),
|
|
228
|
-
_: 1
|
|
229
|
-
}),
|
|
230
|
-
createVNode(_component_el_tooltip, {
|
|
231
|
-
content: _ctx.val ? _ctx.toName + "_" + _ctx.val : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
|
|
232
|
-
}, {
|
|
233
|
-
default: withCtx(() => [
|
|
178
|
+
return (_ctx, _cache) => {
|
|
179
|
+
const _component_el_button = resolveComponent("el-button");
|
|
180
|
+
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
181
|
+
return uiSelectMode.value ? (openBlock(), createElementBlock("div", {
|
|
182
|
+
key: 0,
|
|
183
|
+
class: "m-fields-ui-select",
|
|
184
|
+
onClick: cancelHandler
|
|
185
|
+
}, [
|
|
234
186
|
createVNode(_component_el_button, {
|
|
187
|
+
type: "danger",
|
|
188
|
+
icon: unref(Delete),
|
|
235
189
|
text: "",
|
|
236
|
-
style: { "padding": "0"
|
|
190
|
+
style: { "padding": "0" }
|
|
237
191
|
}, {
|
|
238
192
|
default: withCtx(() => [
|
|
239
|
-
|
|
193
|
+
_hoisted_1$d
|
|
240
194
|
]),
|
|
241
195
|
_: 1
|
|
242
|
-
})
|
|
243
|
-
]),
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
|
|
196
|
+
}, 8, ["icon"])
|
|
197
|
+
])) : (openBlock(), createElementBlock("div", {
|
|
198
|
+
key: 1,
|
|
199
|
+
class: "m-fields-ui-select",
|
|
200
|
+
onClick: startSelect,
|
|
201
|
+
style: { "display": "flex" }
|
|
202
|
+
}, [
|
|
203
|
+
createVNode(_component_el_tooltip, { content: "\u6E05\u9664" }, {
|
|
204
|
+
default: withCtx(() => [
|
|
205
|
+
unref(val) ? (openBlock(), createBlock(_component_el_button, {
|
|
206
|
+
key: 0,
|
|
207
|
+
style: { "padding": "0" },
|
|
208
|
+
type: "danger",
|
|
209
|
+
icon: unref(Close),
|
|
210
|
+
text: "",
|
|
211
|
+
onClick: withModifiers(deleteHandler, ["stop"])
|
|
212
|
+
}, null, 8, ["icon", "onClick"])) : createCommentVNode("", true)
|
|
213
|
+
]),
|
|
214
|
+
_: 1
|
|
215
|
+
}),
|
|
216
|
+
createVNode(_component_el_tooltip, {
|
|
217
|
+
content: unref(val) ? unref(toName) + "_" + unref(val) : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
|
|
218
|
+
}, {
|
|
219
|
+
default: withCtx(() => [
|
|
220
|
+
createVNode(_component_el_button, {
|
|
221
|
+
text: "",
|
|
222
|
+
style: { "padding": "0", "margin": "0" }
|
|
223
|
+
}, {
|
|
224
|
+
default: withCtx(() => [
|
|
225
|
+
createTextVNode(toDisplayString(unref(val) ? unref(toName) + "_" + unref(val) : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"), 1)
|
|
226
|
+
]),
|
|
227
|
+
_: 1
|
|
228
|
+
})
|
|
229
|
+
]),
|
|
230
|
+
_: 1
|
|
231
|
+
}, 8, ["content"])
|
|
232
|
+
]));
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
249
238
|
|
|
250
239
|
const toString = (v, language) => {
|
|
251
240
|
let value = "";
|
|
@@ -369,14 +358,15 @@ const _sfc_main$j = defineComponent({
|
|
|
369
358
|
};
|
|
370
359
|
}
|
|
371
360
|
});
|
|
361
|
+
|
|
372
362
|
const _hoisted_1$c = {
|
|
373
363
|
ref: "codeEditor",
|
|
374
364
|
class: "magic-code-editor"
|
|
375
365
|
};
|
|
376
|
-
function _sfc_render$
|
|
366
|
+
function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
|
|
377
367
|
return openBlock(), createElementBlock("div", _hoisted_1$c, null, 512);
|
|
378
368
|
}
|
|
379
|
-
|
|
369
|
+
const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$e]]);
|
|
380
370
|
|
|
381
371
|
let $TMAGIC_EDITOR = {};
|
|
382
372
|
const setConfig = (option) => {
|
|
@@ -385,6 +375,9 @@ const setConfig = (option) => {
|
|
|
385
375
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
386
376
|
|
|
387
377
|
class UndoRedo {
|
|
378
|
+
elementList;
|
|
379
|
+
listCursor;
|
|
380
|
+
listMaxSize;
|
|
388
381
|
constructor(listMaxSize = 200) {
|
|
389
382
|
const minListMaxSize = 2;
|
|
390
383
|
this.elementList = [];
|
|
@@ -480,12 +473,12 @@ const doAction = async (args, scope, sourceMethod, beforeMethodName, afterMethod
|
|
|
480
473
|
}
|
|
481
474
|
};
|
|
482
475
|
class BaseService extends EventEmitter {
|
|
476
|
+
pluginOptionsList = {};
|
|
477
|
+
middleware = {};
|
|
478
|
+
taskList = [];
|
|
479
|
+
doingTask = false;
|
|
483
480
|
constructor(methods = [], serialMethods = []) {
|
|
484
481
|
super();
|
|
485
|
-
this.pluginOptionsList = {};
|
|
486
|
-
this.middleware = {};
|
|
487
|
-
this.taskList = [];
|
|
488
|
-
this.doingTask = false;
|
|
489
482
|
methods.forEach((propertyName) => {
|
|
490
483
|
const scope = this;
|
|
491
484
|
const sourceMethod = scope[propertyName];
|
|
@@ -542,14 +535,14 @@ class BaseService extends EventEmitter {
|
|
|
542
535
|
}
|
|
543
536
|
|
|
544
537
|
class History extends BaseService {
|
|
538
|
+
state = reactive({
|
|
539
|
+
pageSteps: {},
|
|
540
|
+
pageId: void 0,
|
|
541
|
+
canRedo: false,
|
|
542
|
+
canUndo: false
|
|
543
|
+
});
|
|
545
544
|
constructor() {
|
|
546
545
|
super([]);
|
|
547
|
-
this.state = reactive({
|
|
548
|
-
pageSteps: {},
|
|
549
|
-
pageId: void 0,
|
|
550
|
-
canRedo: false,
|
|
551
|
-
canUndo: false
|
|
552
|
-
});
|
|
553
546
|
this.on("change", this.setCanUndoRedo);
|
|
554
547
|
}
|
|
555
548
|
reset() {
|
|
@@ -618,117 +611,88 @@ class History extends BaseService {
|
|
|
618
611
|
this.state.canUndo = undoRedo?.canUndo() || false;
|
|
619
612
|
}
|
|
620
613
|
}
|
|
621
|
-
|
|
614
|
+
const historyService = new History();
|
|
622
615
|
|
|
623
|
-
|
|
616
|
+
var Protocol = /* @__PURE__ */ ((Protocol2) => {
|
|
617
|
+
Protocol2["OBJECT"] = "object";
|
|
618
|
+
Protocol2["JSON"] = "json";
|
|
619
|
+
Protocol2["STRING"] = "string";
|
|
620
|
+
Protocol2["NUMBER"] = "number";
|
|
621
|
+
Protocol2["BOOLEAN"] = "boolean";
|
|
622
|
+
return Protocol2;
|
|
623
|
+
})(Protocol || {});
|
|
624
|
+
class WebStorage extends BaseService {
|
|
625
|
+
storage = globalThis.localStorage;
|
|
626
|
+
namespace = "tmagic";
|
|
624
627
|
constructor() {
|
|
625
|
-
super([
|
|
626
|
-
"setPropsConfig",
|
|
627
|
-
"getPropsConfig",
|
|
628
|
-
"setPropsValue",
|
|
629
|
-
"getPropsValue",
|
|
630
|
-
"createId",
|
|
631
|
-
"setNewItemId",
|
|
632
|
-
"getDefaultPropsValue"
|
|
633
|
-
]);
|
|
634
|
-
this.state = reactive({
|
|
635
|
-
propsConfigMap: {},
|
|
636
|
-
propsValueMap: {}
|
|
637
|
-
});
|
|
638
|
-
}
|
|
639
|
-
setPropsConfigs(configs) {
|
|
640
|
-
Object.keys(configs).forEach((type) => {
|
|
641
|
-
this.setPropsConfig(toLine(type), configs[type]);
|
|
642
|
-
});
|
|
643
|
-
this.emit("props-configs-change");
|
|
644
|
-
}
|
|
645
|
-
setPropsConfig(type, config) {
|
|
646
|
-
this.state.propsConfigMap[type] = fillConfig(Array.isArray(config) ? config : [config]);
|
|
628
|
+
super(["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"]);
|
|
647
629
|
}
|
|
648
|
-
async
|
|
649
|
-
|
|
650
|
-
return await this.getPropsConfig("button");
|
|
651
|
-
}
|
|
652
|
-
return cloneDeep(this.state.propsConfigMap[type] || DEFAULT_CONFIG);
|
|
630
|
+
async getStorage() {
|
|
631
|
+
return this.storage;
|
|
653
632
|
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
this.setPropsValue(toLine(type), values[type]);
|
|
657
|
-
});
|
|
633
|
+
async getNamespace() {
|
|
634
|
+
return this.namespace;
|
|
658
635
|
}
|
|
659
|
-
|
|
660
|
-
|
|
636
|
+
async clear() {
|
|
637
|
+
const storage2 = await this.getStorage();
|
|
638
|
+
storage2.clear();
|
|
661
639
|
}
|
|
662
|
-
async
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
640
|
+
async getItem(key, options = {}) {
|
|
641
|
+
const [storage, namespace] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
642
|
+
const { protocol = options.protocol, item } = this.getValueAndProtocol(storage.getItem(`${options.namespace || namespace}:${key}`));
|
|
643
|
+
if (item === null)
|
|
644
|
+
return null;
|
|
645
|
+
switch (protocol) {
|
|
646
|
+
case "object" /* OBJECT */:
|
|
647
|
+
return eval(`(${item})`);
|
|
648
|
+
case "json" /* JSON */:
|
|
649
|
+
return JSON.parse(item);
|
|
650
|
+
case "number" /* NUMBER */:
|
|
651
|
+
return Number(item);
|
|
652
|
+
case "boolean" /* BOOLEAN */:
|
|
653
|
+
return Boolean(item);
|
|
654
|
+
default:
|
|
655
|
+
return item;
|
|
671
656
|
}
|
|
672
|
-
const [id, defaultPropsValue, data] = await Promise.all([
|
|
673
|
-
this.createId(type),
|
|
674
|
-
this.getDefaultPropsValue(type),
|
|
675
|
-
this.setNewItemId(cloneDeep({
|
|
676
|
-
type,
|
|
677
|
-
...defaultValue
|
|
678
|
-
}))
|
|
679
|
-
]);
|
|
680
|
-
return {
|
|
681
|
-
id,
|
|
682
|
-
...defaultPropsValue,
|
|
683
|
-
...mergeWith(cloneDeep(this.state.propsValueMap[type] || {}), data)
|
|
684
|
-
};
|
|
685
657
|
}
|
|
686
|
-
async
|
|
687
|
-
|
|
658
|
+
async key(index) {
|
|
659
|
+
const storage2 = await this.getStorage();
|
|
660
|
+
return storage2.key(index);
|
|
688
661
|
}
|
|
689
|
-
async
|
|
690
|
-
const
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
662
|
+
async removeItem(key2, options2 = {}) {
|
|
663
|
+
const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
664
|
+
storage2.removeItem(`${options2.namespace || namespace2}:${key2}`);
|
|
665
|
+
}
|
|
666
|
+
async setItem(key2, value, options2 = {}) {
|
|
667
|
+
const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
668
|
+
let item2 = value;
|
|
669
|
+
const protocol2 = options2.protocol ? `${options2.protocol}:` : "";
|
|
670
|
+
if (typeof value === "string" /* STRING */ || typeof value === "number" /* NUMBER */) {
|
|
671
|
+
item2 = `${protocol2}${value}`;
|
|
672
|
+
} else {
|
|
673
|
+
item2 = `${protocol2}${serialize(value)}`;
|
|
694
674
|
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
675
|
+
storage2.setItem(`${options2.namespace || namespace2}:${key2}`, item2);
|
|
676
|
+
}
|
|
677
|
+
getValueAndProtocol(value) {
|
|
678
|
+
let protocol2 = "";
|
|
679
|
+
if (value === null) {
|
|
680
|
+
return {
|
|
681
|
+
item: value,
|
|
682
|
+
protocol: protocol2
|
|
683
|
+
};
|
|
699
684
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
name: type,
|
|
708
|
-
items: []
|
|
709
|
-
} : {
|
|
710
|
-
type,
|
|
711
|
-
style: {},
|
|
712
|
-
name: type
|
|
685
|
+
const item2 = value.replace(new RegExp(`^(${Object.values(Protocol).join("|")})(:)(.+)`), (_$0, $1, _$2, $3) => {
|
|
686
|
+
protocol2 = $1;
|
|
687
|
+
return $3;
|
|
688
|
+
});
|
|
689
|
+
return {
|
|
690
|
+
protocol: protocol2,
|
|
691
|
+
item: item2
|
|
713
692
|
};
|
|
714
693
|
}
|
|
715
694
|
}
|
|
716
|
-
const
|
|
717
|
-
pageConfig.items?.forEach((config) => {
|
|
718
|
-
if (config.pop === oldId) {
|
|
719
|
-
config.pop = popId;
|
|
720
|
-
return;
|
|
721
|
-
}
|
|
722
|
-
if (config.popId === oldId) {
|
|
723
|
-
config.popId = popId;
|
|
724
|
-
return;
|
|
725
|
-
}
|
|
726
|
-
if (Array.isArray(config.items)) {
|
|
727
|
-
updatePopId(oldId, popId, config);
|
|
728
|
-
}
|
|
729
|
-
});
|
|
730
|
-
};
|
|
731
|
-
var propsService = new Props();
|
|
695
|
+
const storageService = new WebStorage();
|
|
732
696
|
|
|
733
697
|
var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
|
|
734
698
|
LayerOffset2["TOP"] = "top";
|
|
@@ -892,85 +856,336 @@ const fixNodeLeft = (config, parent, doc) => {
|
|
|
892
856
|
return config.style.left;
|
|
893
857
|
};
|
|
894
858
|
|
|
895
|
-
class
|
|
859
|
+
class Props extends BaseService {
|
|
860
|
+
state = reactive({
|
|
861
|
+
propsConfigMap: {},
|
|
862
|
+
propsValueMap: {}
|
|
863
|
+
});
|
|
896
864
|
constructor() {
|
|
897
865
|
super([
|
|
898
|
-
"
|
|
899
|
-
"
|
|
900
|
-
"
|
|
901
|
-
"
|
|
902
|
-
"
|
|
903
|
-
"
|
|
904
|
-
"
|
|
905
|
-
|
|
906
|
-
"alignCenter",
|
|
907
|
-
"moveLayer",
|
|
908
|
-
"moveToContainer",
|
|
909
|
-
"move",
|
|
910
|
-
"undo",
|
|
911
|
-
"redo",
|
|
912
|
-
"highlight"
|
|
913
|
-
], ["select", "update", "moveLayer"]);
|
|
914
|
-
this.isHistoryStateChange = false;
|
|
915
|
-
this.state = reactive({
|
|
916
|
-
root: null,
|
|
917
|
-
page: null,
|
|
918
|
-
parent: null,
|
|
919
|
-
node: null,
|
|
920
|
-
stage: null,
|
|
921
|
-
highlightNode: null,
|
|
922
|
-
modifiedNodeIds: /* @__PURE__ */ new Map(),
|
|
923
|
-
pageLength: 0
|
|
924
|
-
});
|
|
866
|
+
"setPropsConfig",
|
|
867
|
+
"getPropsConfig",
|
|
868
|
+
"setPropsValue",
|
|
869
|
+
"getPropsValue",
|
|
870
|
+
"createId",
|
|
871
|
+
"setNewItemId",
|
|
872
|
+
"getDefaultPropsValue"
|
|
873
|
+
]);
|
|
925
874
|
}
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
}
|
|
875
|
+
setPropsConfigs(configs) {
|
|
876
|
+
Object.keys(configs).forEach((type) => {
|
|
877
|
+
this.setPropsConfig(toLine(type), configs[type]);
|
|
878
|
+
});
|
|
879
|
+
this.emit("props-configs-change");
|
|
932
880
|
}
|
|
933
|
-
|
|
934
|
-
|
|
881
|
+
setPropsConfig(type, config) {
|
|
882
|
+
this.state.propsConfigMap[type] = fillConfig(Array.isArray(config) ? config : [config]);
|
|
935
883
|
}
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
root = toRaw(root);
|
|
940
|
-
}
|
|
941
|
-
if (!root)
|
|
942
|
-
return {};
|
|
943
|
-
if (id === root.id) {
|
|
944
|
-
return { node: root };
|
|
884
|
+
async getPropsConfig(type) {
|
|
885
|
+
if (type === "area") {
|
|
886
|
+
return await this.getPropsConfig("button");
|
|
945
887
|
}
|
|
946
|
-
|
|
947
|
-
if (!path.length)
|
|
948
|
-
return {};
|
|
949
|
-
path.unshift(root);
|
|
950
|
-
const info = {};
|
|
951
|
-
info.node = path[path.length - 1];
|
|
952
|
-
info.parent = path[path.length - 2];
|
|
953
|
-
path.forEach((item) => {
|
|
954
|
-
if (item.type === NodeType.PAGE) {
|
|
955
|
-
info.page = item;
|
|
956
|
-
return;
|
|
957
|
-
}
|
|
958
|
-
});
|
|
959
|
-
return info;
|
|
888
|
+
return cloneDeep(this.state.propsConfigMap[type] || DEFAULT_CONFIG);
|
|
960
889
|
}
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
890
|
+
setPropsValues(values) {
|
|
891
|
+
Object.keys(values).forEach((type) => {
|
|
892
|
+
this.setPropsValue(toLine(type), values[type]);
|
|
893
|
+
});
|
|
964
894
|
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
return;
|
|
968
|
-
const { parent } = this.getNodeInfo(id, raw);
|
|
969
|
-
return parent;
|
|
895
|
+
setPropsValue(type, value) {
|
|
896
|
+
this.state.propsValueMap[type] = value;
|
|
970
897
|
}
|
|
971
|
-
async
|
|
972
|
-
if (
|
|
973
|
-
|
|
898
|
+
async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
|
|
899
|
+
if (type === "area") {
|
|
900
|
+
const value = await this.getPropsValue("button");
|
|
901
|
+
value.className = "action-area";
|
|
902
|
+
value.text = "";
|
|
903
|
+
if (value.style) {
|
|
904
|
+
value.style.backgroundColor = "rgba(255, 255, 255, 0)";
|
|
905
|
+
}
|
|
906
|
+
return value;
|
|
907
|
+
}
|
|
908
|
+
const [id, defaultPropsValue, data] = await Promise.all([
|
|
909
|
+
this.createId(type),
|
|
910
|
+
this.getDefaultPropsValue(type),
|
|
911
|
+
this.setNewItemId(cloneDeep({
|
|
912
|
+
type,
|
|
913
|
+
...defaultValue
|
|
914
|
+
}))
|
|
915
|
+
]);
|
|
916
|
+
return {
|
|
917
|
+
id,
|
|
918
|
+
...defaultPropsValue,
|
|
919
|
+
...mergeWith({}, cloneDeep(this.state.propsValueMap[type] || {}), data)
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
guid(digit = 8) {
|
|
923
|
+
return "x".repeat(digit).replace(/[xy]/g, (c) => {
|
|
924
|
+
const r = Math.random() * 16 | 0;
|
|
925
|
+
const v = c == "x" ? r : r & 3 | 8;
|
|
926
|
+
return v.toString(16);
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
async createId(type) {
|
|
930
|
+
return `${type}_${this.guid()}`;
|
|
931
|
+
}
|
|
932
|
+
async setNewItemId(config, parent) {
|
|
933
|
+
const oldId = config.id;
|
|
934
|
+
config.id = await this.createId(config.type || "component");
|
|
935
|
+
if (isPop(config) && parent?.type === NodeType.PAGE) {
|
|
936
|
+
updatePopId(oldId, config.id, parent);
|
|
937
|
+
}
|
|
938
|
+
if (config.items && Array.isArray(config.items)) {
|
|
939
|
+
for (const item of config.items) {
|
|
940
|
+
await this.setNewItemId(item, config);
|
|
941
|
+
}
|
|
942
|
+
}
|
|
943
|
+
return config;
|
|
944
|
+
}
|
|
945
|
+
async getDefaultPropsValue(type) {
|
|
946
|
+
return ["page", "container"].includes(type) ? {
|
|
947
|
+
type,
|
|
948
|
+
layout: "absolute",
|
|
949
|
+
style: {},
|
|
950
|
+
name: type,
|
|
951
|
+
items: []
|
|
952
|
+
} : {
|
|
953
|
+
type,
|
|
954
|
+
style: {},
|
|
955
|
+
name: type
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
const updatePopId = (oldId, popId, pageConfig) => {
|
|
960
|
+
pageConfig.items?.forEach((config) => {
|
|
961
|
+
if (config.pop === oldId) {
|
|
962
|
+
config.pop = popId;
|
|
963
|
+
return;
|
|
964
|
+
}
|
|
965
|
+
if (config.popId === oldId) {
|
|
966
|
+
config.popId = popId;
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
969
|
+
if (Array.isArray(config.items)) {
|
|
970
|
+
updatePopId(oldId, popId, config);
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
};
|
|
974
|
+
const propsService = new Props();
|
|
975
|
+
|
|
976
|
+
const beforePaste = async (position, config) => {
|
|
977
|
+
if (!config[0]?.style)
|
|
978
|
+
return config;
|
|
979
|
+
const curNode = editorService.get("node");
|
|
980
|
+
const { left: referenceLeft, top: referenceTop } = config[0].style;
|
|
981
|
+
const pasteConfigs = await Promise.all(config.map(async (configItem) => {
|
|
982
|
+
const { offsetX = 0, offsetY = 0, ...positionClone } = position;
|
|
983
|
+
let pastePosition = positionClone;
|
|
984
|
+
if (!isEmpty(pastePosition) && curNode.items) {
|
|
985
|
+
pastePosition = getPositionInContainer(pastePosition, curNode.id);
|
|
986
|
+
}
|
|
987
|
+
if (pastePosition.left && configItem.style?.left) {
|
|
988
|
+
pastePosition.left = configItem.style.left - referenceLeft + pastePosition.left;
|
|
989
|
+
}
|
|
990
|
+
if (pastePosition.top && configItem.style?.top) {
|
|
991
|
+
pastePosition.top = configItem.style?.top - referenceTop + pastePosition.top;
|
|
992
|
+
}
|
|
993
|
+
const pasteConfig = await propsService.setNewItemId(configItem, editorService.get("root"));
|
|
994
|
+
if (pasteConfig.style) {
|
|
995
|
+
const { left, top } = pasteConfig.style;
|
|
996
|
+
if (typeof left === "number" || !!left && !isNaN(Number(left))) {
|
|
997
|
+
pasteConfig.style.left = Number(left) + offsetX;
|
|
998
|
+
}
|
|
999
|
+
if (typeof top === "number" || !!top && !isNaN(Number(top))) {
|
|
1000
|
+
pasteConfig.style.top = Number(top) + offsetY;
|
|
1001
|
+
}
|
|
1002
|
+
pasteConfig.style = {
|
|
1003
|
+
...pasteConfig.style,
|
|
1004
|
+
...pastePosition
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
if (isPage(pasteConfig)) {
|
|
1008
|
+
pasteConfig.name = generatePageNameByApp(editorService.get("root"));
|
|
1009
|
+
}
|
|
1010
|
+
return pasteConfig;
|
|
1011
|
+
}));
|
|
1012
|
+
return pasteConfigs;
|
|
1013
|
+
};
|
|
1014
|
+
const beforeAdd = async (addNode, parent) => {
|
|
1015
|
+
const { type, inputEvent, ...config } = addNode;
|
|
1016
|
+
const curNode = editorService.get("node");
|
|
1017
|
+
let parentNode;
|
|
1018
|
+
const isPage2 = type === NodeType.PAGE;
|
|
1019
|
+
if (isPage2) {
|
|
1020
|
+
parentNode = editorService.get("root");
|
|
1021
|
+
} else if (parent && typeof parent !== "function") {
|
|
1022
|
+
parentNode = parent;
|
|
1023
|
+
} else if (curNode.items) {
|
|
1024
|
+
parentNode = curNode;
|
|
1025
|
+
} else {
|
|
1026
|
+
parentNode = editorService.getParentById(curNode.id, false);
|
|
1027
|
+
}
|
|
1028
|
+
if (!parentNode)
|
|
1029
|
+
throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
|
|
1030
|
+
const layout = await editorService.getLayout(toRaw(parentNode), addNode);
|
|
1031
|
+
const newNode = { ...toRaw(await propsService.getPropsValue(type, config)) };
|
|
1032
|
+
newNode.style = getInitPositionStyle(newNode.style, layout, parentNode, editorService.get("stage"));
|
|
1033
|
+
if ((parentNode?.type === NodeType.ROOT || curNode.type === NodeType.ROOT) && newNode.type !== NodeType.PAGE) {
|
|
1034
|
+
throw new Error("app\u4E0B\u4E0D\u80FD\u6DFB\u52A0\u7EC4\u4EF6");
|
|
1035
|
+
}
|
|
1036
|
+
parentNode?.items?.push(newNode);
|
|
1037
|
+
return {
|
|
1038
|
+
parentNode,
|
|
1039
|
+
newNode,
|
|
1040
|
+
layout,
|
|
1041
|
+
isPage: isPage2
|
|
1042
|
+
};
|
|
1043
|
+
};
|
|
1044
|
+
const getPositionInContainer = (position = {}, id) => {
|
|
1045
|
+
let { left = 0, top = 0 } = position;
|
|
1046
|
+
const parentEl = editorService.get("stage")?.renderer?.contentWindow?.document.getElementById(`${id}`);
|
|
1047
|
+
const parentElRect = parentEl?.getBoundingClientRect();
|
|
1048
|
+
left = left - (parentElRect?.left || 0);
|
|
1049
|
+
top = top - (parentElRect?.top || 0);
|
|
1050
|
+
return {
|
|
1051
|
+
left,
|
|
1052
|
+
top
|
|
1053
|
+
};
|
|
1054
|
+
};
|
|
1055
|
+
const notifyAddToStage = async (parentNode, newNode, layout) => {
|
|
1056
|
+
const stage = editorService.get("stage");
|
|
1057
|
+
const root = editorService.get("root");
|
|
1058
|
+
await stage?.add({ config: cloneDeep(newNode), parent: cloneDeep(parentNode), root: cloneDeep(root) });
|
|
1059
|
+
if (layout === Layout.ABSOLUTE) {
|
|
1060
|
+
const fixedLeft = fixNodeLeft(newNode, parentNode, stage?.renderer.contentWindow?.document);
|
|
1061
|
+
if (typeof fixedLeft !== "undefined" && newNode.style) {
|
|
1062
|
+
newNode.style.left = fixedLeft;
|
|
1063
|
+
await stage?.update({ config: cloneDeep(newNode), root: cloneDeep(root) });
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
};
|
|
1067
|
+
const beforeRemove = async (node) => {
|
|
1068
|
+
if (!node?.id)
|
|
1069
|
+
return;
|
|
1070
|
+
const stage = editorService.get("stage");
|
|
1071
|
+
const root = editorService.get("root");
|
|
1072
|
+
if (!root)
|
|
1073
|
+
throw new Error("\u6CA1\u6709root");
|
|
1074
|
+
const { parent, node: curNode } = editorService.getNodeInfo(node.id, false);
|
|
1075
|
+
if (!parent || !curNode)
|
|
1076
|
+
throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
|
|
1077
|
+
const index = getNodeIndex(curNode, parent);
|
|
1078
|
+
if (typeof index !== "number" || index === -1)
|
|
1079
|
+
throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
|
|
1080
|
+
parent.items?.splice(index, 1);
|
|
1081
|
+
stage?.remove({ id: node.id, root: cloneDeep(root) });
|
|
1082
|
+
if (node.type === NodeType.PAGE) {
|
|
1083
|
+
editorService.state.pageLength -= 1;
|
|
1084
|
+
if (root.items[0]) {
|
|
1085
|
+
await editorService.select(root.items[0]);
|
|
1086
|
+
stage?.select(root.items[0].id);
|
|
1087
|
+
} else {
|
|
1088
|
+
editorService.set("node", null);
|
|
1089
|
+
editorService.set("nodes", []);
|
|
1090
|
+
editorService.set("parent", null);
|
|
1091
|
+
editorService.set("page", null);
|
|
1092
|
+
editorService.set("stage", null);
|
|
1093
|
+
editorService.set("highlightNode", null);
|
|
1094
|
+
editorService.resetModifiedNodeId();
|
|
1095
|
+
historyService.reset();
|
|
1096
|
+
editorService.emit("remove", node);
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1099
|
+
} else {
|
|
1100
|
+
await editorService.select(parent);
|
|
1101
|
+
stage?.select(parent.id);
|
|
1102
|
+
}
|
|
1103
|
+
return parent;
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
class Editor$1 extends BaseService {
|
|
1107
|
+
state = reactive({
|
|
1108
|
+
root: null,
|
|
1109
|
+
page: null,
|
|
1110
|
+
parent: null,
|
|
1111
|
+
node: null,
|
|
1112
|
+
nodes: [],
|
|
1113
|
+
stage: null,
|
|
1114
|
+
highlightNode: null,
|
|
1115
|
+
modifiedNodeIds: /* @__PURE__ */ new Map(),
|
|
1116
|
+
pageLength: 0
|
|
1117
|
+
});
|
|
1118
|
+
isHistoryStateChange = false;
|
|
1119
|
+
constructor() {
|
|
1120
|
+
super([
|
|
1121
|
+
"getLayout",
|
|
1122
|
+
"select",
|
|
1123
|
+
"add",
|
|
1124
|
+
"remove",
|
|
1125
|
+
"update",
|
|
1126
|
+
"sort",
|
|
1127
|
+
"copy",
|
|
1128
|
+
"paste",
|
|
1129
|
+
"alignCenter",
|
|
1130
|
+
"moveLayer",
|
|
1131
|
+
"moveToContainer",
|
|
1132
|
+
"move",
|
|
1133
|
+
"undo",
|
|
1134
|
+
"redo",
|
|
1135
|
+
"highlight"
|
|
1136
|
+
], ["select", "update", "moveLayer"]);
|
|
1137
|
+
}
|
|
1138
|
+
set(name, value) {
|
|
1139
|
+
this.state[name] = value;
|
|
1140
|
+
if (name === "nodes") {
|
|
1141
|
+
this.set("node", value[0]);
|
|
1142
|
+
}
|
|
1143
|
+
if (name === "root") {
|
|
1144
|
+
this.state.pageLength = value?.items?.length || 0;
|
|
1145
|
+
this.emit("root-change", value);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
get(name) {
|
|
1149
|
+
return this.state[name];
|
|
1150
|
+
}
|
|
1151
|
+
getNodeInfo(id, raw = true) {
|
|
1152
|
+
let root = this.get("root");
|
|
1153
|
+
if (raw) {
|
|
1154
|
+
root = toRaw(root);
|
|
1155
|
+
}
|
|
1156
|
+
if (!root)
|
|
1157
|
+
return {};
|
|
1158
|
+
if (id === root.id) {
|
|
1159
|
+
return { node: root };
|
|
1160
|
+
}
|
|
1161
|
+
const path = getNodePath(id, root.items);
|
|
1162
|
+
if (!path.length)
|
|
1163
|
+
return {};
|
|
1164
|
+
path.unshift(root);
|
|
1165
|
+
const info = {};
|
|
1166
|
+
info.node = path[path.length - 1];
|
|
1167
|
+
info.parent = path[path.length - 2];
|
|
1168
|
+
path.forEach((item) => {
|
|
1169
|
+
if (item.type === NodeType.PAGE) {
|
|
1170
|
+
info.page = item;
|
|
1171
|
+
return;
|
|
1172
|
+
}
|
|
1173
|
+
});
|
|
1174
|
+
return info;
|
|
1175
|
+
}
|
|
1176
|
+
getNodeById(id, raw = true) {
|
|
1177
|
+
const { node } = this.getNodeInfo(id, raw);
|
|
1178
|
+
return node;
|
|
1179
|
+
}
|
|
1180
|
+
getParentById(id, raw = true) {
|
|
1181
|
+
if (!this.get("root"))
|
|
1182
|
+
return;
|
|
1183
|
+
const { parent } = this.getNodeInfo(id, raw);
|
|
1184
|
+
return parent;
|
|
1185
|
+
}
|
|
1186
|
+
async getLayout(parent, node) {
|
|
1187
|
+
if (node && typeof node !== "function" && isFixed(node))
|
|
1188
|
+
return Layout.FIXED;
|
|
974
1189
|
if (parent.layout) {
|
|
975
1190
|
return parent.layout;
|
|
976
1191
|
}
|
|
@@ -979,9 +1194,9 @@ class Editor$1 extends BaseService {
|
|
|
979
1194
|
}
|
|
980
1195
|
return Layout.ABSOLUTE;
|
|
981
1196
|
}
|
|
982
|
-
async select(
|
|
983
|
-
const { node, page, parent } = this.selectedConfigExceptionHandler(
|
|
984
|
-
this.set("
|
|
1197
|
+
async select(config) {
|
|
1198
|
+
const { node, page, parent } = this.selectedConfigExceptionHandler(config);
|
|
1199
|
+
this.set("nodes", [node]);
|
|
985
1200
|
this.set("page", page || null);
|
|
986
1201
|
this.set("parent", parent || null);
|
|
987
1202
|
if (page) {
|
|
@@ -1021,46 +1236,42 @@ class Editor$1 extends BaseService {
|
|
|
1021
1236
|
this.get("stage")?.select(nextPage.id);
|
|
1022
1237
|
return nextPage;
|
|
1023
1238
|
}
|
|
1024
|
-
highlight(
|
|
1025
|
-
const { node } = this.selectedConfigExceptionHandler(
|
|
1239
|
+
highlight(config) {
|
|
1240
|
+
const { node } = this.selectedConfigExceptionHandler(config);
|
|
1026
1241
|
const currentHighlightNode = this.get("highlightNode");
|
|
1027
1242
|
if (currentHighlightNode === node)
|
|
1028
1243
|
return;
|
|
1029
1244
|
this.set("highlightNode", node);
|
|
1030
1245
|
}
|
|
1246
|
+
multiSelect(ids) {
|
|
1247
|
+
const nodes = [];
|
|
1248
|
+
const idsUnique = uniq(ids);
|
|
1249
|
+
idsUnique.forEach((id) => {
|
|
1250
|
+
const { node } = this.getNodeInfo(id);
|
|
1251
|
+
if (!node)
|
|
1252
|
+
return;
|
|
1253
|
+
nodes.push(node);
|
|
1254
|
+
});
|
|
1255
|
+
this.set("nodes", nodes);
|
|
1256
|
+
}
|
|
1257
|
+
async multiAdd(configs) {
|
|
1258
|
+
const stage = this.get("stage");
|
|
1259
|
+
const newNodes = await Promise.all(configs.map(async (configItem) => {
|
|
1260
|
+
const { parentNode, newNode, layout } = await beforeAdd(configItem);
|
|
1261
|
+
await notifyAddToStage(parentNode, newNode, layout);
|
|
1262
|
+
return newNode;
|
|
1263
|
+
}));
|
|
1264
|
+
const newNodeIds = newNodes.map((node) => node.id);
|
|
1265
|
+
this.addModifiedNodeId(newNodeIds.join("-"));
|
|
1266
|
+
this.pushHistoryState();
|
|
1267
|
+
stage?.multiSelect(newNodeIds);
|
|
1268
|
+
this.emit("multiAdd", newNodes);
|
|
1269
|
+
return newNodes;
|
|
1270
|
+
}
|
|
1031
1271
|
async add(addNode, parent) {
|
|
1032
|
-
const { type, inputEvent, ...config2 } = addNode;
|
|
1033
|
-
const curNode = this.get("node");
|
|
1034
|
-
let parentNode;
|
|
1035
|
-
const isPage2 = type === NodeType.PAGE;
|
|
1036
|
-
if (isPage2) {
|
|
1037
|
-
parentNode = this.get("root");
|
|
1038
|
-
} else if (parent && typeof parent !== "function") {
|
|
1039
|
-
parentNode = parent;
|
|
1040
|
-
} else if (curNode.items) {
|
|
1041
|
-
parentNode = curNode;
|
|
1042
|
-
} else {
|
|
1043
|
-
parentNode = this.getParentById(curNode.id, false);
|
|
1044
|
-
}
|
|
1045
|
-
if (!parentNode)
|
|
1046
|
-
throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
|
|
1047
|
-
const layout = await this.getLayout(toRaw(parentNode), addNode);
|
|
1048
|
-
const newNode = { ...toRaw(await propsService.getPropsValue(type, config2)) };
|
|
1049
|
-
newNode.style = getInitPositionStyle(newNode.style, layout, parentNode, this.get("stage"));
|
|
1050
|
-
if ((parentNode?.type === NodeType.ROOT || curNode.type === NodeType.ROOT) && newNode.type !== NodeType.PAGE) {
|
|
1051
|
-
throw new Error("app\u4E0B\u4E0D\u80FD\u6DFB\u52A0\u7EC4\u4EF6");
|
|
1052
|
-
}
|
|
1053
|
-
parentNode?.items?.push(newNode);
|
|
1054
1272
|
const stage = this.get("stage");
|
|
1055
|
-
const
|
|
1056
|
-
await
|
|
1057
|
-
if (layout === Layout.ABSOLUTE) {
|
|
1058
|
-
const fixedLeft = fixNodeLeft(newNode, parentNode, stage?.renderer.contentWindow?.document);
|
|
1059
|
-
if (typeof fixedLeft !== "undefined") {
|
|
1060
|
-
newNode.style.left = fixedLeft;
|
|
1061
|
-
await stage?.update({ config: cloneDeep(newNode), root: cloneDeep(root) });
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1273
|
+
const { parentNode, newNode, layout, isPage: isPage2 } = await beforeAdd(addNode, parent);
|
|
1274
|
+
await notifyAddToStage(parentNode, newNode, layout);
|
|
1064
1275
|
await this.select(newNode);
|
|
1065
1276
|
this.addModifiedNodeId(newNode.id);
|
|
1066
1277
|
if (!isPage2) {
|
|
@@ -1074,54 +1285,38 @@ class Editor$1 extends BaseService {
|
|
|
1074
1285
|
this.emit("add", newNode);
|
|
1075
1286
|
return newNode;
|
|
1076
1287
|
}
|
|
1077
|
-
async remove(
|
|
1078
|
-
if (
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
if (!root)
|
|
1082
|
-
throw new Error("\u6CA1\u6709root");
|
|
1083
|
-
const { parent, node: curNode } = this.getNodeInfo(node.id, false);
|
|
1084
|
-
if (!parent || !curNode)
|
|
1085
|
-
throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
|
|
1086
|
-
const index = getNodeIndex(curNode, parent);
|
|
1087
|
-
if (typeof index !== "number" || index === -1)
|
|
1088
|
-
throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
|
|
1089
|
-
parent.items?.splice(index, 1);
|
|
1090
|
-
const stage = this.get("stage");
|
|
1091
|
-
stage?.remove({ id: node.id, root: cloneDeep(this.get("root")) });
|
|
1092
|
-
if (node.type === NodeType.PAGE) {
|
|
1093
|
-
this.state.pageLength -= 1;
|
|
1094
|
-
if (root.items[0]) {
|
|
1095
|
-
await this.select(root.items[0]);
|
|
1096
|
-
stage?.select(root.items[0].id);
|
|
1097
|
-
} else {
|
|
1098
|
-
this.set("node", null);
|
|
1099
|
-
this.set("parent", null);
|
|
1100
|
-
this.set("page", null);
|
|
1101
|
-
this.set("stage", null);
|
|
1102
|
-
this.set("highlightNode", null);
|
|
1103
|
-
this.resetModifiedNodeId();
|
|
1104
|
-
historyService.reset();
|
|
1105
|
-
this.emit("remove", node);
|
|
1106
|
-
return node;
|
|
1107
|
-
}
|
|
1108
|
-
} else {
|
|
1109
|
-
await this.select(parent);
|
|
1110
|
-
stage?.select(parent.id);
|
|
1288
|
+
async remove(nodeOrNodeList) {
|
|
1289
|
+
if (Array.isArray(nodeOrNodeList)) {
|
|
1290
|
+
const nodes = nodeOrNodeList;
|
|
1291
|
+
return this.multiRemove(nodes);
|
|
1111
1292
|
}
|
|
1112
|
-
|
|
1293
|
+
const node = nodeOrNodeList;
|
|
1294
|
+
const removeParent = await beforeRemove(node);
|
|
1295
|
+
if (!removeParent)
|
|
1296
|
+
return node;
|
|
1297
|
+
this.addModifiedNodeId(removeParent.id);
|
|
1113
1298
|
this.pushHistoryState();
|
|
1114
1299
|
this.emit("remove", node);
|
|
1115
1300
|
return node;
|
|
1116
1301
|
}
|
|
1117
|
-
async
|
|
1118
|
-
|
|
1302
|
+
async multiRemove(nodes) {
|
|
1303
|
+
await Promise.all(nodes.map(async (removeNode) => {
|
|
1304
|
+
await beforeRemove(removeNode);
|
|
1305
|
+
}));
|
|
1306
|
+
const nodeIds = nodes.map((node) => node.id);
|
|
1307
|
+
this.addModifiedNodeId(nodeIds.join("-"));
|
|
1308
|
+
this.pushHistoryState();
|
|
1309
|
+
this.emit("multiRemove", nodes);
|
|
1310
|
+
return nodes;
|
|
1311
|
+
}
|
|
1312
|
+
async update(config) {
|
|
1313
|
+
if (!config?.id)
|
|
1119
1314
|
throw new Error("\u6CA1\u6709\u914D\u7F6E\u6216\u8005\u914D\u7F6E\u7F3A\u5C11id\u503C");
|
|
1120
|
-
const info = this.getNodeInfo(
|
|
1315
|
+
const info = this.getNodeInfo(config.id, false);
|
|
1121
1316
|
if (!info.node)
|
|
1122
|
-
throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${
|
|
1317
|
+
throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${config.id}\u7684\u8282\u70B9`);
|
|
1123
1318
|
const node = cloneDeep(toRaw(info.node));
|
|
1124
|
-
let newConfig = await this.toggleFixedPosition(toRaw(
|
|
1319
|
+
let newConfig = await this.toggleFixedPosition(toRaw(config), node, this.get("root"));
|
|
1125
1320
|
newConfig = mergeWith(cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
1126
1321
|
if (Array.isArray(srcValue)) {
|
|
1127
1322
|
return srcValue;
|
|
@@ -1146,9 +1341,10 @@ class Editor$1 extends BaseService {
|
|
|
1146
1341
|
newConfig = setLayout(newConfig, newLayout);
|
|
1147
1342
|
}
|
|
1148
1343
|
parentNodeItems[index] = newConfig;
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1344
|
+
const nodes = this.get("nodes");
|
|
1345
|
+
const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
|
|
1346
|
+
nodes.splice(targetIndex, 1, newConfig);
|
|
1347
|
+
this.set("nodes", nodes);
|
|
1152
1348
|
this.get("stage")?.update({ config: cloneDeep(newConfig), root: cloneDeep(this.get("root")) });
|
|
1153
1349
|
if (newConfig.type === NodeType.PAGE) {
|
|
1154
1350
|
this.set("page", newConfig);
|
|
@@ -1172,34 +1368,19 @@ class Editor$1 extends BaseService {
|
|
|
1172
1368
|
this.addModifiedNodeId(parent.id);
|
|
1173
1369
|
this.pushHistoryState();
|
|
1174
1370
|
}
|
|
1175
|
-
async copy(
|
|
1176
|
-
|
|
1371
|
+
async copy(config) {
|
|
1372
|
+
await storageService.setItem(COPY_STORAGE_KEY, Array.isArray(config) ? config : [config], {
|
|
1373
|
+
protocol: Protocol.OBJECT
|
|
1374
|
+
});
|
|
1177
1375
|
}
|
|
1178
1376
|
async paste(position = {}) {
|
|
1179
|
-
const
|
|
1180
|
-
|
|
1181
|
-
if (!configStr) {
|
|
1182
|
-
return;
|
|
1183
|
-
}
|
|
1184
|
-
try {
|
|
1185
|
-
eval(`config = ${configStr}`);
|
|
1186
|
-
} catch (e) {
|
|
1187
|
-
console.error(e);
|
|
1377
|
+
const config = await storageService.getItem(COPY_STORAGE_KEY);
|
|
1378
|
+
if (!config)
|
|
1188
1379
|
return;
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
if (config.style) {
|
|
1192
|
-
config.style = {
|
|
1193
|
-
...config.style,
|
|
1194
|
-
...position
|
|
1195
|
-
};
|
|
1196
|
-
}
|
|
1197
|
-
if (isPage(config)) {
|
|
1198
|
-
config.name = generatePageNameByApp(this.get("root"));
|
|
1199
|
-
}
|
|
1200
|
-
return await this.add(config);
|
|
1380
|
+
const pasteConfigs = await beforePaste(position, config);
|
|
1381
|
+
return await this.multiAdd(pasteConfigs);
|
|
1201
1382
|
}
|
|
1202
|
-
async alignCenter(
|
|
1383
|
+
async alignCenter(config) {
|
|
1203
1384
|
const parent = this.get("parent");
|
|
1204
1385
|
const node = this.get("node");
|
|
1205
1386
|
const layout = await this.getLayout(toRaw(parent), toRaw(node));
|
|
@@ -1224,9 +1405,9 @@ class Editor$1 extends BaseService {
|
|
|
1224
1405
|
config: cloneDeep(toRaw(node)),
|
|
1225
1406
|
root: cloneDeep(this.get("root"))
|
|
1226
1407
|
});
|
|
1227
|
-
this.addModifiedNodeId(
|
|
1408
|
+
this.addModifiedNodeId(config.id);
|
|
1228
1409
|
this.pushHistoryState();
|
|
1229
|
-
return
|
|
1410
|
+
return config;
|
|
1230
1411
|
}
|
|
1231
1412
|
async moveLayer(offset) {
|
|
1232
1413
|
const parent = this.get("parent");
|
|
@@ -1245,8 +1426,8 @@ class Editor$1 extends BaseService {
|
|
|
1245
1426
|
root: cloneDeep(this.get("root"))
|
|
1246
1427
|
});
|
|
1247
1428
|
}
|
|
1248
|
-
async moveToContainer(
|
|
1249
|
-
const { node, parent } = this.getNodeInfo(
|
|
1429
|
+
async moveToContainer(config, targetId) {
|
|
1430
|
+
const { node, parent } = this.getNodeInfo(config.id, false);
|
|
1250
1431
|
const target = this.getNodeById(targetId, false);
|
|
1251
1432
|
const stage = this.get("stage");
|
|
1252
1433
|
if (node && parent && stage) {
|
|
@@ -1255,7 +1436,7 @@ class Editor$1 extends BaseService {
|
|
|
1255
1436
|
parent.items?.splice(index, 1);
|
|
1256
1437
|
await stage.remove({ id: node.id, root });
|
|
1257
1438
|
const layout = await this.getLayout(target);
|
|
1258
|
-
const newConfig = mergeWith(cloneDeep(node),
|
|
1439
|
+
const newConfig = mergeWith(cloneDeep(node), config, (objValue, srcValue) => {
|
|
1259
1440
|
if (Array.isArray(srcValue)) {
|
|
1260
1441
|
return srcValue;
|
|
1261
1442
|
}
|
|
@@ -1306,6 +1487,7 @@ class Editor$1 extends BaseService {
|
|
|
1306
1487
|
this.removeAllListeners();
|
|
1307
1488
|
this.set("root", null);
|
|
1308
1489
|
this.set("node", null);
|
|
1490
|
+
this.set("nodes", []);
|
|
1309
1491
|
this.set("page", null);
|
|
1310
1492
|
this.set("parent", null);
|
|
1311
1493
|
}
|
|
@@ -1352,12 +1534,12 @@ class Editor$1 extends BaseService {
|
|
|
1352
1534
|
}
|
|
1353
1535
|
return newConfig;
|
|
1354
1536
|
}
|
|
1355
|
-
selectedConfigExceptionHandler(
|
|
1537
|
+
selectedConfigExceptionHandler(config) {
|
|
1356
1538
|
let id;
|
|
1357
|
-
if (typeof
|
|
1358
|
-
id =
|
|
1539
|
+
if (typeof config === "string" || typeof config === "number") {
|
|
1540
|
+
id = config;
|
|
1359
1541
|
} else {
|
|
1360
|
-
id =
|
|
1542
|
+
id = config.id;
|
|
1361
1543
|
}
|
|
1362
1544
|
if (!id) {
|
|
1363
1545
|
throw new Error("\u6CA1\u6709ID\uFF0C\u65E0\u6CD5\u9009\u4E2D");
|
|
@@ -1375,7 +1557,7 @@ class Editor$1 extends BaseService {
|
|
|
1375
1557
|
};
|
|
1376
1558
|
}
|
|
1377
1559
|
}
|
|
1378
|
-
|
|
1560
|
+
const editorService = new Editor$1();
|
|
1379
1561
|
|
|
1380
1562
|
const eventMap = reactive({});
|
|
1381
1563
|
const methodMap = reactive({});
|
|
@@ -1419,7 +1601,7 @@ class Events extends BaseService {
|
|
|
1419
1601
|
return cloneDeep(methodMap[type] || DEFAULT_METHODS);
|
|
1420
1602
|
}
|
|
1421
1603
|
}
|
|
1422
|
-
|
|
1604
|
+
const eventsService = new Events();
|
|
1423
1605
|
|
|
1424
1606
|
const fillConfig = (config = []) => [
|
|
1425
1607
|
{
|
|
@@ -1627,14 +1809,29 @@ const fillConfig = (config = []) => [
|
|
|
1627
1809
|
const DEFAULT_CONFIG = fillConfig([]);
|
|
1628
1810
|
|
|
1629
1811
|
const log = (...args) => {
|
|
1812
|
+
if (process.env.NODE_ENV === "development") {
|
|
1813
|
+
console.log("magic editor: ", ...args);
|
|
1814
|
+
}
|
|
1630
1815
|
};
|
|
1631
1816
|
const info = (...args) => {
|
|
1817
|
+
if (process.env.NODE_ENV === "development") {
|
|
1818
|
+
console.info("magic editor: ", ...args);
|
|
1819
|
+
}
|
|
1632
1820
|
};
|
|
1633
1821
|
const warn = (...args) => {
|
|
1822
|
+
if (process.env.NODE_ENV === "development") {
|
|
1823
|
+
console.warn("magic editor: ", ...args);
|
|
1824
|
+
}
|
|
1634
1825
|
};
|
|
1635
1826
|
const debug = (...args) => {
|
|
1827
|
+
if (process.env.NODE_ENV === "development") {
|
|
1828
|
+
console.debug("magic editor: ", ...args);
|
|
1829
|
+
}
|
|
1636
1830
|
};
|
|
1637
1831
|
const error = (...args) => {
|
|
1832
|
+
if (process.env.NODE_ENV === "development") {
|
|
1833
|
+
console.error("magic editor: ", ...args);
|
|
1834
|
+
}
|
|
1638
1835
|
};
|
|
1639
1836
|
|
|
1640
1837
|
const _sfc_main$i = defineComponent({
|
|
@@ -1654,10 +1851,11 @@ const _sfc_main$i = defineComponent({
|
|
|
1654
1851
|
};
|
|
1655
1852
|
}
|
|
1656
1853
|
});
|
|
1854
|
+
|
|
1657
1855
|
const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
1658
1856
|
const _hoisted_2$4 = { class: "m-editor-empty-content" };
|
|
1659
1857
|
const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
1660
|
-
function _sfc_render$
|
|
1858
|
+
function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1661
1859
|
const _component_plus = resolveComponent("plus");
|
|
1662
1860
|
const _component_el_icon = resolveComponent("el-icon");
|
|
1663
1861
|
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
@@ -1679,7 +1877,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1679
1877
|
])
|
|
1680
1878
|
]);
|
|
1681
1879
|
}
|
|
1682
|
-
|
|
1880
|
+
const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$d]]);
|
|
1683
1881
|
|
|
1684
1882
|
const _sfc_main$h = defineComponent({
|
|
1685
1883
|
name: "m-editor-resize",
|
|
@@ -1723,16 +1921,17 @@ const _sfc_main$h = defineComponent({
|
|
|
1723
1921
|
};
|
|
1724
1922
|
}
|
|
1725
1923
|
});
|
|
1924
|
+
|
|
1726
1925
|
const _hoisted_1$a = {
|
|
1727
1926
|
ref: "target",
|
|
1728
1927
|
class: "m-editor-resizer"
|
|
1729
1928
|
};
|
|
1730
|
-
function _sfc_render$
|
|
1929
|
+
function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1731
1930
|
return openBlock(), createElementBlock("span", _hoisted_1$a, [
|
|
1732
1931
|
renderSlot(_ctx.$slots, "default")
|
|
1733
1932
|
], 512);
|
|
1734
1933
|
}
|
|
1735
|
-
|
|
1934
|
+
const Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$c]]);
|
|
1736
1935
|
|
|
1737
1936
|
const _sfc_main$g = defineComponent({
|
|
1738
1937
|
components: {
|
|
@@ -1763,12 +1962,13 @@ const _sfc_main$g = defineComponent({
|
|
|
1763
1962
|
};
|
|
1764
1963
|
}
|
|
1765
1964
|
});
|
|
1965
|
+
|
|
1766
1966
|
const _hoisted_1$9 = { class: "m-editor" };
|
|
1767
1967
|
const _hoisted_2$3 = {
|
|
1768
1968
|
key: 1,
|
|
1769
1969
|
class: "m-editor-content"
|
|
1770
1970
|
};
|
|
1771
|
-
function _sfc_render$
|
|
1971
|
+
function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1772
1972
|
const _component_magic_code_editor = resolveComponent("magic-code-editor");
|
|
1773
1973
|
const _component_resizer = resolveComponent("resizer");
|
|
1774
1974
|
const _component_el_scrollbar = resolveComponent("el-scrollbar");
|
|
@@ -1814,7 +2014,7 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1814
2014
|
]))
|
|
1815
2015
|
]);
|
|
1816
2016
|
}
|
|
1817
|
-
|
|
2017
|
+
const Framework = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$b]]);
|
|
1818
2018
|
|
|
1819
2019
|
const _sfc_main$f = defineComponent({
|
|
1820
2020
|
name: "m-icon",
|
|
@@ -1830,8 +2030,9 @@ const _sfc_main$f = defineComponent({
|
|
|
1830
2030
|
};
|
|
1831
2031
|
}
|
|
1832
2032
|
});
|
|
2033
|
+
|
|
1833
2034
|
const _hoisted_1$8 = ["src"];
|
|
1834
|
-
function _sfc_render$
|
|
2035
|
+
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1835
2036
|
const _component_edit = resolveComponent("edit");
|
|
1836
2037
|
const _component_el_icon = resolveComponent("el-icon");
|
|
1837
2038
|
return !_ctx.icon ? (openBlock(), createBlock(_component_el_icon, { key: 0 }, {
|
|
@@ -1852,10 +2053,19 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1852
2053
|
_: 1
|
|
1853
2054
|
}));
|
|
1854
2055
|
}
|
|
1855
|
-
|
|
2056
|
+
const MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$a]]);
|
|
1856
2057
|
|
|
1857
|
-
const
|
|
1858
|
-
|
|
2058
|
+
const _hoisted_1$7 = {
|
|
2059
|
+
key: 1,
|
|
2060
|
+
class: "menu-item-text"
|
|
2061
|
+
};
|
|
2062
|
+
const _hoisted_2$2 = {
|
|
2063
|
+
class: "menu-item-text",
|
|
2064
|
+
style: { "margin": "0 5px" }
|
|
2065
|
+
};
|
|
2066
|
+
const _hoisted_3$1 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2067
|
+
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
2068
|
+
__name: "ToolButton",
|
|
1859
2069
|
props: {
|
|
1860
2070
|
data: {
|
|
1861
2071
|
type: [Object, String],
|
|
@@ -1870,7 +2080,8 @@ const _sfc_main$e = defineComponent({
|
|
|
1870
2080
|
default: "click"
|
|
1871
2081
|
}
|
|
1872
2082
|
},
|
|
1873
|
-
setup(
|
|
2083
|
+
setup(__props) {
|
|
2084
|
+
const props = __props;
|
|
1874
2085
|
const services = inject("services");
|
|
1875
2086
|
const uiService = services?.uiService;
|
|
1876
2087
|
const zoom = computed(() => uiService?.get("zoom") ?? 1);
|
|
@@ -1967,176 +2178,155 @@ const _sfc_main$e = defineComponent({
|
|
|
1967
2178
|
item2.handler?.(services, event);
|
|
1968
2179
|
}
|
|
1969
2180
|
};
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
item
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
}
|
|
1984
|
-
return item.value.display ?? true;
|
|
1985
|
-
}),
|
|
1986
|
-
zoomInHandler,
|
|
1987
|
-
zoomOutHandler,
|
|
1988
|
-
dropdownHandler(command) {
|
|
1989
|
-
if (command.item.handler) {
|
|
1990
|
-
command.item.handler(services);
|
|
1991
|
-
}
|
|
1992
|
-
},
|
|
1993
|
-
clickHandler(item2, event) {
|
|
1994
|
-
if (props.eventType !== "click")
|
|
1995
|
-
return;
|
|
1996
|
-
if (item2.type === "button") {
|
|
1997
|
-
buttonHandler(item2, event);
|
|
1998
|
-
}
|
|
1999
|
-
},
|
|
2000
|
-
mousedownHandler(item2, event) {
|
|
2001
|
-
if (props.eventType !== "mousedown")
|
|
2002
|
-
return;
|
|
2003
|
-
if (item2.type === "button") {
|
|
2004
|
-
buttonHandler(item2, event);
|
|
2005
|
-
}
|
|
2006
|
-
},
|
|
2007
|
-
mouseupHandler(item2, event) {
|
|
2008
|
-
if (props.eventType !== "mouseup")
|
|
2009
|
-
return;
|
|
2010
|
-
if (item2.type === "button") {
|
|
2011
|
-
buttonHandler(item2, event);
|
|
2012
|
-
}
|
|
2181
|
+
const display = computed(() => {
|
|
2182
|
+
if (!item.value)
|
|
2183
|
+
return false;
|
|
2184
|
+
if (typeof item.value === "string")
|
|
2185
|
+
return true;
|
|
2186
|
+
if (typeof item.value.display === "function") {
|
|
2187
|
+
return item.value.display(services);
|
|
2188
|
+
}
|
|
2189
|
+
return item.value.display ?? true;
|
|
2190
|
+
});
|
|
2191
|
+
const dropdownHandler = (command) => {
|
|
2192
|
+
if (command.item.handler) {
|
|
2193
|
+
command.item.handler(services);
|
|
2013
2194
|
}
|
|
2014
2195
|
};
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
}
|
|
2021
|
-
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
|
|
2033
|
-
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
direction: _ctx.item.direction || "vertical"
|
|
2047
|
-
}, null, 8, ["direction"])) : _ctx.item.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$7, toDisplayString(_ctx.item.text), 1)) : _ctx.item.type === "zoom" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
2048
|
-
createVNode(_component_tool_button, {
|
|
2049
|
-
data: { type: "button", icon: _ctx.ZoomOut, handler: _ctx.zoomOutHandler, tooltip: "\u7F29\u5C0F" },
|
|
2050
|
-
"event-type": _ctx.eventType
|
|
2051
|
-
}, null, 8, ["data", "event-type"]),
|
|
2052
|
-
createElementVNode("span", _hoisted_2$2, toDisplayString(parseInt(`${_ctx.zoom * 100}`, 10)) + "%", 1),
|
|
2053
|
-
createVNode(_component_tool_button, {
|
|
2054
|
-
data: { type: "button", icon: _ctx.ZoomIn, handler: _ctx.zoomInHandler, tooltip: "\u653E\u5927" },
|
|
2055
|
-
"event-type": _ctx.eventType
|
|
2056
|
-
}, null, 8, ["data", "event-type"])
|
|
2057
|
-
], 64)) : _ctx.item.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
2058
|
-
_ctx.item.tooltip ? (openBlock(), createBlock(_component_el_tooltip, {
|
|
2196
|
+
const clickHandler = (item2, event) => {
|
|
2197
|
+
if (props.eventType !== "click")
|
|
2198
|
+
return;
|
|
2199
|
+
if (item2.type === "button") {
|
|
2200
|
+
buttonHandler(item2, event);
|
|
2201
|
+
}
|
|
2202
|
+
};
|
|
2203
|
+
const mousedownHandler = (item2, event) => {
|
|
2204
|
+
if (props.eventType !== "mousedown")
|
|
2205
|
+
return;
|
|
2206
|
+
if (item2.type === "button") {
|
|
2207
|
+
buttonHandler(item2, event);
|
|
2208
|
+
}
|
|
2209
|
+
};
|
|
2210
|
+
const mouseupHandler = (item2, event) => {
|
|
2211
|
+
if (props.eventType !== "mouseup")
|
|
2212
|
+
return;
|
|
2213
|
+
if (item2.type === "button") {
|
|
2214
|
+
buttonHandler(item2, event);
|
|
2215
|
+
}
|
|
2216
|
+
};
|
|
2217
|
+
return (_ctx, _cache) => {
|
|
2218
|
+
const _component_el_divider = resolveComponent("el-divider");
|
|
2219
|
+
const _component_tool_button = resolveComponent("tool-button", true);
|
|
2220
|
+
const _component_el_button = resolveComponent("el-button");
|
|
2221
|
+
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
2222
|
+
const _component_el_icon = resolveComponent("el-icon");
|
|
2223
|
+
const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
|
|
2224
|
+
const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
|
|
2225
|
+
const _component_el_dropdown = resolveComponent("el-dropdown");
|
|
2226
|
+
return unref(display) ? (openBlock(), createElementBlock("div", {
|
|
2059
2227
|
key: 0,
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2228
|
+
class: normalizeClass(["menu-item", unref(item).type]),
|
|
2229
|
+
onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(unref(item), $event)),
|
|
2230
|
+
onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(unref(item), $event)),
|
|
2231
|
+
onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(unref(item), $event))
|
|
2232
|
+
}, [
|
|
2233
|
+
unref(item).type === "divider" ? (openBlock(), createBlock(_component_el_divider, {
|
|
2234
|
+
key: 0,
|
|
2235
|
+
direction: unref(item).direction || "vertical"
|
|
2236
|
+
}, null, 8, ["direction"])) : unref(item).type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$7, toDisplayString(unref(item).text), 1)) : unref(item).type === "zoom" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
2237
|
+
createVNode(_component_tool_button, {
|
|
2238
|
+
data: { type: "button", icon: unref(ZoomOut), handler: zoomOutHandler, tooltip: "\u7F29\u5C0F" },
|
|
2239
|
+
"event-type": __props.eventType
|
|
2240
|
+
}, null, 8, ["data", "event-type"]),
|
|
2241
|
+
createElementVNode("span", _hoisted_2$2, toDisplayString(parseInt(`${unref(zoom) * 100}`, 10)) + "%", 1),
|
|
2242
|
+
createVNode(_component_tool_button, {
|
|
2243
|
+
data: { type: "button", icon: unref(ZoomIn), handler: zoomInHandler, tooltip: "\u653E\u5927" },
|
|
2244
|
+
"event-type": __props.eventType
|
|
2245
|
+
}, null, 8, ["data", "event-type"])
|
|
2246
|
+
], 64)) : unref(item).type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 3 }, [
|
|
2247
|
+
unref(item).tooltip ? (openBlock(), createBlock(_component_el_tooltip, {
|
|
2248
|
+
key: 0,
|
|
2249
|
+
effect: "dark",
|
|
2250
|
+
placement: "bottom-start",
|
|
2251
|
+
content: unref(item).tooltip
|
|
2252
|
+
}, {
|
|
2253
|
+
default: withCtx(() => [
|
|
2254
|
+
createVNode(_component_el_button, {
|
|
2255
|
+
size: "small",
|
|
2256
|
+
text: "",
|
|
2257
|
+
disabled: unref(disabled)
|
|
2258
|
+
}, {
|
|
2259
|
+
default: withCtx(() => [
|
|
2260
|
+
unref(item).icon ? (openBlock(), createBlock(MIcon, {
|
|
2261
|
+
key: 0,
|
|
2262
|
+
icon: unref(item).icon
|
|
2263
|
+
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
2264
|
+
createElementVNode("span", null, toDisplayString(unref(item).text), 1)
|
|
2265
|
+
]),
|
|
2266
|
+
_: 1
|
|
2267
|
+
}, 8, ["disabled"])
|
|
2268
|
+
]),
|
|
2269
|
+
_: 1
|
|
2270
|
+
}, 8, ["content"])) : (openBlock(), createBlock(_component_el_button, {
|
|
2271
|
+
key: 1,
|
|
2066
2272
|
size: "small",
|
|
2067
2273
|
text: "",
|
|
2068
|
-
disabled:
|
|
2274
|
+
disabled: unref(disabled)
|
|
2069
2275
|
}, {
|
|
2070
2276
|
default: withCtx(() => [
|
|
2071
|
-
|
|
2277
|
+
unref(item).icon ? (openBlock(), createBlock(MIcon, {
|
|
2072
2278
|
key: 0,
|
|
2073
|
-
icon:
|
|
2279
|
+
icon: unref(item).icon
|
|
2074
2280
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
2075
|
-
createElementVNode("span", null, toDisplayString(
|
|
2281
|
+
createElementVNode("span", null, toDisplayString(unref(item).text), 1)
|
|
2076
2282
|
]),
|
|
2077
2283
|
_: 1
|
|
2078
|
-
}, 8, ["disabled"])
|
|
2079
|
-
]),
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
_ctx.item.items && _ctx.item.items.length ? (openBlock(), createBlock(_component_el_dropdown_menu, { key: 0 }, {
|
|
2284
|
+
}, 8, ["disabled"]))
|
|
2285
|
+
], 64)) : unref(item).type === "dropdown" ? (openBlock(), createBlock(_component_el_dropdown, {
|
|
2286
|
+
key: 4,
|
|
2287
|
+
trigger: "click",
|
|
2288
|
+
disabled: unref(disabled),
|
|
2289
|
+
onCommand: dropdownHandler
|
|
2290
|
+
}, {
|
|
2291
|
+
dropdown: withCtx(() => [
|
|
2292
|
+
unref(item).items && unref(item).items.length ? (openBlock(), createBlock(_component_el_dropdown_menu, { key: 0 }, {
|
|
2293
|
+
default: withCtx(() => [
|
|
2294
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(item).items, (subItem, index) => {
|
|
2295
|
+
return openBlock(), createBlock(_component_el_dropdown_item, {
|
|
2296
|
+
key: index,
|
|
2297
|
+
command: { item: unref(item), subItem }
|
|
2298
|
+
}, {
|
|
2299
|
+
default: withCtx(() => [
|
|
2300
|
+
createTextVNode(toDisplayString(subItem.text), 1)
|
|
2301
|
+
]),
|
|
2302
|
+
_: 2
|
|
2303
|
+
}, 1032, ["command"]);
|
|
2304
|
+
}), 128))
|
|
2305
|
+
]),
|
|
2306
|
+
_: 1
|
|
2307
|
+
})) : createCommentVNode("", true)
|
|
2308
|
+
]),
|
|
2104
2309
|
default: withCtx(() => [
|
|
2105
|
-
(
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
command: { item: _ctx.item, subItem }
|
|
2109
|
-
}, {
|
|
2310
|
+
createElementVNode("span", _hoisted_3$1, [
|
|
2311
|
+
createTextVNode(toDisplayString(unref(item).text), 1),
|
|
2312
|
+
createVNode(_component_el_icon, { class: "el-icon--right" }, {
|
|
2110
2313
|
default: withCtx(() => [
|
|
2111
|
-
|
|
2314
|
+
createVNode(unref(ArrowDown))
|
|
2112
2315
|
]),
|
|
2113
|
-
_:
|
|
2114
|
-
}
|
|
2115
|
-
|
|
2316
|
+
_: 1
|
|
2317
|
+
})
|
|
2318
|
+
])
|
|
2116
2319
|
]),
|
|
2117
2320
|
_: 1
|
|
2118
|
-
})) : createCommentVNode("", true)
|
|
2119
|
-
]),
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
createVNode(_component_el_icon, { class: "el-icon--right" }, {
|
|
2124
|
-
default: withCtx(() => [
|
|
2125
|
-
createVNode(_component_arrow_down)
|
|
2126
|
-
]),
|
|
2127
|
-
_: 1
|
|
2128
|
-
})
|
|
2129
|
-
])
|
|
2130
|
-
]),
|
|
2131
|
-
_: 1
|
|
2132
|
-
}, 8, ["disabled", "onCommand"])) : _ctx.item.type === "component" ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.item.component), normalizeProps(mergeProps({ key: 5 }, _ctx.item.props || {})), null, 16)) : createCommentVNode("", true)
|
|
2133
|
-
], 34)) : createCommentVNode("", true);
|
|
2134
|
-
}
|
|
2135
|
-
var ToolButton = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$e]]);
|
|
2321
|
+
}, 8, ["disabled"])) : unref(item).type === "component" ? (openBlock(), createBlock(resolveDynamicComponent(unref(item).component), normalizeProps(mergeProps({ key: 5 }, unref(item).props || {})), null, 16)) : createCommentVNode("", true)
|
|
2322
|
+
], 34)) : createCommentVNode("", true);
|
|
2323
|
+
};
|
|
2324
|
+
}
|
|
2325
|
+
});
|
|
2136
2326
|
|
|
2137
2327
|
const _sfc_main$d = defineComponent({
|
|
2138
2328
|
name: "nav-menu",
|
|
2139
|
-
components: { ToolButton },
|
|
2329
|
+
components: { ToolButton: _sfc_main$e },
|
|
2140
2330
|
props: {
|
|
2141
2331
|
data: {
|
|
2142
2332
|
type: Object,
|
|
@@ -2154,7 +2344,8 @@ const _sfc_main$d = defineComponent({
|
|
|
2154
2344
|
};
|
|
2155
2345
|
}
|
|
2156
2346
|
});
|
|
2157
|
-
|
|
2347
|
+
|
|
2348
|
+
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2158
2349
|
const _component_tool_button = resolveComponent("tool-button");
|
|
2159
2350
|
return openBlock(), createElementBlock("div", {
|
|
2160
2351
|
class: "m-editor-nav-menu",
|
|
@@ -2176,7 +2367,7 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2176
2367
|
}), 128))
|
|
2177
2368
|
], 4);
|
|
2178
2369
|
}
|
|
2179
|
-
|
|
2370
|
+
const NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$9]]);
|
|
2180
2371
|
|
|
2181
2372
|
const _sfc_main$c = defineComponent({
|
|
2182
2373
|
name: "m-editor-props-panel",
|
|
@@ -2225,8 +2416,9 @@ const _sfc_main$c = defineComponent({
|
|
|
2225
2416
|
};
|
|
2226
2417
|
}
|
|
2227
2418
|
});
|
|
2419
|
+
|
|
2228
2420
|
const _hoisted_1$6 = { class: "`m-editor-props-panel" };
|
|
2229
|
-
function _sfc_render$
|
|
2421
|
+
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2230
2422
|
const _component_m_form = resolveComponent("m-form");
|
|
2231
2423
|
return openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
2232
2424
|
renderSlot(_ctx.$slots, "props-panel-header"),
|
|
@@ -2241,7 +2433,7 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2241
2433
|
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "onChange"])
|
|
2242
2434
|
]);
|
|
2243
2435
|
}
|
|
2244
|
-
|
|
2436
|
+
const PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$8]]);
|
|
2245
2437
|
|
|
2246
2438
|
const _sfc_main$b = defineComponent({
|
|
2247
2439
|
name: "ui-component-panel",
|
|
@@ -2309,9 +2501,10 @@ const _sfc_main$b = defineComponent({
|
|
|
2309
2501
|
};
|
|
2310
2502
|
}
|
|
2311
2503
|
});
|
|
2504
|
+
|
|
2312
2505
|
const _hoisted_1$5 = /* @__PURE__ */ createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
|
|
2313
2506
|
const _hoisted_2$1 = ["onClick", "onDragstart"];
|
|
2314
|
-
function _sfc_render$
|
|
2507
|
+
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2315
2508
|
const _component_el_input = resolveComponent("el-input");
|
|
2316
2509
|
const _component_m_icon = resolveComponent("m-icon");
|
|
2317
2510
|
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
@@ -2383,22 +2576,17 @@ function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2383
2576
|
_: 3
|
|
2384
2577
|
});
|
|
2385
2578
|
}
|
|
2386
|
-
|
|
2579
|
+
const ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$7]]);
|
|
2387
2580
|
|
|
2388
|
-
const _sfc_main$a = defineComponent({
|
|
2389
|
-
|
|
2581
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
2582
|
+
__name: "ContentMenu",
|
|
2390
2583
|
props: {
|
|
2391
|
-
menuData: {
|
|
2392
|
-
|
|
2393
|
-
default: () => []
|
|
2394
|
-
},
|
|
2395
|
-
isSubMenu: {
|
|
2396
|
-
type: Boolean,
|
|
2397
|
-
default: false
|
|
2398
|
-
}
|
|
2584
|
+
menuData: { default: () => [] },
|
|
2585
|
+
isSubMenu: { type: Boolean, default: false }
|
|
2399
2586
|
},
|
|
2400
2587
|
emits: ["hide", "show"],
|
|
2401
|
-
setup(
|
|
2588
|
+
setup(__props, { expose, emit }) {
|
|
2589
|
+
const props = __props;
|
|
2402
2590
|
const menu = ref();
|
|
2403
2591
|
const subMenu = ref();
|
|
2404
2592
|
const visible = ref(false);
|
|
@@ -2424,6 +2612,36 @@ const _sfc_main$a = defineComponent({
|
|
|
2424
2612
|
}
|
|
2425
2613
|
hide();
|
|
2426
2614
|
};
|
|
2615
|
+
const show = (e) => {
|
|
2616
|
+
setTimeout(() => {
|
|
2617
|
+
visible.value = true;
|
|
2618
|
+
nextTick(() => {
|
|
2619
|
+
const menuHeight = menu.value?.clientHeight || 0;
|
|
2620
|
+
let top = e.clientY;
|
|
2621
|
+
if (menuHeight + e.clientY > document.body.clientHeight) {
|
|
2622
|
+
top = document.body.clientHeight - menuHeight;
|
|
2623
|
+
}
|
|
2624
|
+
menuStyle.value = {
|
|
2625
|
+
top: `${top}px`,
|
|
2626
|
+
left: `${e.clientX}px`
|
|
2627
|
+
};
|
|
2628
|
+
emit("show");
|
|
2629
|
+
});
|
|
2630
|
+
}, 300);
|
|
2631
|
+
};
|
|
2632
|
+
const showSubMenu = (item) => {
|
|
2633
|
+
const menuItem = item;
|
|
2634
|
+
if (typeof item !== "object" || !menuItem.items?.length) {
|
|
2635
|
+
return;
|
|
2636
|
+
}
|
|
2637
|
+
subMenuData.value = menuItem.items;
|
|
2638
|
+
if (menu.value) {
|
|
2639
|
+
subMenu.value.show({
|
|
2640
|
+
clientX: menu.value.offsetLeft + menu.value.clientWidth,
|
|
2641
|
+
clientY: menu.value.offsetTop
|
|
2642
|
+
});
|
|
2643
|
+
}
|
|
2644
|
+
};
|
|
2427
2645
|
onMounted(() => {
|
|
2428
2646
|
if (props.isSubMenu)
|
|
2429
2647
|
return;
|
|
@@ -2434,81 +2652,47 @@ const _sfc_main$a = defineComponent({
|
|
|
2434
2652
|
return;
|
|
2435
2653
|
globalThis.removeEventListener("mousedown", hideHandler, true);
|
|
2436
2654
|
});
|
|
2437
|
-
|
|
2438
|
-
menu,
|
|
2439
|
-
subMenu,
|
|
2440
|
-
visible,
|
|
2441
|
-
menuStyle,
|
|
2442
|
-
subMenuData,
|
|
2655
|
+
expose({
|
|
2443
2656
|
hide,
|
|
2444
|
-
show
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2657
|
+
show
|
|
2658
|
+
});
|
|
2659
|
+
return (_ctx, _cache) => {
|
|
2660
|
+
const _component_content_menu = resolveComponent("content-menu", true);
|
|
2661
|
+
return __props.menuData.length && visible.value ? (openBlock(), createElementBlock("div", {
|
|
2662
|
+
key: 0,
|
|
2663
|
+
class: "magic-editor-content-menu",
|
|
2664
|
+
ref_key: "menu",
|
|
2665
|
+
ref: menu,
|
|
2666
|
+
style: normalizeStyle(menuStyle.value)
|
|
2667
|
+
}, [
|
|
2668
|
+
createElementVNode("div", null, [
|
|
2669
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.menuData, (item, index) => {
|
|
2670
|
+
return openBlock(), createBlock(_sfc_main$e, {
|
|
2671
|
+
"event-type": "mouseup",
|
|
2672
|
+
data: item,
|
|
2673
|
+
key: index,
|
|
2674
|
+
onMouseup: hide,
|
|
2675
|
+
onMouseenter: ($event) => showSubMenu(item)
|
|
2676
|
+
}, null, 8, ["data", "onMouseenter"]);
|
|
2677
|
+
}), 128))
|
|
2678
|
+
]),
|
|
2679
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
2680
|
+
createVNode(_component_content_menu, {
|
|
2681
|
+
class: "sub-menu",
|
|
2682
|
+
ref_key: "subMenu",
|
|
2683
|
+
ref: subMenu,
|
|
2684
|
+
"menu-data": subMenuData.value,
|
|
2685
|
+
"is-sub-menu": true,
|
|
2686
|
+
onHide: hide
|
|
2687
|
+
}, null, 8, ["menu-data"])
|
|
2688
|
+
]))
|
|
2689
|
+
], 4)) : createCommentVNode("", true);
|
|
2474
2690
|
};
|
|
2475
2691
|
}
|
|
2476
2692
|
});
|
|
2477
|
-
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2478
|
-
const _component_tool_button = resolveComponent("tool-button");
|
|
2479
|
-
const _component_content_menu = resolveComponent("content-menu", true);
|
|
2480
|
-
return _ctx.menuData.length && _ctx.visible ? (openBlock(), createElementBlock("div", {
|
|
2481
|
-
key: 0,
|
|
2482
|
-
class: "magic-editor-content-menu",
|
|
2483
|
-
ref: "menu",
|
|
2484
|
-
style: normalizeStyle(_ctx.menuStyle)
|
|
2485
|
-
}, [
|
|
2486
|
-
createElementVNode("div", null, [
|
|
2487
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.menuData, (item, index) => {
|
|
2488
|
-
return openBlock(), createBlock(_component_tool_button, {
|
|
2489
|
-
"event-type": "mouseup",
|
|
2490
|
-
data: item,
|
|
2491
|
-
key: index,
|
|
2492
|
-
onMouseup: _ctx.hide,
|
|
2493
|
-
onMouseenter: ($event) => _ctx.showSubMenu(item)
|
|
2494
|
-
}, null, 8, ["data", "onMouseup", "onMouseenter"]);
|
|
2495
|
-
}), 128))
|
|
2496
|
-
]),
|
|
2497
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
2498
|
-
createVNode(_component_content_menu, {
|
|
2499
|
-
class: "sub-menu",
|
|
2500
|
-
ref: "subMenu",
|
|
2501
|
-
"menu-data": _ctx.subMenuData,
|
|
2502
|
-
"is-sub-menu": true,
|
|
2503
|
-
onHide: _ctx.hide
|
|
2504
|
-
}, null, 8, ["menu-data", "onHide"])
|
|
2505
|
-
]))
|
|
2506
|
-
], 4)) : createCommentVNode("", true);
|
|
2507
|
-
}
|
|
2508
|
-
var ContentMenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
|
|
2509
2693
|
|
|
2510
2694
|
const _sfc_main$9 = defineComponent({
|
|
2511
|
-
components: { ContentMenu },
|
|
2695
|
+
components: { ContentMenu: _sfc_main$a },
|
|
2512
2696
|
setup() {
|
|
2513
2697
|
const services = inject("services");
|
|
2514
2698
|
const menu = ref();
|
|
@@ -2590,7 +2774,8 @@ const _sfc_main$9 = defineComponent({
|
|
|
2590
2774
|
};
|
|
2591
2775
|
}
|
|
2592
2776
|
});
|
|
2593
|
-
|
|
2777
|
+
|
|
2778
|
+
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2594
2779
|
const _component_content_menu = resolveComponent("content-menu");
|
|
2595
2780
|
return openBlock(), createBlock(_component_content_menu, {
|
|
2596
2781
|
"menu-data": _ctx.menuData,
|
|
@@ -2598,7 +2783,7 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2598
2783
|
style: { "overflow": "initial" }
|
|
2599
2784
|
}, null, 8, ["menu-data"]);
|
|
2600
2785
|
}
|
|
2601
|
-
|
|
2786
|
+
const LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$6]]);
|
|
2602
2787
|
|
|
2603
2788
|
const throttleTime = 150;
|
|
2604
2789
|
const select = async (data, editorService) => {
|
|
@@ -2745,8 +2930,9 @@ const _sfc_main$8 = defineComponent({
|
|
|
2745
2930
|
};
|
|
2746
2931
|
}
|
|
2747
2932
|
});
|
|
2933
|
+
|
|
2748
2934
|
const _hoisted_1$4 = ["id", "onMouseenter"];
|
|
2749
|
-
function _sfc_render$
|
|
2935
|
+
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2750
2936
|
const _component_el_input = resolveComponent("el-input");
|
|
2751
2937
|
const _component_el_tree = resolveComponent("el-tree");
|
|
2752
2938
|
const _component_layer_menu = resolveComponent("layer-menu");
|
|
@@ -2808,7 +2994,7 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2808
2994
|
_: 3
|
|
2809
2995
|
});
|
|
2810
2996
|
}
|
|
2811
|
-
|
|
2997
|
+
const LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$5]]);
|
|
2812
2998
|
|
|
2813
2999
|
const _sfc_main$7 = defineComponent({
|
|
2814
3000
|
components: { MIcon },
|
|
@@ -2847,11 +3033,12 @@ const _sfc_main$7 = defineComponent({
|
|
|
2847
3033
|
};
|
|
2848
3034
|
}
|
|
2849
3035
|
});
|
|
3036
|
+
|
|
2850
3037
|
const _hoisted_1$3 = {
|
|
2851
3038
|
key: 1,
|
|
2852
3039
|
class: "magic-editor-tab-panel-title"
|
|
2853
3040
|
};
|
|
2854
|
-
function _sfc_render$
|
|
3041
|
+
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2855
3042
|
const _component_m_icon = resolveComponent("m-icon");
|
|
2856
3043
|
const _component_el_tab_pane = resolveComponent("el-tab-pane");
|
|
2857
3044
|
return _ctx.config ? (openBlock(), createBlock(_component_el_tab_pane, {
|
|
@@ -2897,7 +3084,7 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2897
3084
|
_: 3
|
|
2898
3085
|
}, 8, ["name"])) : createCommentVNode("", true);
|
|
2899
3086
|
}
|
|
2900
|
-
|
|
3087
|
+
const TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$4]]);
|
|
2901
3088
|
|
|
2902
3089
|
const _sfc_main$6 = defineComponent({
|
|
2903
3090
|
components: { TabPane },
|
|
@@ -2918,7 +3105,8 @@ const _sfc_main$6 = defineComponent({
|
|
|
2918
3105
|
};
|
|
2919
3106
|
}
|
|
2920
3107
|
});
|
|
2921
|
-
|
|
3108
|
+
|
|
3109
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2922
3110
|
const _component_tab_pane = resolveComponent("tab-pane");
|
|
2923
3111
|
const _component_el_tabs = resolveComponent("el-tabs");
|
|
2924
3112
|
return _ctx.data.type === "tabs" && _ctx.data.items.length ? (openBlock(), createBlock(_component_el_tabs, {
|
|
@@ -2953,331 +3141,249 @@ function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2953
3141
|
_: 3
|
|
2954
3142
|
}, 8, ["modelValue"])) : createCommentVNode("", true);
|
|
2955
3143
|
}
|
|
2956
|
-
|
|
3144
|
+
const Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$3]]);
|
|
2957
3145
|
|
|
2958
|
-
const useScroll = (root) => {
|
|
2959
|
-
const pageBar = ref();
|
|
2960
|
-
const itemsContainer = ref();
|
|
2961
|
-
const pageBarWidth = ref(0);
|
|
2962
|
-
const canScroll = ref(false);
|
|
2963
|
-
const itemsContainerWidth = computed(() => pageBarWidth.value - 105);
|
|
2964
|
-
let translateLeft = 0;
|
|
2965
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
2966
|
-
for (const { contentRect } of entries) {
|
|
2967
|
-
const { width } = contentRect;
|
|
2968
|
-
pageBarWidth.value = width || 0;
|
|
2969
|
-
setCanScroll();
|
|
2970
|
-
}
|
|
2971
|
-
});
|
|
2972
|
-
const setCanScroll = () => {
|
|
2973
|
-
if (itemsContainer.value) {
|
|
2974
|
-
canScroll.value = itemsContainer.value.scrollWidth > pageBarWidth.value - 105;
|
|
2975
|
-
}
|
|
2976
|
-
};
|
|
2977
|
-
const scroll = (type) => {
|
|
2978
|
-
if (!itemsContainer.value)
|
|
2979
|
-
return;
|
|
2980
|
-
const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
|
|
2981
|
-
if (type === "left") {
|
|
2982
|
-
translateLeft += 100;
|
|
2983
|
-
if (translateLeft > 0) {
|
|
2984
|
-
translateLeft = 0;
|
|
2985
|
-
}
|
|
2986
|
-
} else if (type === "right") {
|
|
2987
|
-
translateLeft -= 100;
|
|
2988
|
-
if (-translateLeft > maxScrollLeft) {
|
|
2989
|
-
translateLeft = -maxScrollLeft;
|
|
2990
|
-
}
|
|
2991
|
-
} else if (type === "start") {
|
|
2992
|
-
translateLeft = 0;
|
|
2993
|
-
} else if (type === "end") {
|
|
2994
|
-
translateLeft = -maxScrollLeft;
|
|
2995
|
-
}
|
|
2996
|
-
itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
|
|
2997
|
-
};
|
|
2998
|
-
onMounted(() => {
|
|
2999
|
-
pageBar.value && resizeObserver.observe(pageBar.value);
|
|
3000
|
-
});
|
|
3001
|
-
onUnmounted(() => {
|
|
3002
|
-
resizeObserver.disconnect();
|
|
3003
|
-
});
|
|
3004
|
-
watch(() => root.value?.items.length, (length = 0, preLength = 0) => {
|
|
3005
|
-
setTimeout(() => {
|
|
3006
|
-
setCanScroll();
|
|
3007
|
-
if (length < preLength) {
|
|
3008
|
-
scroll("start");
|
|
3009
|
-
} else {
|
|
3010
|
-
scroll("end");
|
|
3011
|
-
}
|
|
3012
|
-
});
|
|
3013
|
-
});
|
|
3014
|
-
return {
|
|
3015
|
-
pageBar,
|
|
3016
|
-
itemsContainer,
|
|
3017
|
-
canScroll,
|
|
3018
|
-
itemsContainerWidth,
|
|
3019
|
-
scroll
|
|
3020
|
-
};
|
|
3021
|
-
};
|
|
3022
|
-
const _sfc_main$5 = defineComponent({
|
|
3023
|
-
components: { ArrowLeftBold, ArrowRightBold, CaretBottom, Plus, ToolButton },
|
|
3024
|
-
setup() {
|
|
3025
|
-
const services = inject("services");
|
|
3026
|
-
const editorService = services?.editorService;
|
|
3027
|
-
const root = computed(() => editorService?.get("root"));
|
|
3028
|
-
return {
|
|
3029
|
-
Delete: markRaw(Delete),
|
|
3030
|
-
DocumentCopy: markRaw(DocumentCopy),
|
|
3031
|
-
...useScroll(root),
|
|
3032
|
-
root,
|
|
3033
|
-
page: computed(() => editorService?.get("page")),
|
|
3034
|
-
switchPage(page) {
|
|
3035
|
-
editorService?.select(page);
|
|
3036
|
-
},
|
|
3037
|
-
addPage() {
|
|
3038
|
-
if (!editorService)
|
|
3039
|
-
return;
|
|
3040
|
-
const pageConfig = {
|
|
3041
|
-
type: NodeType.PAGE,
|
|
3042
|
-
name: generatePageNameByApp(toRaw(editorService.get("root")))
|
|
3043
|
-
};
|
|
3044
|
-
editorService.add(pageConfig);
|
|
3045
|
-
},
|
|
3046
|
-
copy(node) {
|
|
3047
|
-
node && editorService?.copy(node);
|
|
3048
|
-
editorService?.paste({
|
|
3049
|
-
left: 0,
|
|
3050
|
-
top: 0
|
|
3051
|
-
});
|
|
3052
|
-
},
|
|
3053
|
-
remove(node) {
|
|
3054
|
-
editorService?.remove(node);
|
|
3055
|
-
}
|
|
3056
|
-
};
|
|
3057
|
-
}
|
|
3058
|
-
});
|
|
3059
3146
|
const _hoisted_1$2 = {
|
|
3060
3147
|
class: "m-editor-page-bar",
|
|
3061
3148
|
ref: "pageBar"
|
|
3062
3149
|
};
|
|
3063
3150
|
const _hoisted_2 = ["onClick"];
|
|
3064
3151
|
const _hoisted_3 = { class: "m-editor-page-bar-title" };
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
3152
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
3153
|
+
__name: "PageBar",
|
|
3154
|
+
setup(__props) {
|
|
3155
|
+
const useScroll = (root2) => {
|
|
3156
|
+
const pageBar = ref();
|
|
3157
|
+
const itemsContainer = ref();
|
|
3158
|
+
const pageBarWidth = ref(0);
|
|
3159
|
+
const canScroll = ref(false);
|
|
3160
|
+
const itemsContainerWidth = computed(() => pageBarWidth.value - 105);
|
|
3161
|
+
let translateLeft = 0;
|
|
3162
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
3163
|
+
for (const { contentRect } of entries) {
|
|
3164
|
+
const { width } = contentRect;
|
|
3165
|
+
pageBarWidth.value = width || 0;
|
|
3166
|
+
setCanScroll();
|
|
3167
|
+
}
|
|
3168
|
+
});
|
|
3169
|
+
const setCanScroll = () => {
|
|
3170
|
+
if (itemsContainer.value) {
|
|
3171
|
+
canScroll.value = itemsContainer.value.scrollWidth > pageBarWidth.value - 105;
|
|
3172
|
+
}
|
|
3173
|
+
};
|
|
3174
|
+
const scroll = (type) => {
|
|
3175
|
+
if (!itemsContainer.value)
|
|
3176
|
+
return;
|
|
3177
|
+
const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
|
|
3178
|
+
if (type === "left") {
|
|
3179
|
+
translateLeft += 100;
|
|
3180
|
+
if (translateLeft > 0) {
|
|
3181
|
+
translateLeft = 0;
|
|
3182
|
+
}
|
|
3183
|
+
} else if (type === "right") {
|
|
3184
|
+
translateLeft -= 100;
|
|
3185
|
+
if (-translateLeft > maxScrollLeft) {
|
|
3186
|
+
translateLeft = -maxScrollLeft;
|
|
3187
|
+
}
|
|
3188
|
+
} else if (type === "start") {
|
|
3189
|
+
translateLeft = 0;
|
|
3190
|
+
} else if (type === "end") {
|
|
3191
|
+
translateLeft = -maxScrollLeft;
|
|
3192
|
+
}
|
|
3193
|
+
itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
|
|
3194
|
+
};
|
|
3195
|
+
onMounted(() => {
|
|
3196
|
+
pageBar.value && resizeObserver.observe(pageBar.value);
|
|
3197
|
+
});
|
|
3198
|
+
onUnmounted(() => {
|
|
3199
|
+
resizeObserver.disconnect();
|
|
3200
|
+
});
|
|
3201
|
+
watch(() => root2.value?.items.length, (length = 0, preLength = 0) => {
|
|
3202
|
+
setTimeout(() => {
|
|
3203
|
+
setCanScroll();
|
|
3204
|
+
if (length < preLength) {
|
|
3205
|
+
scroll("start");
|
|
3206
|
+
} else {
|
|
3207
|
+
scroll("end");
|
|
3208
|
+
}
|
|
3209
|
+
});
|
|
3210
|
+
});
|
|
3211
|
+
return {
|
|
3212
|
+
pageBar,
|
|
3213
|
+
itemsContainer,
|
|
3214
|
+
canScroll,
|
|
3215
|
+
itemsContainerWidth,
|
|
3216
|
+
scroll
|
|
3217
|
+
};
|
|
3218
|
+
};
|
|
3219
|
+
const services = inject("services");
|
|
3220
|
+
const editorService = services?.editorService;
|
|
3221
|
+
const root = computed(() => editorService?.get("root"));
|
|
3222
|
+
const scrollState = useScroll(root);
|
|
3223
|
+
const page = computed(() => editorService?.get("page"));
|
|
3224
|
+
const switchPage = (page2) => {
|
|
3225
|
+
editorService?.select(page2);
|
|
3226
|
+
};
|
|
3227
|
+
const addPage = () => {
|
|
3228
|
+
if (!editorService)
|
|
3229
|
+
return;
|
|
3230
|
+
const pageConfig = {
|
|
3231
|
+
type: NodeType.PAGE,
|
|
3232
|
+
name: generatePageNameByApp(toRaw(editorService.get("root")))
|
|
3233
|
+
};
|
|
3234
|
+
editorService.add(pageConfig);
|
|
3235
|
+
};
|
|
3236
|
+
const copy = (node) => {
|
|
3237
|
+
node && editorService?.copy(node);
|
|
3238
|
+
editorService?.paste({
|
|
3239
|
+
left: 0,
|
|
3240
|
+
top: 0
|
|
3241
|
+
});
|
|
3242
|
+
};
|
|
3243
|
+
const remove = (node) => {
|
|
3244
|
+
editorService?.remove(node);
|
|
3245
|
+
};
|
|
3246
|
+
return (_ctx, _cache) => {
|
|
3247
|
+
const _component_el_icon = resolveComponent("el-icon");
|
|
3248
|
+
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
3249
|
+
const _component_el_popover = resolveComponent("el-popover");
|
|
3250
|
+
return openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
3251
|
+
createElementVNode("div", {
|
|
3252
|
+
id: "m-editor-page-bar-add-icon",
|
|
3253
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3254
|
+
onClick: addPage
|
|
3255
|
+
}, [
|
|
3256
|
+
createVNode(_component_el_icon, null, {
|
|
3257
|
+
default: withCtx(() => [
|
|
3258
|
+
createVNode(unref(Plus))
|
|
3259
|
+
]),
|
|
3260
|
+
_: 1
|
|
3261
|
+
})
|
|
3095
3262
|
]),
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
key: 1,
|
|
3101
|
-
class: "m-editor-page-bar-items",
|
|
3102
|
-
ref: "itemsContainer",
|
|
3103
|
-
style: normalizeStyle(`width: ${_ctx.itemsContainerWidth}px`)
|
|
3104
|
-
}, [
|
|
3105
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.root.items, (item) => {
|
|
3106
|
-
return openBlock(), createElementBlock("div", {
|
|
3107
|
-
key: item.key,
|
|
3108
|
-
class: normalizeClass(["m-editor-page-bar-item", { active: _ctx.page?.id === item.id }]),
|
|
3109
|
-
onClick: ($event) => _ctx.switchPage(item)
|
|
3263
|
+
unref(scrollState).canScroll ? (openBlock(), createElementBlock("div", {
|
|
3264
|
+
key: 0,
|
|
3265
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3266
|
+
onClick: _cache[0] || (_cache[0] = ($event) => unref(scrollState).scroll("left"))
|
|
3110
3267
|
}, [
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
createVNode(
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
3268
|
+
createVNode(_component_el_icon, null, {
|
|
3269
|
+
default: withCtx(() => [
|
|
3270
|
+
createVNode(unref(ArrowLeftBold))
|
|
3271
|
+
]),
|
|
3272
|
+
_: 1
|
|
3273
|
+
})
|
|
3274
|
+
])) : createCommentVNode("", true),
|
|
3275
|
+
unref(root) ? (openBlock(), createElementBlock("div", {
|
|
3276
|
+
key: 1,
|
|
3277
|
+
class: "m-editor-page-bar-items",
|
|
3278
|
+
ref: "itemsContainer",
|
|
3279
|
+
style: normalizeStyle(`width: ${unref(scrollState).itemsContainerWidth}px`)
|
|
3280
|
+
}, [
|
|
3281
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(root).items, (item) => {
|
|
3282
|
+
return openBlock(), createElementBlock("div", {
|
|
3283
|
+
key: item.key,
|
|
3284
|
+
class: normalizeClass(["m-editor-page-bar-item", { active: unref(page)?.id === item.id }]),
|
|
3285
|
+
onClick: ($event) => switchPage(item)
|
|
3286
|
+
}, [
|
|
3287
|
+
createElementVNode("div", _hoisted_3, [
|
|
3288
|
+
renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
|
|
3289
|
+
createVNode(_component_el_tooltip, {
|
|
3290
|
+
effect: "dark",
|
|
3291
|
+
placement: "top-start",
|
|
3292
|
+
content: item.name
|
|
3293
|
+
}, {
|
|
3294
|
+
default: withCtx(() => [
|
|
3295
|
+
createElementVNode("span", null, toDisplayString(item.name), 1)
|
|
3296
|
+
]),
|
|
3297
|
+
_: 2
|
|
3298
|
+
}, 1032, ["content"])
|
|
3299
|
+
])
|
|
3300
|
+
]),
|
|
3301
|
+
createVNode(_component_el_popover, {
|
|
3302
|
+
"popper-class": "page-bar-popover",
|
|
3303
|
+
placement: "top",
|
|
3304
|
+
width: 160,
|
|
3305
|
+
trigger: "hover"
|
|
3117
3306
|
}, {
|
|
3118
|
-
|
|
3119
|
-
|
|
3307
|
+
reference: withCtx(() => [
|
|
3308
|
+
createVNode(_component_el_icon, { class: "m-editor-page-bar-menu-icon" }, {
|
|
3309
|
+
default: withCtx(() => [
|
|
3310
|
+
createVNode(unref(CaretBottom))
|
|
3311
|
+
]),
|
|
3312
|
+
_: 1
|
|
3313
|
+
})
|
|
3120
3314
|
]),
|
|
3121
|
-
_: 2
|
|
3122
|
-
}, 1032, ["content"])
|
|
3123
|
-
])
|
|
3124
|
-
]),
|
|
3125
|
-
createVNode(_component_el_popover, {
|
|
3126
|
-
"popper-class": "page-bar-popover",
|
|
3127
|
-
placement: "top",
|
|
3128
|
-
width: 160,
|
|
3129
|
-
trigger: "hover"
|
|
3130
|
-
}, {
|
|
3131
|
-
reference: withCtx(() => [
|
|
3132
|
-
createVNode(_component_el_icon, { class: "m-editor-page-bar-menu-icon" }, {
|
|
3133
3315
|
default: withCtx(() => [
|
|
3134
|
-
|
|
3316
|
+
createElementVNode("div", null, [
|
|
3317
|
+
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
3318
|
+
createVNode(_sfc_main$e, {
|
|
3319
|
+
data: {
|
|
3320
|
+
type: "button",
|
|
3321
|
+
text: "\u590D\u5236",
|
|
3322
|
+
icon: unref(DocumentCopy),
|
|
3323
|
+
handler: () => copy(item)
|
|
3324
|
+
}
|
|
3325
|
+
}, null, 8, ["data"]),
|
|
3326
|
+
createVNode(_sfc_main$e, {
|
|
3327
|
+
data: {
|
|
3328
|
+
type: "button",
|
|
3329
|
+
text: "\u5220\u9664",
|
|
3330
|
+
icon: unref(Delete),
|
|
3331
|
+
handler: () => remove(item)
|
|
3332
|
+
}
|
|
3333
|
+
}, null, 8, ["data"])
|
|
3334
|
+
])
|
|
3335
|
+
])
|
|
3135
3336
|
]),
|
|
3136
|
-
_:
|
|
3137
|
-
})
|
|
3138
|
-
])
|
|
3337
|
+
_: 2
|
|
3338
|
+
}, 1024)
|
|
3339
|
+
], 10, _hoisted_2);
|
|
3340
|
+
}), 128))
|
|
3341
|
+
], 4)) : createCommentVNode("", true),
|
|
3342
|
+
unref(scrollState).canScroll ? (openBlock(), createElementBlock("div", {
|
|
3343
|
+
key: 2,
|
|
3344
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3345
|
+
onClick: _cache[1] || (_cache[1] = ($event) => unref(scrollState).scroll("right"))
|
|
3346
|
+
}, [
|
|
3347
|
+
createVNode(_component_el_icon, null, {
|
|
3139
3348
|
default: withCtx(() => [
|
|
3140
|
-
|
|
3141
|
-
renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
3142
|
-
createVNode(_component_tool_button, {
|
|
3143
|
-
data: {
|
|
3144
|
-
type: "button",
|
|
3145
|
-
text: "\u590D\u5236",
|
|
3146
|
-
icon: _ctx.DocumentCopy,
|
|
3147
|
-
handler: () => _ctx.copy(item)
|
|
3148
|
-
}
|
|
3149
|
-
}, null, 8, ["data"]),
|
|
3150
|
-
createVNode(_component_tool_button, {
|
|
3151
|
-
data: {
|
|
3152
|
-
type: "button",
|
|
3153
|
-
text: "\u5220\u9664",
|
|
3154
|
-
icon: _ctx.Delete,
|
|
3155
|
-
handler: () => _ctx.remove(item)
|
|
3156
|
-
}
|
|
3157
|
-
}, null, 8, ["data"])
|
|
3158
|
-
])
|
|
3159
|
-
])
|
|
3349
|
+
createVNode(unref(ArrowRightBold))
|
|
3160
3350
|
]),
|
|
3161
|
-
_:
|
|
3162
|
-
}
|
|
3163
|
-
]
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3169
|
-
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.scroll("right"))
|
|
3170
|
-
}, [
|
|
3171
|
-
createVNode(_component_el_icon, null, {
|
|
3172
|
-
default: withCtx(() => [
|
|
3173
|
-
createVNode(_component_arrow_right_bold)
|
|
3174
|
-
]),
|
|
3175
|
-
_: 1
|
|
3176
|
-
})
|
|
3177
|
-
])) : createCommentVNode("", true)
|
|
3178
|
-
], 512);
|
|
3179
|
-
}
|
|
3180
|
-
var PageBar = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
|
|
3351
|
+
_: 1
|
|
3352
|
+
})
|
|
3353
|
+
])) : createCommentVNode("", true)
|
|
3354
|
+
], 512);
|
|
3355
|
+
};
|
|
3356
|
+
}
|
|
3357
|
+
});
|
|
3181
3358
|
|
|
3182
3359
|
class ScrollViewer$1 {
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
if (targetHeight < height) {
|
|
3203
|
-
this.target._top = 0;
|
|
3204
|
-
}
|
|
3205
|
-
this.scroll();
|
|
3206
|
-
}
|
|
3207
|
-
});
|
|
3208
|
-
this.wheelHandler = (event) => {
|
|
3209
|
-
if (this.targetEnter)
|
|
3210
|
-
return;
|
|
3211
|
-
const { deltaX, deltaY, currentTarget } = event;
|
|
3212
|
-
if (currentTarget !== this.container)
|
|
3213
|
-
return;
|
|
3214
|
-
this.setScrollOffset(deltaX, deltaY);
|
|
3215
|
-
this.scroll();
|
|
3216
|
-
this.scrollLeft = this.target._left;
|
|
3217
|
-
this.scrollTop = this.target._top;
|
|
3218
|
-
};
|
|
3219
|
-
this.mouseEnterHandler = () => {
|
|
3220
|
-
this.enter = true;
|
|
3221
|
-
};
|
|
3222
|
-
this.mouseLeaveHandler = () => {
|
|
3223
|
-
this.enter = false;
|
|
3224
|
-
};
|
|
3225
|
-
this.targetMouseEnterHandler = () => {
|
|
3226
|
-
this.targetEnter = true;
|
|
3227
|
-
};
|
|
3228
|
-
this.targetMouseLeaveHandler = () => {
|
|
3229
|
-
this.targetEnter = false;
|
|
3230
|
-
};
|
|
3231
|
-
this.mousedownHandler = (event) => {
|
|
3232
|
-
if (!this.keydown)
|
|
3233
|
-
return;
|
|
3234
|
-
event.stopImmediatePropagation();
|
|
3235
|
-
event.stopPropagation();
|
|
3236
|
-
this.target.style.cursor = "grabbing";
|
|
3237
|
-
this.x = event.clientX;
|
|
3238
|
-
this.y = event.clientY;
|
|
3239
|
-
document.addEventListener("mousemove", this.mousemoveHandler);
|
|
3240
|
-
document.addEventListener("mouseup", this.mouseupHandler);
|
|
3241
|
-
};
|
|
3242
|
-
this.mouseupHandler = () => {
|
|
3243
|
-
this.x = 0;
|
|
3244
|
-
this.y = 0;
|
|
3245
|
-
this.scrollLeft = this.target._left;
|
|
3246
|
-
this.scrollTop = this.target._top;
|
|
3247
|
-
this.removeHandler();
|
|
3248
|
-
};
|
|
3249
|
-
this.mousemoveHandler = (event) => {
|
|
3250
|
-
event.stopImmediatePropagation();
|
|
3251
|
-
event.stopPropagation();
|
|
3252
|
-
const deltaX = event.clientX - this.x;
|
|
3253
|
-
const deltaY = event.clientY - this.y;
|
|
3254
|
-
this.setScrollOffset(deltaX, deltaY);
|
|
3255
|
-
this.scroll();
|
|
3256
|
-
};
|
|
3257
|
-
this.keydownHandler = (event) => {
|
|
3258
|
-
if (event.code === Keys.ESCAPE && this.enter) {
|
|
3259
|
-
event.preventDefault();
|
|
3260
|
-
event.stopImmediatePropagation();
|
|
3261
|
-
event.stopPropagation();
|
|
3360
|
+
enter = false;
|
|
3361
|
+
targetEnter = false;
|
|
3362
|
+
keydown = false;
|
|
3363
|
+
container;
|
|
3364
|
+
target;
|
|
3365
|
+
zoom = 1;
|
|
3366
|
+
scrollLeft = 0;
|
|
3367
|
+
scrollTop = 0;
|
|
3368
|
+
x = 0;
|
|
3369
|
+
y = 0;
|
|
3370
|
+
resizeObserver = new ResizeObserver((entries) => {
|
|
3371
|
+
for (const { contentRect } of entries) {
|
|
3372
|
+
const { width, height } = contentRect;
|
|
3373
|
+
const targetRect = this.target.getBoundingClientRect();
|
|
3374
|
+
const targetWidth = targetRect.width * this.zoom;
|
|
3375
|
+
const targetMarginTop = Number(this.target.style.marginTop) || 0;
|
|
3376
|
+
const targetHeight = (targetRect.height + targetMarginTop) * this.zoom;
|
|
3377
|
+
if (targetWidth < width) {
|
|
3378
|
+
this.target._left = 0;
|
|
3262
3379
|
}
|
|
3263
|
-
if (
|
|
3264
|
-
|
|
3380
|
+
if (targetHeight < height) {
|
|
3381
|
+
this.target._top = 0;
|
|
3265
3382
|
}
|
|
3266
|
-
this.
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
this.keyupHandler = (event) => {
|
|
3271
|
-
if (event.code !== Keys.ESCAPE || !this.keydown) {
|
|
3272
|
-
return;
|
|
3273
|
-
}
|
|
3274
|
-
event.preventDefault();
|
|
3275
|
-
event.stopImmediatePropagation();
|
|
3276
|
-
event.stopPropagation();
|
|
3277
|
-
this.keydown = false;
|
|
3278
|
-
event.preventDefault();
|
|
3279
|
-
this.removeHandler();
|
|
3280
|
-
};
|
|
3383
|
+
this.scroll();
|
|
3384
|
+
}
|
|
3385
|
+
});
|
|
3386
|
+
constructor(options) {
|
|
3281
3387
|
this.container = options.container;
|
|
3282
3388
|
this.target = options.target;
|
|
3283
3389
|
this.zoom = options.zoom;
|
|
@@ -3313,6 +3419,79 @@ class ScrollViewer$1 {
|
|
|
3313
3419
|
document.removeEventListener("mousemove", this.mousemoveHandler);
|
|
3314
3420
|
document.removeEventListener("mouseup", this.mouseupHandler);
|
|
3315
3421
|
}
|
|
3422
|
+
wheelHandler = (event) => {
|
|
3423
|
+
if (this.targetEnter)
|
|
3424
|
+
return;
|
|
3425
|
+
const { deltaX, deltaY, currentTarget } = event;
|
|
3426
|
+
if (currentTarget !== this.container)
|
|
3427
|
+
return;
|
|
3428
|
+
this.setScrollOffset(deltaX, deltaY);
|
|
3429
|
+
this.scroll();
|
|
3430
|
+
this.scrollLeft = this.target._left;
|
|
3431
|
+
this.scrollTop = this.target._top;
|
|
3432
|
+
};
|
|
3433
|
+
mouseEnterHandler = () => {
|
|
3434
|
+
this.enter = true;
|
|
3435
|
+
};
|
|
3436
|
+
mouseLeaveHandler = () => {
|
|
3437
|
+
this.enter = false;
|
|
3438
|
+
};
|
|
3439
|
+
targetMouseEnterHandler = () => {
|
|
3440
|
+
this.targetEnter = true;
|
|
3441
|
+
};
|
|
3442
|
+
targetMouseLeaveHandler = () => {
|
|
3443
|
+
this.targetEnter = false;
|
|
3444
|
+
};
|
|
3445
|
+
mousedownHandler = (event) => {
|
|
3446
|
+
if (!this.keydown)
|
|
3447
|
+
return;
|
|
3448
|
+
event.stopImmediatePropagation();
|
|
3449
|
+
event.stopPropagation();
|
|
3450
|
+
this.target.style.cursor = "grabbing";
|
|
3451
|
+
this.x = event.clientX;
|
|
3452
|
+
this.y = event.clientY;
|
|
3453
|
+
document.addEventListener("mousemove", this.mousemoveHandler);
|
|
3454
|
+
document.addEventListener("mouseup", this.mouseupHandler);
|
|
3455
|
+
};
|
|
3456
|
+
mouseupHandler = () => {
|
|
3457
|
+
this.x = 0;
|
|
3458
|
+
this.y = 0;
|
|
3459
|
+
this.scrollLeft = this.target._left;
|
|
3460
|
+
this.scrollTop = this.target._top;
|
|
3461
|
+
this.removeHandler();
|
|
3462
|
+
};
|
|
3463
|
+
mousemoveHandler = (event) => {
|
|
3464
|
+
event.stopImmediatePropagation();
|
|
3465
|
+
event.stopPropagation();
|
|
3466
|
+
const deltaX = event.clientX - this.x;
|
|
3467
|
+
const deltaY = event.clientY - this.y;
|
|
3468
|
+
this.setScrollOffset(deltaX, deltaY);
|
|
3469
|
+
this.scroll();
|
|
3470
|
+
};
|
|
3471
|
+
keydownHandler = (event) => {
|
|
3472
|
+
if (event.code === Keys.ESCAPE && this.enter) {
|
|
3473
|
+
event.preventDefault();
|
|
3474
|
+
event.stopImmediatePropagation();
|
|
3475
|
+
event.stopPropagation();
|
|
3476
|
+
}
|
|
3477
|
+
if (event.code !== Keys.ESCAPE || !this.enter || this.keydown) {
|
|
3478
|
+
return;
|
|
3479
|
+
}
|
|
3480
|
+
this.keydown = true;
|
|
3481
|
+
this.target.style.cursor = "grab";
|
|
3482
|
+
this.container.addEventListener("mousedown", this.mousedownHandler);
|
|
3483
|
+
};
|
|
3484
|
+
keyupHandler = (event) => {
|
|
3485
|
+
if (event.code !== Keys.ESCAPE || !this.keydown) {
|
|
3486
|
+
return;
|
|
3487
|
+
}
|
|
3488
|
+
event.preventDefault();
|
|
3489
|
+
event.stopImmediatePropagation();
|
|
3490
|
+
event.stopPropagation();
|
|
3491
|
+
this.keydown = false;
|
|
3492
|
+
event.preventDefault();
|
|
3493
|
+
this.removeHandler();
|
|
3494
|
+
};
|
|
3316
3495
|
setScrollOffset(deltaX, deltaY) {
|
|
3317
3496
|
const { width, height } = this.container.getBoundingClientRect();
|
|
3318
3497
|
const targetRect = this.target.getBoundingClientRect();
|
|
@@ -3380,11 +3559,12 @@ const _sfc_main$4 = defineComponent({
|
|
|
3380
3559
|
};
|
|
3381
3560
|
}
|
|
3382
3561
|
});
|
|
3562
|
+
|
|
3383
3563
|
const _hoisted_1$1 = {
|
|
3384
3564
|
class: "m-editor-scroll-viewer-container",
|
|
3385
3565
|
ref: "container"
|
|
3386
3566
|
};
|
|
3387
|
-
function _sfc_render$
|
|
3567
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3388
3568
|
return openBlock(), createElementBlock("div", _hoisted_1$1, [
|
|
3389
3569
|
createElementVNode("div", {
|
|
3390
3570
|
ref: "el",
|
|
@@ -3394,170 +3574,172 @@ function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3394
3574
|
], 4)
|
|
3395
3575
|
], 512);
|
|
3396
3576
|
}
|
|
3397
|
-
|
|
3577
|
+
const ScrollViewer = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$2]]);
|
|
3398
3578
|
|
|
3399
|
-
const _sfc_main$3 = defineComponent({
|
|
3400
|
-
|
|
3401
|
-
|
|
3579
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
3580
|
+
__name: "ViewerMenu",
|
|
3581
|
+
props: {
|
|
3582
|
+
isMultiSelect: { type: Boolean, default: false }
|
|
3583
|
+
},
|
|
3584
|
+
setup(__props, { expose }) {
|
|
3585
|
+
const props = __props;
|
|
3402
3586
|
const services = inject("services");
|
|
3403
3587
|
const editorService = services?.editorService;
|
|
3404
3588
|
const menu = ref();
|
|
3405
3589
|
const canPaste = ref(false);
|
|
3406
3590
|
const canCenter = ref(false);
|
|
3407
3591
|
const node = computed(() => editorService?.get("node"));
|
|
3592
|
+
const nodes = computed(() => editorService?.get("nodes"));
|
|
3408
3593
|
const parent = computed(() => editorService?.get("parent"));
|
|
3409
|
-
const
|
|
3594
|
+
const stage = computed(() => editorService?.get("stage"));
|
|
3410
3595
|
const stageContentMenu = inject("stageContentMenu", []);
|
|
3411
|
-
|
|
3412
|
-
|
|
3596
|
+
const menuData = reactive([
|
|
3597
|
+
{
|
|
3598
|
+
type: "button",
|
|
3599
|
+
text: "\u6C34\u5E73\u5C45\u4E2D",
|
|
3600
|
+
display: () => canCenter.value && !props.isMultiSelect,
|
|
3601
|
+
handler: () => {
|
|
3602
|
+
if (!node.value)
|
|
3603
|
+
return;
|
|
3604
|
+
editorService?.alignCenter(node.value);
|
|
3605
|
+
}
|
|
3606
|
+
},
|
|
3607
|
+
{
|
|
3608
|
+
type: "button",
|
|
3609
|
+
text: "\u590D\u5236",
|
|
3610
|
+
icon: markRaw(DocumentCopy),
|
|
3611
|
+
handler: () => {
|
|
3612
|
+
nodes.value && editorService?.copy(nodes.value);
|
|
3613
|
+
canPaste.value = true;
|
|
3614
|
+
}
|
|
3615
|
+
},
|
|
3616
|
+
{
|
|
3617
|
+
type: "button",
|
|
3618
|
+
text: "\u7C98\u8D34",
|
|
3619
|
+
display: () => canPaste.value,
|
|
3620
|
+
handler: () => {
|
|
3621
|
+
const rect = menu.value?.$el.getBoundingClientRect();
|
|
3622
|
+
const parentRect = stage.value?.container?.getBoundingClientRect();
|
|
3623
|
+
const initialLeft = (rect?.left || 0) - (parentRect?.left || 0);
|
|
3624
|
+
const initialTop = (rect?.top || 0) - (parentRect?.top || 0);
|
|
3625
|
+
if (!nodes.value || nodes.value.length === 0)
|
|
3626
|
+
return;
|
|
3627
|
+
editorService?.paste({ left: initialLeft, top: initialTop });
|
|
3628
|
+
}
|
|
3629
|
+
},
|
|
3630
|
+
{
|
|
3631
|
+
type: "divider",
|
|
3632
|
+
direction: "horizontal",
|
|
3633
|
+
display: () => {
|
|
3634
|
+
if (!node.value)
|
|
3635
|
+
return false;
|
|
3636
|
+
return !isPage(node.value);
|
|
3637
|
+
}
|
|
3638
|
+
},
|
|
3639
|
+
{
|
|
3640
|
+
type: "button",
|
|
3641
|
+
text: "\u4E0A\u79FB\u4E00\u5C42",
|
|
3642
|
+
icon: markRaw(Top),
|
|
3643
|
+
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
3644
|
+
handler: () => {
|
|
3645
|
+
editorService?.moveLayer(1);
|
|
3646
|
+
}
|
|
3647
|
+
},
|
|
3648
|
+
{
|
|
3649
|
+
type: "button",
|
|
3650
|
+
text: "\u4E0B\u79FB\u4E00\u5C42",
|
|
3651
|
+
icon: markRaw(Bottom),
|
|
3652
|
+
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
3653
|
+
handler: () => {
|
|
3654
|
+
editorService?.moveLayer(-1);
|
|
3655
|
+
}
|
|
3656
|
+
},
|
|
3657
|
+
{
|
|
3658
|
+
type: "button",
|
|
3659
|
+
text: "\u7F6E\u9876",
|
|
3660
|
+
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
3661
|
+
handler: () => {
|
|
3662
|
+
editorService?.moveLayer(LayerOffset.TOP);
|
|
3663
|
+
}
|
|
3664
|
+
},
|
|
3665
|
+
{
|
|
3666
|
+
type: "button",
|
|
3667
|
+
text: "\u7F6E\u5E95",
|
|
3668
|
+
display: () => !isPage(node.value) && !props.isMultiSelect,
|
|
3669
|
+
handler: () => {
|
|
3670
|
+
editorService?.moveLayer(LayerOffset.BOTTOM);
|
|
3671
|
+
}
|
|
3672
|
+
},
|
|
3673
|
+
{
|
|
3674
|
+
type: "divider",
|
|
3675
|
+
direction: "horizontal",
|
|
3676
|
+
display: () => !isPage(node.value) && !props.isMultiSelect
|
|
3677
|
+
},
|
|
3678
|
+
{
|
|
3679
|
+
type: "button",
|
|
3680
|
+
text: "\u5220\u9664",
|
|
3681
|
+
icon: Delete,
|
|
3682
|
+
display: () => !isPage(node.value),
|
|
3683
|
+
handler: () => {
|
|
3684
|
+
nodes.value && editorService?.remove(nodes.value);
|
|
3685
|
+
}
|
|
3686
|
+
},
|
|
3687
|
+
{
|
|
3688
|
+
type: "divider",
|
|
3689
|
+
direction: "horizontal"
|
|
3690
|
+
},
|
|
3691
|
+
{
|
|
3692
|
+
type: "button",
|
|
3693
|
+
text: "\u6E05\u7A7A\u53C2\u8003\u7EBF",
|
|
3694
|
+
handler: () => {
|
|
3695
|
+
editorService?.get("stage").clearGuides();
|
|
3696
|
+
}
|
|
3697
|
+
},
|
|
3698
|
+
...stageContentMenu
|
|
3699
|
+
]);
|
|
3700
|
+
onMounted(async () => {
|
|
3701
|
+
const data = await storageService.getItem(COPY_STORAGE_KEY);
|
|
3413
3702
|
canPaste.value = data !== "undefined" && !!data;
|
|
3414
3703
|
});
|
|
3415
3704
|
watch(parent, async () => {
|
|
3416
3705
|
if (!parent.value || !editorService)
|
|
3417
3706
|
return canCenter.value = false;
|
|
3418
3707
|
const layout = await editorService.getLayout(parent.value);
|
|
3419
|
-
|
|
3708
|
+
const isLayoutConform = [Layout.ABSOLUTE, Layout.FIXED].includes(layout);
|
|
3709
|
+
const isTypeConform = nodes.value?.every((selectedNode) => ![NodeType.ROOT, NodeType.PAGE, "pop"].includes(`${selectedNode?.type}`));
|
|
3710
|
+
canCenter.value = isLayoutConform && !!isTypeConform;
|
|
3420
3711
|
}, { immediate: true });
|
|
3421
|
-
|
|
3422
|
-
menu
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
},
|
|
3432
|
-
{
|
|
3433
|
-
type: "button",
|
|
3434
|
-
text: "\u590D\u5236",
|
|
3435
|
-
icon: markRaw(DocumentCopy),
|
|
3436
|
-
handler: () => {
|
|
3437
|
-
node.value && editorService?.copy(node.value);
|
|
3438
|
-
canPaste.value = true;
|
|
3439
|
-
}
|
|
3440
|
-
},
|
|
3441
|
-
{
|
|
3442
|
-
type: "button",
|
|
3443
|
-
text: "\u7C98\u8D34",
|
|
3444
|
-
display: () => canPaste.value,
|
|
3445
|
-
handler: () => {
|
|
3446
|
-
const stage = editorService?.get("stage");
|
|
3447
|
-
const rect = menu.value?.$el.getBoundingClientRect();
|
|
3448
|
-
const parentRect = stage?.container?.getBoundingClientRect();
|
|
3449
|
-
let left = (rect?.left || 0) - (parentRect?.left || 0);
|
|
3450
|
-
let top = (rect?.top || 0) - (parentRect?.top || 0);
|
|
3451
|
-
if (node.value?.items && stage) {
|
|
3452
|
-
const parentEl = stage.renderer.contentWindow?.document.getElementById(`${node.value.id}`);
|
|
3453
|
-
const parentElRect = parentEl?.getBoundingClientRect();
|
|
3454
|
-
left = left - (parentElRect?.left || 0);
|
|
3455
|
-
top = top - (parentElRect?.top || 0);
|
|
3456
|
-
}
|
|
3457
|
-
editorService?.paste({ left, top });
|
|
3458
|
-
}
|
|
3459
|
-
},
|
|
3460
|
-
{
|
|
3461
|
-
type: "divider",
|
|
3462
|
-
direction: "horizontal",
|
|
3463
|
-
display: () => !isPage.value
|
|
3464
|
-
},
|
|
3465
|
-
{
|
|
3466
|
-
type: "button",
|
|
3467
|
-
text: "\u4E0A\u79FB\u4E00\u5C42",
|
|
3468
|
-
icon: markRaw(Top),
|
|
3469
|
-
display: () => !isPage.value,
|
|
3470
|
-
handler: () => {
|
|
3471
|
-
editorService?.moveLayer(1);
|
|
3472
|
-
}
|
|
3473
|
-
},
|
|
3474
|
-
{
|
|
3475
|
-
type: "button",
|
|
3476
|
-
text: "\u4E0B\u79FB\u4E00\u5C42",
|
|
3477
|
-
icon: markRaw(Bottom),
|
|
3478
|
-
display: () => !isPage.value,
|
|
3479
|
-
handler: () => {
|
|
3480
|
-
editorService?.moveLayer(-1);
|
|
3481
|
-
}
|
|
3482
|
-
},
|
|
3483
|
-
{
|
|
3484
|
-
type: "button",
|
|
3485
|
-
text: "\u7F6E\u9876",
|
|
3486
|
-
display: () => !isPage.value,
|
|
3487
|
-
handler: () => {
|
|
3488
|
-
editorService?.moveLayer(LayerOffset.TOP);
|
|
3489
|
-
}
|
|
3490
|
-
},
|
|
3491
|
-
{
|
|
3492
|
-
type: "button",
|
|
3493
|
-
text: "\u7F6E\u5E95",
|
|
3494
|
-
display: () => !isPage.value,
|
|
3495
|
-
handler: () => {
|
|
3496
|
-
editorService?.moveLayer(LayerOffset.BOTTOM);
|
|
3497
|
-
}
|
|
3498
|
-
},
|
|
3499
|
-
{
|
|
3500
|
-
type: "divider",
|
|
3501
|
-
direction: "horizontal",
|
|
3502
|
-
display: () => !isPage.value
|
|
3503
|
-
},
|
|
3504
|
-
{
|
|
3505
|
-
type: "button",
|
|
3506
|
-
text: "\u5220\u9664",
|
|
3507
|
-
icon: Delete,
|
|
3508
|
-
display: () => !isPage.value,
|
|
3509
|
-
handler: () => {
|
|
3510
|
-
node.value && editorService?.remove(node.value);
|
|
3511
|
-
}
|
|
3512
|
-
},
|
|
3513
|
-
{
|
|
3514
|
-
type: "divider",
|
|
3515
|
-
direction: "horizontal"
|
|
3516
|
-
},
|
|
3517
|
-
{
|
|
3518
|
-
type: "button",
|
|
3519
|
-
text: "\u6E05\u7A7A\u53C2\u8003\u7EBF",
|
|
3520
|
-
handler: () => {
|
|
3521
|
-
editorService?.get("stage").clearGuides();
|
|
3522
|
-
}
|
|
3523
|
-
},
|
|
3524
|
-
...stageContentMenu
|
|
3525
|
-
]),
|
|
3526
|
-
show(e) {
|
|
3527
|
-
menu.value?.show(e);
|
|
3528
|
-
}
|
|
3712
|
+
const show = (e) => {
|
|
3713
|
+
menu.value?.show(e);
|
|
3714
|
+
};
|
|
3715
|
+
expose({ show });
|
|
3716
|
+
return (_ctx, _cache) => {
|
|
3717
|
+
return openBlock(), createBlock(_sfc_main$a, {
|
|
3718
|
+
"menu-data": menuData,
|
|
3719
|
+
ref_key: "menu",
|
|
3720
|
+
ref: menu
|
|
3721
|
+
}, null, 8, ["menu-data"]);
|
|
3529
3722
|
};
|
|
3530
3723
|
}
|
|
3531
3724
|
});
|
|
3532
|
-
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3533
|
-
const _component_content_menu = resolveComponent("content-menu");
|
|
3534
|
-
return openBlock(), createBlock(_component_content_menu, {
|
|
3535
|
-
"menu-data": _ctx.menuData,
|
|
3536
|
-
ref: "menu"
|
|
3537
|
-
}, null, 8, ["menu-data"]);
|
|
3538
|
-
}
|
|
3539
|
-
var ViewerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
|
|
3540
3725
|
|
|
3541
|
-
const _sfc_main$2 = defineComponent({
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
},
|
|
3547
|
-
setup() {
|
|
3726
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
3727
|
+
__name: "Stage",
|
|
3728
|
+
setup(__props) {
|
|
3729
|
+
let stage = null;
|
|
3730
|
+
let runtime = null;
|
|
3548
3731
|
const services = inject("services");
|
|
3549
3732
|
const stageOptions = inject("stageOptions");
|
|
3550
3733
|
const stageWrap = ref();
|
|
3551
3734
|
const stageContainer = ref();
|
|
3552
3735
|
const menu = ref();
|
|
3736
|
+
const isMultiSelect = computed(() => services?.editorService.get("nodes")?.length > 1);
|
|
3553
3737
|
const stageRect = computed(() => services?.uiService.get("stageRect"));
|
|
3554
3738
|
const uiSelectMode = computed(() => services?.uiService.get("uiSelectMode"));
|
|
3555
3739
|
const root = computed(() => services?.editorService.get("root"));
|
|
3556
3740
|
const page = computed(() => services?.editorService.get("page"));
|
|
3557
3741
|
const zoom = computed(() => services?.uiService.get("zoom") || 1);
|
|
3558
3742
|
const node = computed(() => services?.editorService.get("node"));
|
|
3559
|
-
let stage = null;
|
|
3560
|
-
let runtime = null;
|
|
3561
3743
|
const getGuideLineKey = (key) => `${key}_${root.value?.id}_${page.value?.id}`;
|
|
3562
3744
|
watchEffect(() => {
|
|
3563
3745
|
if (stage)
|
|
@@ -3597,6 +3779,9 @@ const _sfc_main$2 = defineComponent({
|
|
|
3597
3779
|
stage?.on("highlight", (el) => {
|
|
3598
3780
|
services?.editorService.highlight(el.id);
|
|
3599
3781
|
});
|
|
3782
|
+
stage?.on("multiSelect", (els) => {
|
|
3783
|
+
services?.editorService.multiSelect(els.map((el) => el.id));
|
|
3784
|
+
});
|
|
3600
3785
|
stage?.on("update", (ev) => {
|
|
3601
3786
|
if (ev.parentEl) {
|
|
3602
3787
|
services?.editorService.moveToContainer({ id: ev.el.id, style: ev.style }, ev.parentEl.id);
|
|
@@ -3655,100 +3840,96 @@ const _sfc_main$2 = defineComponent({
|
|
|
3655
3840
|
resizeObserver.disconnect();
|
|
3656
3841
|
services?.editorService.set("stage", null);
|
|
3657
3842
|
});
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
e2.
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
const
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
}
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3693
|
-
top = e.clientY - containerRect.top + scrollTop;
|
|
3694
|
-
left = e.clientX - containerRect.left + scrollLeft;
|
|
3695
|
-
if (parentEl && doc) {
|
|
3696
|
-
const { left: parentLeft, top: parentTop } = getOffset(parentEl);
|
|
3697
|
-
left = left - calcValueByFontsize(doc, parentLeft);
|
|
3698
|
-
top = top - calcValueByFontsize(doc, parentTop);
|
|
3699
|
-
}
|
|
3843
|
+
const contextmenuHandler = (e2) => {
|
|
3844
|
+
e2.preventDefault();
|
|
3845
|
+
menu.value?.show(e2);
|
|
3846
|
+
};
|
|
3847
|
+
const dragoverHandler = (e2) => {
|
|
3848
|
+
e2.preventDefault();
|
|
3849
|
+
if (e2.dataTransfer) {
|
|
3850
|
+
e2.dataTransfer.dropEffect = "move";
|
|
3851
|
+
}
|
|
3852
|
+
};
|
|
3853
|
+
const dropHandler = async (e) => {
|
|
3854
|
+
e.preventDefault();
|
|
3855
|
+
const doc = stage?.renderer.contentWindow?.document;
|
|
3856
|
+
const parentEl = doc?.querySelector(`.${stageOptions?.containerHighlightClassName}`);
|
|
3857
|
+
let parent = page.value;
|
|
3858
|
+
if (parentEl) {
|
|
3859
|
+
parent = services?.editorService.getNodeById(parentEl.id, false);
|
|
3860
|
+
}
|
|
3861
|
+
if (e.dataTransfer && parent && stageContainer.value && stage) {
|
|
3862
|
+
const config = eval(`(${e.dataTransfer.getData("data")})`);
|
|
3863
|
+
const layout = await services?.editorService.getLayout(parent);
|
|
3864
|
+
const containerRect = stageContainer.value.getBoundingClientRect();
|
|
3865
|
+
const { scrollTop, scrollLeft } = stage.mask;
|
|
3866
|
+
const { style = {} } = config;
|
|
3867
|
+
let top = 0;
|
|
3868
|
+
let left = 0;
|
|
3869
|
+
let position = "relative";
|
|
3870
|
+
if (layout === Layout.ABSOLUTE) {
|
|
3871
|
+
position = "absolute";
|
|
3872
|
+
top = e.clientY - containerRect.top + scrollTop;
|
|
3873
|
+
left = e.clientX - containerRect.left + scrollLeft;
|
|
3874
|
+
if (parentEl && doc) {
|
|
3875
|
+
const { left: parentLeft, top: parentTop } = getOffset(parentEl);
|
|
3876
|
+
left = left - calcValueByFontsize(doc, parentLeft);
|
|
3877
|
+
top = top - calcValueByFontsize(doc, parentTop);
|
|
3700
3878
|
}
|
|
3701
|
-
config.style = {
|
|
3702
|
-
...style,
|
|
3703
|
-
position,
|
|
3704
|
-
top,
|
|
3705
|
-
left
|
|
3706
|
-
};
|
|
3707
|
-
config.inputEvent = e;
|
|
3708
|
-
services?.editorService.add(config, parent);
|
|
3709
3879
|
}
|
|
3880
|
+
config.style = {
|
|
3881
|
+
...style,
|
|
3882
|
+
position,
|
|
3883
|
+
top,
|
|
3884
|
+
left
|
|
3885
|
+
};
|
|
3886
|
+
config.inputEvent = e;
|
|
3887
|
+
services?.editorService.add(config, parent);
|
|
3710
3888
|
}
|
|
3711
3889
|
};
|
|
3890
|
+
return (_ctx, _cache) => {
|
|
3891
|
+
return openBlock(), createBlock(ScrollViewer, {
|
|
3892
|
+
class: "m-editor-stage",
|
|
3893
|
+
ref_key: "stageWrap",
|
|
3894
|
+
ref: stageWrap,
|
|
3895
|
+
width: unref(stageRect)?.width,
|
|
3896
|
+
height: unref(stageRect)?.height,
|
|
3897
|
+
zoom: unref(zoom)
|
|
3898
|
+
}, {
|
|
3899
|
+
default: withCtx(() => [
|
|
3900
|
+
createElementVNode("div", {
|
|
3901
|
+
class: "m-editor-stage-container",
|
|
3902
|
+
ref_key: "stageContainer",
|
|
3903
|
+
ref: stageContainer,
|
|
3904
|
+
style: normalizeStyle(`transform: scale(${unref(zoom)})`),
|
|
3905
|
+
onContextmenu: contextmenuHandler,
|
|
3906
|
+
onDrop: dropHandler,
|
|
3907
|
+
onDragover: dragoverHandler
|
|
3908
|
+
}, null, 36),
|
|
3909
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
3910
|
+
createVNode(_sfc_main$3, {
|
|
3911
|
+
ref_key: "menu",
|
|
3912
|
+
ref: menu,
|
|
3913
|
+
"is-multi-select": unref(isMultiSelect)
|
|
3914
|
+
}, null, 8, ["is-multi-select"])
|
|
3915
|
+
]))
|
|
3916
|
+
]),
|
|
3917
|
+
_: 1
|
|
3918
|
+
}, 8, ["width", "height", "zoom"]);
|
|
3919
|
+
};
|
|
3712
3920
|
}
|
|
3713
3921
|
});
|
|
3714
|
-
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3715
|
-
const _component_viewer_menu = resolveComponent("viewer-menu");
|
|
3716
|
-
const _component_scroll_viewer = resolveComponent("scroll-viewer");
|
|
3717
|
-
return openBlock(), createBlock(_component_scroll_viewer, {
|
|
3718
|
-
class: "m-editor-stage",
|
|
3719
|
-
ref: "stageWrap",
|
|
3720
|
-
width: _ctx.stageRect?.width,
|
|
3721
|
-
height: _ctx.stageRect?.height,
|
|
3722
|
-
zoom: _ctx.zoom
|
|
3723
|
-
}, {
|
|
3724
|
-
default: withCtx(() => [
|
|
3725
|
-
createElementVNode("div", {
|
|
3726
|
-
class: "m-editor-stage-container",
|
|
3727
|
-
ref: "stageContainer",
|
|
3728
|
-
style: normalizeStyle(`transform: scale(${_ctx.zoom})`),
|
|
3729
|
-
onContextmenu: _cache[0] || (_cache[0] = (...args) => _ctx.contextmenuHandler && _ctx.contextmenuHandler(...args)),
|
|
3730
|
-
onDrop: _cache[1] || (_cache[1] = (...args) => _ctx.dropHandler && _ctx.dropHandler(...args)),
|
|
3731
|
-
onDragover: _cache[2] || (_cache[2] = (...args) => _ctx.dragoverHandler && _ctx.dragoverHandler(...args))
|
|
3732
|
-
}, null, 36),
|
|
3733
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
3734
|
-
createVNode(_component_viewer_menu, { ref: "menu" }, null, 512)
|
|
3735
|
-
]))
|
|
3736
|
-
]),
|
|
3737
|
-
_: 1
|
|
3738
|
-
}, 8, ["width", "height", "zoom"]);
|
|
3739
|
-
}
|
|
3740
|
-
var MagicStage = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
|
|
3741
3922
|
|
|
3742
3923
|
const _sfc_main$1 = defineComponent({
|
|
3743
3924
|
name: "m-editor-workspace",
|
|
3744
3925
|
components: {
|
|
3745
|
-
PageBar,
|
|
3746
|
-
MagicStage
|
|
3926
|
+
PageBar: _sfc_main$5,
|
|
3927
|
+
MagicStage: _sfc_main$2
|
|
3747
3928
|
},
|
|
3748
3929
|
setup() {
|
|
3749
3930
|
const services = inject("services");
|
|
3750
3931
|
const workspace = ref();
|
|
3751
|
-
const
|
|
3932
|
+
const nodes = computed(() => services?.editorService.get("nodes"));
|
|
3752
3933
|
let keycon;
|
|
3753
3934
|
const mouseenterHandler = () => {
|
|
3754
3935
|
workspace.value?.focus();
|
|
@@ -3764,26 +3945,26 @@ const _sfc_main$1 = defineComponent({
|
|
|
3764
3945
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
3765
3946
|
keycon.keyup("delete", (e) => {
|
|
3766
3947
|
e.inputEvent.preventDefault();
|
|
3767
|
-
if (!
|
|
3948
|
+
if (!nodes.value || isPage(nodes.value[0]))
|
|
3768
3949
|
return;
|
|
3769
|
-
services?.editorService.remove(
|
|
3950
|
+
services?.editorService.remove(nodes.value);
|
|
3770
3951
|
}).keyup("backspace", (e) => {
|
|
3771
3952
|
e.inputEvent.preventDefault();
|
|
3772
|
-
if (!
|
|
3953
|
+
if (!nodes.value || isPage(nodes.value[0]))
|
|
3773
3954
|
return;
|
|
3774
|
-
services?.editorService.remove(
|
|
3955
|
+
services?.editorService.remove(nodes.value);
|
|
3775
3956
|
}).keydown([ctrl, "c"], (e) => {
|
|
3776
3957
|
e.inputEvent.preventDefault();
|
|
3777
|
-
|
|
3958
|
+
nodes.value && services?.editorService.copy(nodes.value);
|
|
3778
3959
|
}).keydown([ctrl, "v"], (e) => {
|
|
3779
3960
|
e.inputEvent.preventDefault();
|
|
3780
|
-
|
|
3961
|
+
nodes.value && services?.editorService.paste();
|
|
3781
3962
|
}).keydown([ctrl, "x"], (e) => {
|
|
3782
3963
|
e.inputEvent.preventDefault();
|
|
3783
|
-
if (!
|
|
3964
|
+
if (!nodes.value || isPage(nodes.value[0]))
|
|
3784
3965
|
return;
|
|
3785
|
-
services?.editorService.copy(
|
|
3786
|
-
services?.editorService.remove(
|
|
3966
|
+
services?.editorService.copy(nodes.value);
|
|
3967
|
+
services?.editorService.remove(nodes.value);
|
|
3787
3968
|
}).keydown([ctrl, "z"], (e) => {
|
|
3788
3969
|
e.inputEvent.preventDefault();
|
|
3789
3970
|
services?.editorService.undo();
|
|
@@ -3845,6 +4026,7 @@ const _sfc_main$1 = defineComponent({
|
|
|
3845
4026
|
};
|
|
3846
4027
|
}
|
|
3847
4028
|
});
|
|
4029
|
+
|
|
3848
4030
|
const _hoisted_1 = {
|
|
3849
4031
|
class: "m-editor-workspace",
|
|
3850
4032
|
tabindex: "1",
|
|
@@ -3869,14 +4051,14 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3869
4051
|
})
|
|
3870
4052
|
], 512);
|
|
3871
4053
|
}
|
|
3872
|
-
|
|
4054
|
+
const Workspace = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
3873
4055
|
|
|
3874
4056
|
class ComponentList extends BaseService {
|
|
4057
|
+
state = reactive({
|
|
4058
|
+
list: []
|
|
4059
|
+
});
|
|
3875
4060
|
constructor() {
|
|
3876
4061
|
super([]);
|
|
3877
|
-
this.state = reactive({
|
|
3878
|
-
list: []
|
|
3879
|
-
});
|
|
3880
4062
|
}
|
|
3881
4063
|
setList(componentGroupList) {
|
|
3882
4064
|
this.state.list = componentGroupList;
|
|
@@ -3885,7 +4067,7 @@ class ComponentList extends BaseService {
|
|
|
3885
4067
|
return this.state.list;
|
|
3886
4068
|
}
|
|
3887
4069
|
}
|
|
3888
|
-
|
|
4070
|
+
const componentListService = new ComponentList();
|
|
3889
4071
|
|
|
3890
4072
|
const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
3891
4073
|
const MIN_LEFT_COLUMN_WIDTH = 45;
|
|
@@ -4005,7 +4187,7 @@ class Ui extends BaseService {
|
|
|
4005
4187
|
return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
|
|
4006
4188
|
}
|
|
4007
4189
|
}
|
|
4008
|
-
|
|
4190
|
+
const uiService = new Ui();
|
|
4009
4191
|
|
|
4010
4192
|
const _sfc_main = defineComponent({
|
|
4011
4193
|
name: "m-editor",
|
|
@@ -4135,7 +4317,8 @@ const _sfc_main = defineComponent({
|
|
|
4135
4317
|
historyService,
|
|
4136
4318
|
propsService,
|
|
4137
4319
|
editorService,
|
|
4138
|
-
uiService
|
|
4320
|
+
uiService,
|
|
4321
|
+
storageService
|
|
4139
4322
|
};
|
|
4140
4323
|
provide("services", services);
|
|
4141
4324
|
provide("layerContentMenu", props.layerContentMenu);
|
|
@@ -4154,6 +4337,7 @@ const _sfc_main = defineComponent({
|
|
|
4154
4337
|
return services;
|
|
4155
4338
|
}
|
|
4156
4339
|
});
|
|
4340
|
+
|
|
4157
4341
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
4158
4342
|
const _component_nav_menu = resolveComponent("nav-menu");
|
|
4159
4343
|
const _component_sidebar = resolveComponent("sidebar");
|
|
@@ -4214,23 +4398,23 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
4214
4398
|
_: 3
|
|
4215
4399
|
}, 8, ["code-options"]);
|
|
4216
4400
|
}
|
|
4217
|
-
|
|
4401
|
+
const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
4218
4402
|
|
|
4219
|
-
var index$1 = /* #__PURE__ */ (() => ".m-editor-nav-menu {\n display: flex;\n z-index: 5;\n -webkit-box-pack: justify;\n justify-content: space-between;\n -webkit-box-align: center;\n align-items: center;\n background-color: #ffffff;\n font-size: 19.2px;\n color: #070303;\n font-weight: 400;\n box-sizing: border-box;\n margin: 0px;\n flex: 0 0 35px;\n border-bottom: 1px solid #d8dee8;\n}\n.m-editor-nav-menu > div {\n display: flex;\n height: 100%;\n z-index: 1;\n align-items: center;\n}\n.m-editor-nav-menu .menu-center {\n justify-content: center;\n}\n.m-editor-nav-menu .menu-right {\n justify-content: flex-end;\n}\n.m-editor-nav-menu .menu-item {\n flex-direction: row;\n -webkit-box-align: center;\n align-items: center;\n vertical-align: middle;\n font-size: 14px;\n line-height: 1;\n height: 100%;\n color: rgba(255, 255, 255, 0.7);\n box-sizing: inherit;\n z-index: 1;\n display: flex !important;\n transition: all 0.3s ease 0s;\n border-bottom: 2px solid transparent;\n margin: 0;\n}\n.m-editor-nav-menu .menu-item .is-disabled {\n opacity: 0.5;\n}\n.m-editor-nav-menu .menu-item .is-text {\n padding: 5px;\n}\n.m-editor-nav-menu .menu-item .is-text,\n.m-editor-nav-menu .menu-item i {\n color: #070303;\n}\n.m-editor-nav-menu .menu-item .icon {\n display: flex;\n -webkit-box-align: center;\n align-items: center;\n height: 100%;\n padding: 0px 8px;\n}\n.m-editor-nav-menu .menu-item .menu-item-text {\n color: #070303;\n}\n.m-editor {\n display: flex;\n flex-direction: column;\n width: 100%;\n}\n.m-editor-content {\n width: 100%;\n height: calc(100% - 35px);\n display: flex;\n justify-self: space-between;\n}\n.m-editor-framework-center {\n position: relative;\n transform: translateZ(0);\n flex: 1;\n}\n.m-editor-framework-left {\n background-color: #ffffff;\n}\n.m-editor-framework-center .el-scrollbar__view {\n height: 100%;\n min-height: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.m-editor-empty-panel {\n display: flex;\n flex: 1;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n height: calc(100% - 32px);\n}\n.m-editor-empty-content {\n display: flex;\n justify-content: space-evenly;\n flex-direction: row;\n width: 100%;\n}\n.m-editor-empty-button {\n border: 3px solid rgba(0, 0, 0, 0.2);\n padding: 10px 40px;\n color: rgba(0, 0, 0, 0.6);\n cursor: pointer;\n}\n.m-editor-empty-button i {\n height: 180px;\n line-height: 180px;\n font-size: 100px;\n}\n.m-editor-empty-button p {\n text-align: center;\n font-size: 20px;\n margin-top: 5px;\n}\n.m-editor-empty-button:hover {\n border-color: #2882e0;\n color: #2882e0;\n}\n.m-editor-sidebar {\n height: 100%;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header {\n background: #2882e0;\n border: 0;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header.is-left {\n width: 40px;\n margin-right: 0;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__nav-wrap {\n margin: 0;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__nav {\n border: 0;\n border-radius: 0;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .tab-label {\n margin-left: 2px;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__item.is-left {\n line-height: 15px;\n border: 0;\n height: auto;\n padding: 8px;\n color: rgb(255, 255, 255);\n box-sizing: border-box;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__item.is-left.is-left.is-active {\n background: #ffffff;\n border: 0;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__item.is-left.is-left.is-active i {\n color: #353140;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__item.is-left.is-left.is-active .magic-editor-tab-panel-title {\n color: #353140;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .el-tabs__item.is-left.is-left:first-child {\n border-right: 0;\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header i {\n font-size: 25px;\n color: rgba(255, 255, 255, 0.6);\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header i:hover {\n color: rgb(255, 255, 255);\n}\n.m-editor-sidebar.el-tabs--left .el-tabs__header .magic-editor-tab-panel-title {\n font-size: 12px;\n white-space: normal;\n}\n.m-editor-sidebar .el-scrollbar {\n height: 100%;\n}\n.m-editor-sidebar .el-tree {\n min-height: 100%;\n}\n.m-editor-sidebar .fold-icon {\n position: absolute;\n bottom: 8px;\n left: 0px;\n width: 45px;\n padding-left: 8px;\n color: #fff;\n font-size: 32px;\n opacity: 0.8;\n cursor: pointer;\n}\n.m-editor-sidebar .fold-icon:hover {\n background: rgba(0, 0, 0, 0.2);\n}\n.m-editor-sidebar .el-tabs__content,\n.m-editor-sidebar .el-tab-pane {\n height: 100%;\n}\n.magic-editor-layer-panel {\n background: #ffffff;\n}\n.magic-editor-layer-panel .search-input {\n background: #ffffff;\n color: #bbbbbb;\n padding: 10px;\n position: absolute;\n top: 0;\n left: 0;\n z-index: 1;\n}\n.magic-editor-layer-panel .search-input .el-input__suffix {\n padding: 10px 5px;\n}\n.magic-editor-layer-panel .node-content {\n flex: 1;\n display: flex;\n width: 100%;\n}\n.magic-editor-layer-panel .node-content > div {\n width: 8px;\n}\n.magic-editor-layer-panel .node-content > span {\n width: calc(100% - 68px);\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n.magic-editor-layer-panel .node-content > i {\n margin-right: 10px;\n font-size: 20px;\n}\n.magic-editor-layer-panel .node-content > i.lock {\n color: #bbb;\n}\n.magic-editor-layer-panel,\n.magic-editor-layer-panel .el-tree {\n background-color: #ffffff;\n color: #313a40;\n}\n.magic-editor-layer-panel .el-tree--highlight-current .el-tree-node.is-current > .el-tree-node__content {\n background-color: #2882e0;\n color: #fff;\n}\n.magic-editor-layer-panel .cus-tree-node {\n width: 100%;\n overflow: hidden;\n}\n.magic-editor-layer-panel .cus-tree-node-hover {\n background-color: #f3f5f9;\n width: 100%;\n}\n.magic-editor-layer-panel .el-tree-node:focus > .el-tree-node__content {\n background-color: #2882e0;\n color: #fff;\n}\n.ui-tree-tip {\n width: 100%;\n height: 25px;\n margin-left: 10px;\n background: #ffffff;\n font-style: italic;\n color: #555554;\n position: absolute;\n top: 40px;\n left: 0;\n z-index: 1;\n}\n.ui-component-panel {\n height: 100%;\n border-top: 0 !important;\n margin-top: 50px;\n background-color: #ffffff;\n}\n.ui-component-panel .search-input {\n background: #f8fbff;\n color: #bbbbbb;\n padding: 10px;\n position: absolute;\n top: 0;\n left: 0;\n box-sizing: border-box;\n z-index: 1;\n}\n.ui-component-panel .search-input .el-input__prefix {\n padding: 10px;\n}\n.ui-component-panel .search-input .el-input__suffix {\n padding: 10px 5px;\n}\n.ui-component-panel .el-collapse-item > div:first-of-type {\n border-bottom: 1px solid #d9dbdd;\n margin-bottom: 10px;\n}\n.ui-component-panel .el-collapse-item__header {\n background: #ffffff;\n color: #070303;\n height: 25px;\n line-height: 25px;\n padding-left: 10px;\n font-size: 12px;\n}\n.ui-component-panel .el-collapse-item__header i {\n margin-right: 5px;\n font-size: 14px;\n}\n.ui-component-panel .el-collapse-item__wrap {\n background: #ffffff;\n border-bottom: 0;\n}\n.ui-component-panel .el-collapse-item__wrap .el-collapse-item__content {\n padding: 10px;\n display: flex;\n flex-wrap: wrap;\n}\n.ui-component-panel .el-collapse-item__wrap .component-item {\n display: flex;\n overflow: hidden;\n text-overflow: ellipsis;\n margin: 5px 10px;\n box-sizing: border-box;\n color: #070303;\n flex-direction: column;\n width: 42px;\n cursor: pointer;\n}\n.ui-component-panel .el-collapse-item__wrap .component-item i {\n font-size: 20px;\n background: #fff;\n height: 40px;\n width: 40px;\n line-height: 40px;\n border-radius: 5px;\n color: #909090;\n border: 1px solid #d9dbdd;\n display: flex;\n justify-content: space-evenly;\n align-items: center;\n margin-bottom: 5px;\n}\n.ui-component-panel .el-collapse-item__wrap .component-item i:hover {\n background: #2882e0;\n color: #fff;\n border-color: #4e8be1;\n}\n.ui-component-panel .el-collapse-item__wrap .component-item span {\n font-size: 12px;\n text-align: center;\n}\n.ui-component-panel .el-collapse-item__wrap .component-item .el-tooltip {\n width: 50px;\n height: 30px;\n line-height: 15px;\n display: block;\n white-space: normal;\n margin: 0;\n}\n.m-editor-resizer {\n border-left: 1px solid transparent;\n border-right: 1px solid transparent;\n width: 8px;\n margin: 0 -5px;\n height: 100%;\n opacity: 0.9;\n background: padding-box #d8dee8;\n box-sizing: border-box;\n cursor: col-resize;\n z-index: 1;\n}\n.m-editor-resizer:hover {\n border-color: #d8dee8;\n}\n.m-editor-resizer .icon-container {\n visibility: hidden;\n opacity: 0;\n transition: opacity 0.4s;\n width: 20px;\n height: 120px;\n line-height: 120px;\n text-align: center;\n background: #d8dee8;\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n cursor: pointer;\n}\n.m-editor-resizer .icon-container.position-left {\n transform: translate(calc(-100% - 4px), -50%);\n}\n.m-editor-resizer .icon-container.position-right {\n transform: translate(calc(100% + 4px), -50%);\n}\n.m-editor-resizer .icon {\n color: #fff;\n font-size: 18px;\n}\n.magic-editor-resizer:hover .icon-container {\n visibility: visible;\n opacity: 1;\n}\n.m-editor-workspace {\n height: 100%;\n width: 100%;\n user-select: none;\n}\n.m-editor-workspace:focus-visible {\n outline: 0;\n}\n.m-editor-page-bar {\n position: fixed;\n bottom: 0;\n left: 0;\n display: flex;\n width: 100%;\n height: 32px;\n line-height: 32px;\n color: #070303;\n background-color: #f3f3f3;\n border-top: 1px solid #d9dbdd;\n z-index: 2;\n overflow: hidden;\n}\n.m-editor-page-bar-items {\n display: flex;\n transition: transform 0.3s;\n}\n.m-editor-page-bar-item {\n padding: 0 10px;\n cursor: pointer;\n border-right: 1px solid #d9dbdd;\n display: flex;\n justify-items: center;\n align-items: center;\n background-color: #f3f3f3;\n white-space: nowrap;\n}\n.m-editor-page-bar-item.active {\n background-color: #fff;\n cursor: text;\n}\n.m-editor-page-bar-item.active .m-editor-page-bar-menu-icon {\n cursor: pointer;\n}\n.m-editor-page-bar-item-icon {\n position: relative;\n z-index: 1;\n}\n.m-editor-page-bar-item-title {\n max-width: 150px;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n}\n.page-bar-popover.el-popper.el-popover {\n padding: 10px 0;\n}\n.page-bar-popover .menu-item {\n cursor: pointer;\n transition: all 0.2s ease 0s;\n padding: 5px 14px;\n}\n.page-bar-popover .menu-item .el-button--text,\n.page-bar-popover .menu-item i {\n color: #070303;\n}\n.page-bar-popover .menu-item:hover {\n background-color: #f3f5f9;\n}\n.m-editor-props-panel {\n padding: 0 10px;\n}\n.m-editor-props-panel.small .el-form-item__label {\n font-size: 12px;\n}\n.m-editor-props-panel.small .m-fieldset legend {\n font-size: 12px;\n}\n.m-editor-props-panel.small .el-tabs__item {\n font-size: 12px;\n}\n.m-editor-props-panel .el-input__wrapper {\n border-radius: 0;\n}\n.m-editor-props-panel-popper.small span,\n.m-editor-props-panel-popper.small a,\n.m-editor-props-panel-popper.small p {\n font-size: 12px;\n}\n.magic-editor-content-menu {\n position: fixed;\n font-size: 12px;\n background: #fff;\n box-shadow: 0 2px 8px 2px rgba(68, 73, 77, 0.16);\n z-index: 9999;\n transform-origin: 0% 0%;\n font-weight: 600;\n padding: 4px 0px;\n overflow: auto;\n max-height: 100%;\n}\n.magic-editor-content-menu .menu-item {\n color: #333;\n display: flex;\n -webkit-box-align: center;\n align-items: center;\n cursor: pointer;\n min-width: 140px;\n transition: all 0.2s ease 0s;\n padding: 5px 14px;\n border-left: 2px solid transparent;\n}\n.magic-editor-content-menu .menu-item .el-button {\n width: 100%;\n justify-content: flex-start;\n}\n.magic-editor-content-menu .menu-item .el-button--text,\n.magic-editor-content-menu .menu-item i {\n color: #070303;\n}\n.magic-editor-content-menu .menu-item.divider {\n padding: 0 14px;\n}\n.magic-editor-content-menu .menu-item.divider .el-divider {\n margin: 0;\n}\n.magic-editor-content-menu .menu-item:hover {\n background-color: #f3f5f9;\n}\n.m-editor-stage {\n position: relative;\n width: 100%;\n height: calc(100% - 32px);\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n.m-editor-stage-container {\n width: 100%;\n height: 100%;\n z-index: 0;\n position: relative;\n transition: transform 0.3s;\n box-sizing: content-box;\n box-shadow: rgba(0, 0, 0, 0.04) 0px 3px 5px;\n}\n.m-editor-stage-container::-webkit-scrollbar {\n width: 0 !important;\n}\n.magic-code-editor {\n width: 100%;\n}\n.magic-code-editor .margin {\n margin: 0;\n}")();
|
|
4403
|
+
const index$1 = '';
|
|
4220
4404
|
|
|
4221
4405
|
const defaultInstallOpt = {};
|
|
4222
|
-
|
|
4406
|
+
const index = {
|
|
4223
4407
|
install: (app, opt) => {
|
|
4224
4408
|
const option = Object.assign(defaultInstallOpt, opt || {});
|
|
4225
4409
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
4226
4410
|
setConfig(option);
|
|
4227
4411
|
app.component(Editor.name, Editor);
|
|
4228
|
-
app.component(
|
|
4412
|
+
app.component(_sfc_main$k.name, _sfc_main$k);
|
|
4229
4413
|
app.component(CodeLink.name, CodeLink);
|
|
4230
4414
|
app.component(Code.name, Code);
|
|
4231
4415
|
app.component(CodeEditor.name, CodeEditor);
|
|
4232
4416
|
}
|
|
4233
4417
|
};
|
|
4234
4418
|
|
|
4235
|
-
export { COPY_STORAGE_KEY, ComponentListPanel, DEFAULT_CONFIG, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, Keys, LayerOffset, LayerPanel, Layout, PropsPanel, CodeEditor as TMagicCodeEditor, Editor as TMagicEditor, ToolButton, V_GUIDE_LINE_STORAGE_KEY, change2Fixed, debug, index as default, editorService, error, eventsService, fillConfig, fixNodeLeft, generatePageName, generatePageNameByApp, getConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getRelativeStyle, historyService, info, isFixed, log, propsService, setConfig, setLayout, uiService, warn };
|
|
4236
|
-
//# sourceMappingURL=tmagic-editor.
|
|
4419
|
+
export { COPY_STORAGE_KEY, ComponentListPanel, DEFAULT_CONFIG, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, Keys, LayerOffset, LayerPanel, Layout, PropsPanel, CodeEditor as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$e as ToolButton, V_GUIDE_LINE_STORAGE_KEY, change2Fixed, debug, index as default, editorService, error, eventsService, fillConfig, fixNodeLeft, generatePageName, generatePageNameByApp, getConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getRelativeStyle, historyService, info, isFixed, log, propsService, setConfig, setLayout, storageService, uiService, warn };
|
|
4420
|
+
//# sourceMappingURL=tmagic-editor.mjs.map
|