@tmagic/editor 1.1.0-beta.3 → 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/style.css +1 -1
- package/dist/{tmagic-editor.es.js → tmagic-editor.mjs} +1342 -1130
- package/dist/tmagic-editor.mjs.map +1 -0
- package/dist/tmagic-editor.umd.js +1357 -1145
- 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 +2 -2
- 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 +13 -4
- 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 -220
- 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 +118 -135
- package/src/services/events.ts +1 -1
- package/src/services/history.ts +1 -1
- package/src/services/props.ts +63 -11
- package/src/services/storage.ts +133 -0
- package/src/services/ui.ts +10 -4
- package/src/theme/framework.scss +1 -1
- package/src/theme/stage.scss +2 -2
- package/src/type.ts +23 -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 -24
- 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 +26 -2
- 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 +16 -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 -22
- 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
|
@@ -4,31 +4,31 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.serialize, global.iconsVue, global.lodashEs, global.monaco, global.StageCore, global.schema, global.utils, global.events, global.core, global.Gesto, global.ElementPlus, global.KeyController));
|
|
5
5
|
})(this, (function (exports, vue, serialize, iconsVue, lodashEs, monaco, StageCore, schema, utils, events, core, Gesto, elementPlus, KeyController) { 'use strict';
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
|
|
8
8
|
|
|
9
9
|
function _interopNamespace(e) {
|
|
10
10
|
if (e && e.__esModule) return e;
|
|
11
|
-
|
|
11
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
12
12
|
if (e) {
|
|
13
|
-
|
|
13
|
+
for (const k in e) {
|
|
14
14
|
if (k !== 'default') {
|
|
15
|
-
|
|
15
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
16
16
|
Object.defineProperty(n, k, d.get ? d : {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get:
|
|
18
|
+
get: () => e[k]
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
}
|
|
21
|
+
}
|
|
22
22
|
}
|
|
23
|
-
n
|
|
23
|
+
n.default = e;
|
|
24
24
|
return Object.freeze(n);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
const serialize__default = /*#__PURE__*/_interopDefaultLegacy(serialize);
|
|
28
|
+
const monaco__namespace = /*#__PURE__*/_interopNamespace(monaco);
|
|
29
|
+
const StageCore__default = /*#__PURE__*/_interopDefaultLegacy(StageCore);
|
|
30
|
+
const Gesto__default = /*#__PURE__*/_interopDefaultLegacy(Gesto);
|
|
31
|
+
const KeyController__default = /*#__PURE__*/_interopDefaultLegacy(KeyController);
|
|
32
32
|
|
|
33
33
|
if (typeof global === "undefined") {
|
|
34
34
|
window.global = window;
|
|
@@ -37,14 +37,6 @@
|
|
|
37
37
|
window.globalThis = window;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
var _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
40
|
const _sfc_main$m = vue.defineComponent({
|
|
49
41
|
name: "m-fields-vs-code",
|
|
50
42
|
props: ["model", "name", "config", "prop"],
|
|
@@ -62,7 +54,16 @@
|
|
|
62
54
|
};
|
|
63
55
|
}
|
|
64
56
|
});
|
|
65
|
-
|
|
57
|
+
|
|
58
|
+
const _export_sfc = (sfc, props) => {
|
|
59
|
+
const target = sfc.__vccOpts || sfc;
|
|
60
|
+
for (const [key, val] of props) {
|
|
61
|
+
target[key] = val;
|
|
62
|
+
}
|
|
63
|
+
return target;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
66
67
|
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
67
68
|
return vue.openBlock(), vue.createBlock(_component_magic_code_editor, {
|
|
68
69
|
style: vue.normalizeStyle(`height: ${_ctx.height}`),
|
|
@@ -71,7 +72,7 @@
|
|
|
71
72
|
onSave: _ctx.save
|
|
72
73
|
}, null, 8, ["style", "init-values", "language", "onSave"]);
|
|
73
74
|
}
|
|
74
|
-
|
|
75
|
+
const Code = /* @__PURE__ */ _export_sfc(_sfc_main$m, [["render", _sfc_render$g]]);
|
|
75
76
|
|
|
76
77
|
const _sfc_main$l = vue.defineComponent({
|
|
77
78
|
name: "m-fields-code-link",
|
|
@@ -97,7 +98,7 @@
|
|
|
97
98
|
vue.watchEffect(() => {
|
|
98
99
|
if (!props.model || !props.name)
|
|
99
100
|
return;
|
|
100
|
-
modelValue.value.form[props.name] = serialize__default
|
|
101
|
+
modelValue.value.form[props.name] = serialize__default.default(props.model[props.name], {
|
|
101
102
|
space: 2,
|
|
102
103
|
unsafe: true
|
|
103
104
|
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
@@ -128,7 +129,8 @@
|
|
|
128
129
|
};
|
|
129
130
|
}
|
|
130
131
|
});
|
|
131
|
-
|
|
132
|
+
|
|
133
|
+
function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
132
134
|
const _component_m_fields_link = vue.resolveComponent("m-fields-link");
|
|
133
135
|
return vue.openBlock(), vue.createBlock(_component_m_fields_link, {
|
|
134
136
|
config: _ctx.formConfig,
|
|
@@ -137,26 +139,21 @@
|
|
|
137
139
|
onChange: _ctx.changeHandler
|
|
138
140
|
}, null, 8, ["config", "model", "onChange"]);
|
|
139
141
|
}
|
|
140
|
-
|
|
142
|
+
const CodeLink = /* @__PURE__ */ _export_sfc(_sfc_main$l, [["render", _sfc_render$f]]);
|
|
141
143
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
name: "m-fields-ui-select",
|
|
144
|
+
const _hoisted_1$d = /* @__PURE__ */ vue.createTextVNode("\u53D6\u6D88");
|
|
145
|
+
const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
|
|
146
|
+
__name: "UISelect",
|
|
146
147
|
props: {
|
|
147
|
-
labelWidth:
|
|
148
|
-
config:
|
|
149
|
-
model:
|
|
150
|
-
prop:
|
|
151
|
-
|
|
152
|
-
default() {
|
|
153
|
-
return "";
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
name: String
|
|
148
|
+
labelWidth: null,
|
|
149
|
+
config: null,
|
|
150
|
+
model: null,
|
|
151
|
+
prop: null,
|
|
152
|
+
name: null
|
|
157
153
|
},
|
|
158
154
|
emits: ["change"],
|
|
159
|
-
setup(
|
|
155
|
+
setup(__props, { emit }) {
|
|
156
|
+
const props = __props;
|
|
160
157
|
const services = vue.inject("services");
|
|
161
158
|
const mForm = vue.inject("mForm");
|
|
162
159
|
const val = vue.computed(() => props.model[props.name]);
|
|
@@ -178,97 +175,89 @@
|
|
|
178
175
|
cancelHandler();
|
|
179
176
|
}
|
|
180
177
|
};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
},
|
|
198
|
-
cancelHandler,
|
|
199
|
-
deleteHandler() {
|
|
200
|
-
if (props.model) {
|
|
201
|
-
props.model[props.name] = "";
|
|
202
|
-
emit("change", "");
|
|
203
|
-
mForm?.$emit("field-change", props.prop, "");
|
|
204
|
-
}
|
|
178
|
+
const toName = vue.computed(() => {
|
|
179
|
+
const config = services?.editorService.getNodeById(val.value);
|
|
180
|
+
return config?.name || "";
|
|
181
|
+
});
|
|
182
|
+
const startSelect = () => {
|
|
183
|
+
if (!services?.uiService)
|
|
184
|
+
return;
|
|
185
|
+
services.uiService.set("uiSelectMode", true);
|
|
186
|
+
uiSelectMode.value = true;
|
|
187
|
+
globalThis.document.addEventListener("ui-select", clickHandler);
|
|
188
|
+
};
|
|
189
|
+
const deleteHandler = () => {
|
|
190
|
+
if (props.model) {
|
|
191
|
+
props.model[props.name] = "";
|
|
192
|
+
emit("change", "");
|
|
193
|
+
mForm?.$emit("field-change", props.prop, "");
|
|
205
194
|
}
|
|
206
195
|
};
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
class: "m-fields-ui-select",
|
|
216
|
-
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.cancelHandler && _ctx.cancelHandler(...args))
|
|
217
|
-
}, [
|
|
218
|
-
vue.createVNode(_component_el_button, {
|
|
219
|
-
type: "danger",
|
|
220
|
-
icon: _ctx.Delete,
|
|
221
|
-
text: "",
|
|
222
|
-
style: { "padding": "0" }
|
|
223
|
-
}, {
|
|
224
|
-
default: vue.withCtx(() => [
|
|
225
|
-
_hoisted_1$d
|
|
226
|
-
]),
|
|
227
|
-
_: 1
|
|
228
|
-
}, 8, ["icon"])
|
|
229
|
-
])) : (vue.openBlock(), vue.createElementBlock("div", {
|
|
230
|
-
key: 1,
|
|
231
|
-
class: "m-fields-ui-select",
|
|
232
|
-
onClick: _cache[1] || (_cache[1] = (...args) => _ctx.startSelect && _ctx.startSelect(...args)),
|
|
233
|
-
style: { "display": "flex" }
|
|
234
|
-
}, [
|
|
235
|
-
vue.createVNode(_component_el_tooltip, { content: "\u6E05\u9664" }, {
|
|
236
|
-
default: vue.withCtx(() => [
|
|
237
|
-
_ctx.val ? (vue.openBlock(), vue.createBlock(_component_el_button, {
|
|
238
|
-
key: 0,
|
|
239
|
-
style: { "padding": "0" },
|
|
240
|
-
type: "danger",
|
|
241
|
-
icon: _ctx.Close,
|
|
242
|
-
text: "",
|
|
243
|
-
onClick: vue.withModifiers(_ctx.deleteHandler, ["stop"])
|
|
244
|
-
}, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
|
|
245
|
-
]),
|
|
246
|
-
_: 1
|
|
247
|
-
}),
|
|
248
|
-
vue.createVNode(_component_el_tooltip, {
|
|
249
|
-
content: _ctx.val ? _ctx.toName + "_" + _ctx.val : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
|
|
250
|
-
}, {
|
|
251
|
-
default: vue.withCtx(() => [
|
|
196
|
+
return (_ctx, _cache) => {
|
|
197
|
+
const _component_el_button = vue.resolveComponent("el-button");
|
|
198
|
+
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
199
|
+
return uiSelectMode.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
200
|
+
key: 0,
|
|
201
|
+
class: "m-fields-ui-select",
|
|
202
|
+
onClick: cancelHandler
|
|
203
|
+
}, [
|
|
252
204
|
vue.createVNode(_component_el_button, {
|
|
205
|
+
type: "danger",
|
|
206
|
+
icon: vue.unref(iconsVue.Delete),
|
|
253
207
|
text: "",
|
|
254
|
-
style: { "padding": "0"
|
|
208
|
+
style: { "padding": "0" }
|
|
255
209
|
}, {
|
|
256
210
|
default: vue.withCtx(() => [
|
|
257
|
-
|
|
211
|
+
_hoisted_1$d
|
|
258
212
|
]),
|
|
259
213
|
_: 1
|
|
260
|
-
})
|
|
261
|
-
]),
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
214
|
+
}, 8, ["icon"])
|
|
215
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", {
|
|
216
|
+
key: 1,
|
|
217
|
+
class: "m-fields-ui-select",
|
|
218
|
+
onClick: startSelect,
|
|
219
|
+
style: { "display": "flex" }
|
|
220
|
+
}, [
|
|
221
|
+
vue.createVNode(_component_el_tooltip, { content: "\u6E05\u9664" }, {
|
|
222
|
+
default: vue.withCtx(() => [
|
|
223
|
+
vue.unref(val) ? (vue.openBlock(), vue.createBlock(_component_el_button, {
|
|
224
|
+
key: 0,
|
|
225
|
+
style: { "padding": "0" },
|
|
226
|
+
type: "danger",
|
|
227
|
+
icon: vue.unref(iconsVue.Close),
|
|
228
|
+
text: "",
|
|
229
|
+
onClick: vue.withModifiers(deleteHandler, ["stop"])
|
|
230
|
+
}, null, 8, ["icon", "onClick"])) : vue.createCommentVNode("", true)
|
|
231
|
+
]),
|
|
232
|
+
_: 1
|
|
233
|
+
}),
|
|
234
|
+
vue.createVNode(_component_el_tooltip, {
|
|
235
|
+
content: vue.unref(val) ? vue.unref(toName) + "_" + vue.unref(val) : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
|
|
236
|
+
}, {
|
|
237
|
+
default: vue.withCtx(() => [
|
|
238
|
+
vue.createVNode(_component_el_button, {
|
|
239
|
+
text: "",
|
|
240
|
+
style: { "padding": "0", "margin": "0" }
|
|
241
|
+
}, {
|
|
242
|
+
default: vue.withCtx(() => [
|
|
243
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(val) ? vue.unref(toName) + "_" + vue.unref(val) : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"), 1)
|
|
244
|
+
]),
|
|
245
|
+
_: 1
|
|
246
|
+
})
|
|
247
|
+
]),
|
|
248
|
+
_: 1
|
|
249
|
+
}, 8, ["content"])
|
|
250
|
+
]));
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
267
256
|
|
|
268
257
|
const toString = (v, language) => {
|
|
269
258
|
let value = "";
|
|
270
259
|
if (typeof v !== "string") {
|
|
271
|
-
value = serialize__default
|
|
260
|
+
value = serialize__default.default(v, {
|
|
272
261
|
space: 2,
|
|
273
262
|
unsafe: true
|
|
274
263
|
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
@@ -387,14 +376,15 @@
|
|
|
387
376
|
};
|
|
388
377
|
}
|
|
389
378
|
});
|
|
379
|
+
|
|
390
380
|
const _hoisted_1$c = {
|
|
391
381
|
ref: "codeEditor",
|
|
392
382
|
class: "magic-code-editor"
|
|
393
383
|
};
|
|
394
|
-
function _sfc_render$
|
|
384
|
+
function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
|
|
395
385
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$c, null, 512);
|
|
396
386
|
}
|
|
397
|
-
|
|
387
|
+
const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$j, [["render", _sfc_render$e]]);
|
|
398
388
|
|
|
399
389
|
let $TMAGIC_EDITOR = {};
|
|
400
390
|
const setConfig = (option) => {
|
|
@@ -403,6 +393,9 @@
|
|
|
403
393
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
404
394
|
|
|
405
395
|
class UndoRedo {
|
|
396
|
+
elementList;
|
|
397
|
+
listCursor;
|
|
398
|
+
listMaxSize;
|
|
406
399
|
constructor(listMaxSize = 200) {
|
|
407
400
|
const minListMaxSize = 2;
|
|
408
401
|
this.elementList = [];
|
|
@@ -498,12 +491,12 @@
|
|
|
498
491
|
}
|
|
499
492
|
};
|
|
500
493
|
class BaseService extends events.EventEmitter {
|
|
494
|
+
pluginOptionsList = {};
|
|
495
|
+
middleware = {};
|
|
496
|
+
taskList = [];
|
|
497
|
+
doingTask = false;
|
|
501
498
|
constructor(methods = [], serialMethods = []) {
|
|
502
499
|
super();
|
|
503
|
-
this.pluginOptionsList = {};
|
|
504
|
-
this.middleware = {};
|
|
505
|
-
this.taskList = [];
|
|
506
|
-
this.doingTask = false;
|
|
507
500
|
methods.forEach((propertyName) => {
|
|
508
501
|
const scope = this;
|
|
509
502
|
const sourceMethod = scope[propertyName];
|
|
@@ -560,14 +553,14 @@
|
|
|
560
553
|
}
|
|
561
554
|
|
|
562
555
|
class History extends BaseService {
|
|
556
|
+
state = vue.reactive({
|
|
557
|
+
pageSteps: {},
|
|
558
|
+
pageId: void 0,
|
|
559
|
+
canRedo: false,
|
|
560
|
+
canUndo: false
|
|
561
|
+
});
|
|
563
562
|
constructor() {
|
|
564
563
|
super([]);
|
|
565
|
-
this.state = vue.reactive({
|
|
566
|
-
pageSteps: {},
|
|
567
|
-
pageId: void 0,
|
|
568
|
-
canRedo: false,
|
|
569
|
-
canUndo: false
|
|
570
|
-
});
|
|
571
564
|
this.on("change", this.setCanUndoRedo);
|
|
572
565
|
}
|
|
573
566
|
reset() {
|
|
@@ -636,88 +629,88 @@
|
|
|
636
629
|
this.state.canUndo = undoRedo?.canUndo() || false;
|
|
637
630
|
}
|
|
638
631
|
}
|
|
639
|
-
|
|
632
|
+
const historyService = new History();
|
|
640
633
|
|
|
641
|
-
|
|
634
|
+
var Protocol = /* @__PURE__ */ ((Protocol2) => {
|
|
635
|
+
Protocol2["OBJECT"] = "object";
|
|
636
|
+
Protocol2["JSON"] = "json";
|
|
637
|
+
Protocol2["STRING"] = "string";
|
|
638
|
+
Protocol2["NUMBER"] = "number";
|
|
639
|
+
Protocol2["BOOLEAN"] = "boolean";
|
|
640
|
+
return Protocol2;
|
|
641
|
+
})(Protocol || {});
|
|
642
|
+
class WebStorage extends BaseService {
|
|
643
|
+
storage = globalThis.localStorage;
|
|
644
|
+
namespace = "tmagic";
|
|
642
645
|
constructor() {
|
|
643
|
-
super(["
|
|
644
|
-
this.state = vue.reactive({
|
|
645
|
-
propsConfigMap: {},
|
|
646
|
-
propsValueMap: {}
|
|
647
|
-
});
|
|
646
|
+
super(["getStorage", "getNamespace", "clear", "getItem", "removeItem", "setItem"]);
|
|
648
647
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
this.setPropsConfig(utils.toLine(type), configs[type]);
|
|
652
|
-
});
|
|
653
|
-
this.emit("props-configs-change");
|
|
648
|
+
async getStorage() {
|
|
649
|
+
return this.storage;
|
|
654
650
|
}
|
|
655
|
-
|
|
656
|
-
this.
|
|
651
|
+
async getNamespace() {
|
|
652
|
+
return this.namespace;
|
|
657
653
|
}
|
|
658
|
-
async
|
|
659
|
-
|
|
660
|
-
|
|
654
|
+
async clear() {
|
|
655
|
+
const storage2 = await this.getStorage();
|
|
656
|
+
storage2.clear();
|
|
657
|
+
}
|
|
658
|
+
async getItem(key, options = {}) {
|
|
659
|
+
const [storage, namespace] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
660
|
+
const { protocol = options.protocol, item } = this.getValueAndProtocol(storage.getItem(`${options.namespace || namespace}:${key}`));
|
|
661
|
+
if (item === null)
|
|
662
|
+
return null;
|
|
663
|
+
switch (protocol) {
|
|
664
|
+
case "object" /* OBJECT */:
|
|
665
|
+
return eval(`(${item})`);
|
|
666
|
+
case "json" /* JSON */:
|
|
667
|
+
return JSON.parse(item);
|
|
668
|
+
case "number" /* NUMBER */:
|
|
669
|
+
return Number(item);
|
|
670
|
+
case "boolean" /* BOOLEAN */:
|
|
671
|
+
return Boolean(item);
|
|
672
|
+
default:
|
|
673
|
+
return item;
|
|
661
674
|
}
|
|
662
|
-
return lodashEs.cloneDeep(this.state.propsConfigMap[type] || DEFAULT_CONFIG);
|
|
663
675
|
}
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
});
|
|
676
|
+
async key(index) {
|
|
677
|
+
const storage2 = await this.getStorage();
|
|
678
|
+
return storage2.key(index);
|
|
668
679
|
}
|
|
669
|
-
|
|
670
|
-
|
|
680
|
+
async removeItem(key2, options2 = {}) {
|
|
681
|
+
const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
682
|
+
storage2.removeItem(`${options2.namespace || namespace2}:${key2}`);
|
|
671
683
|
}
|
|
672
|
-
async
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
}
|
|
680
|
-
return value;
|
|
684
|
+
async setItem(key2, value, options2 = {}) {
|
|
685
|
+
const [storage2, namespace2] = await Promise.all([this.getStorage(), this.getNamespace()]);
|
|
686
|
+
let item2 = value;
|
|
687
|
+
const protocol2 = options2.protocol ? `${options2.protocol}:` : "";
|
|
688
|
+
if (typeof value === "string" /* STRING */ || typeof value === "number" /* NUMBER */) {
|
|
689
|
+
item2 = `${protocol2}${value}`;
|
|
690
|
+
} else {
|
|
691
|
+
item2 = `${protocol2}${serialize__default.default(value)}`;
|
|
681
692
|
}
|
|
682
|
-
|
|
683
|
-
|
|
693
|
+
storage2.setItem(`${options2.namespace || namespace2}:${key2}`, item2);
|
|
694
|
+
}
|
|
695
|
+
getValueAndProtocol(value) {
|
|
696
|
+
let protocol2 = "";
|
|
697
|
+
if (value === null) {
|
|
698
|
+
return {
|
|
699
|
+
item: value,
|
|
700
|
+
protocol: protocol2
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
const item2 = value.replace(new RegExp(`^(${Object.values(Protocol).join("|")})(:)(.+)`), (_$0, $1, _$2, $3) => {
|
|
704
|
+
protocol2 = $1;
|
|
705
|
+
return $3;
|
|
706
|
+
});
|
|
684
707
|
return {
|
|
685
|
-
|
|
686
|
-
|
|
708
|
+
protocol: protocol2,
|
|
709
|
+
item: item2
|
|
687
710
|
};
|
|
688
711
|
}
|
|
689
|
-
async createId(type) {
|
|
690
|
-
return `${type}_${lodashEs.random(1e4, false)}`;
|
|
691
|
-
}
|
|
692
|
-
async setNewItemId(config, parent) {
|
|
693
|
-
const oldId = config.id;
|
|
694
|
-
config.id = await this.createId(config.type || "component");
|
|
695
|
-
if (utils.isPop(config) && parent?.type === schema.NodeType.PAGE) {
|
|
696
|
-
updatePopId(oldId, config.id, parent);
|
|
697
|
-
}
|
|
698
|
-
if (config.items && Array.isArray(config.items)) {
|
|
699
|
-
for (const item of config.items) {
|
|
700
|
-
await this.setNewItemId(item, config);
|
|
701
|
-
}
|
|
702
|
-
}
|
|
703
|
-
}
|
|
704
712
|
}
|
|
705
|
-
const
|
|
706
|
-
pageConfig.items?.forEach((config) => {
|
|
707
|
-
if (config.pop === oldId) {
|
|
708
|
-
config.pop = popId;
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
711
|
-
if (config.popId === oldId) {
|
|
712
|
-
config.popId = popId;
|
|
713
|
-
return;
|
|
714
|
-
}
|
|
715
|
-
if (Array.isArray(config.items)) {
|
|
716
|
-
updatePopId(oldId, popId, config);
|
|
717
|
-
}
|
|
718
|
-
});
|
|
719
|
-
};
|
|
720
|
-
var propsService = new Props();
|
|
713
|
+
const storageService = new WebStorage();
|
|
721
714
|
|
|
722
715
|
var LayerOffset = /* @__PURE__ */ ((LayerOffset2) => {
|
|
723
716
|
LayerOffset2["TOP"] = "top";
|
|
@@ -881,7 +874,266 @@
|
|
|
881
874
|
return config.style.left;
|
|
882
875
|
};
|
|
883
876
|
|
|
877
|
+
class Props extends BaseService {
|
|
878
|
+
state = vue.reactive({
|
|
879
|
+
propsConfigMap: {},
|
|
880
|
+
propsValueMap: {}
|
|
881
|
+
});
|
|
882
|
+
constructor() {
|
|
883
|
+
super([
|
|
884
|
+
"setPropsConfig",
|
|
885
|
+
"getPropsConfig",
|
|
886
|
+
"setPropsValue",
|
|
887
|
+
"getPropsValue",
|
|
888
|
+
"createId",
|
|
889
|
+
"setNewItemId",
|
|
890
|
+
"getDefaultPropsValue"
|
|
891
|
+
]);
|
|
892
|
+
}
|
|
893
|
+
setPropsConfigs(configs) {
|
|
894
|
+
Object.keys(configs).forEach((type) => {
|
|
895
|
+
this.setPropsConfig(utils.toLine(type), configs[type]);
|
|
896
|
+
});
|
|
897
|
+
this.emit("props-configs-change");
|
|
898
|
+
}
|
|
899
|
+
setPropsConfig(type, config) {
|
|
900
|
+
this.state.propsConfigMap[type] = fillConfig(Array.isArray(config) ? config : [config]);
|
|
901
|
+
}
|
|
902
|
+
async getPropsConfig(type) {
|
|
903
|
+
if (type === "area") {
|
|
904
|
+
return await this.getPropsConfig("button");
|
|
905
|
+
}
|
|
906
|
+
return lodashEs.cloneDeep(this.state.propsConfigMap[type] || DEFAULT_CONFIG);
|
|
907
|
+
}
|
|
908
|
+
setPropsValues(values) {
|
|
909
|
+
Object.keys(values).forEach((type) => {
|
|
910
|
+
this.setPropsValue(utils.toLine(type), values[type]);
|
|
911
|
+
});
|
|
912
|
+
}
|
|
913
|
+
setPropsValue(type, value) {
|
|
914
|
+
this.state.propsValueMap[type] = value;
|
|
915
|
+
}
|
|
916
|
+
async getPropsValue(type, { inputEvent, ...defaultValue } = {}) {
|
|
917
|
+
if (type === "area") {
|
|
918
|
+
const value = await this.getPropsValue("button");
|
|
919
|
+
value.className = "action-area";
|
|
920
|
+
value.text = "";
|
|
921
|
+
if (value.style) {
|
|
922
|
+
value.style.backgroundColor = "rgba(255, 255, 255, 0)";
|
|
923
|
+
}
|
|
924
|
+
return value;
|
|
925
|
+
}
|
|
926
|
+
const [id, defaultPropsValue, data] = await Promise.all([
|
|
927
|
+
this.createId(type),
|
|
928
|
+
this.getDefaultPropsValue(type),
|
|
929
|
+
this.setNewItemId(lodashEs.cloneDeep({
|
|
930
|
+
type,
|
|
931
|
+
...defaultValue
|
|
932
|
+
}))
|
|
933
|
+
]);
|
|
934
|
+
return {
|
|
935
|
+
id,
|
|
936
|
+
...defaultPropsValue,
|
|
937
|
+
...lodashEs.mergeWith({}, lodashEs.cloneDeep(this.state.propsValueMap[type] || {}), data)
|
|
938
|
+
};
|
|
939
|
+
}
|
|
940
|
+
guid(digit = 8) {
|
|
941
|
+
return "x".repeat(digit).replace(/[xy]/g, (c) => {
|
|
942
|
+
const r = Math.random() * 16 | 0;
|
|
943
|
+
const v = c == "x" ? r : r & 3 | 8;
|
|
944
|
+
return v.toString(16);
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
async createId(type) {
|
|
948
|
+
return `${type}_${this.guid()}`;
|
|
949
|
+
}
|
|
950
|
+
async setNewItemId(config, parent) {
|
|
951
|
+
const oldId = config.id;
|
|
952
|
+
config.id = await this.createId(config.type || "component");
|
|
953
|
+
if (utils.isPop(config) && parent?.type === schema.NodeType.PAGE) {
|
|
954
|
+
updatePopId(oldId, config.id, parent);
|
|
955
|
+
}
|
|
956
|
+
if (config.items && Array.isArray(config.items)) {
|
|
957
|
+
for (const item of config.items) {
|
|
958
|
+
await this.setNewItemId(item, config);
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
return config;
|
|
962
|
+
}
|
|
963
|
+
async getDefaultPropsValue(type) {
|
|
964
|
+
return ["page", "container"].includes(type) ? {
|
|
965
|
+
type,
|
|
966
|
+
layout: "absolute",
|
|
967
|
+
style: {},
|
|
968
|
+
name: type,
|
|
969
|
+
items: []
|
|
970
|
+
} : {
|
|
971
|
+
type,
|
|
972
|
+
style: {},
|
|
973
|
+
name: type
|
|
974
|
+
};
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
const updatePopId = (oldId, popId, pageConfig) => {
|
|
978
|
+
pageConfig.items?.forEach((config) => {
|
|
979
|
+
if (config.pop === oldId) {
|
|
980
|
+
config.pop = popId;
|
|
981
|
+
return;
|
|
982
|
+
}
|
|
983
|
+
if (config.popId === oldId) {
|
|
984
|
+
config.popId = popId;
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
if (Array.isArray(config.items)) {
|
|
988
|
+
updatePopId(oldId, popId, config);
|
|
989
|
+
}
|
|
990
|
+
});
|
|
991
|
+
};
|
|
992
|
+
const propsService = new Props();
|
|
993
|
+
|
|
994
|
+
const beforePaste = async (position, config) => {
|
|
995
|
+
if (!config[0]?.style)
|
|
996
|
+
return config;
|
|
997
|
+
const curNode = editorService.get("node");
|
|
998
|
+
const { left: referenceLeft, top: referenceTop } = config[0].style;
|
|
999
|
+
const pasteConfigs = await Promise.all(config.map(async (configItem) => {
|
|
1000
|
+
const { offsetX = 0, offsetY = 0, ...positionClone } = position;
|
|
1001
|
+
let pastePosition = positionClone;
|
|
1002
|
+
if (!lodashEs.isEmpty(pastePosition) && curNode.items) {
|
|
1003
|
+
pastePosition = getPositionInContainer(pastePosition, curNode.id);
|
|
1004
|
+
}
|
|
1005
|
+
if (pastePosition.left && configItem.style?.left) {
|
|
1006
|
+
pastePosition.left = configItem.style.left - referenceLeft + pastePosition.left;
|
|
1007
|
+
}
|
|
1008
|
+
if (pastePosition.top && configItem.style?.top) {
|
|
1009
|
+
pastePosition.top = configItem.style?.top - referenceTop + pastePosition.top;
|
|
1010
|
+
}
|
|
1011
|
+
const pasteConfig = await propsService.setNewItemId(configItem, editorService.get("root"));
|
|
1012
|
+
if (pasteConfig.style) {
|
|
1013
|
+
const { left, top } = pasteConfig.style;
|
|
1014
|
+
if (typeof left === "number" || !!left && !isNaN(Number(left))) {
|
|
1015
|
+
pasteConfig.style.left = Number(left) + offsetX;
|
|
1016
|
+
}
|
|
1017
|
+
if (typeof top === "number" || !!top && !isNaN(Number(top))) {
|
|
1018
|
+
pasteConfig.style.top = Number(top) + offsetY;
|
|
1019
|
+
}
|
|
1020
|
+
pasteConfig.style = {
|
|
1021
|
+
...pasteConfig.style,
|
|
1022
|
+
...pastePosition
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
if (utils.isPage(pasteConfig)) {
|
|
1026
|
+
pasteConfig.name = generatePageNameByApp(editorService.get("root"));
|
|
1027
|
+
}
|
|
1028
|
+
return pasteConfig;
|
|
1029
|
+
}));
|
|
1030
|
+
return pasteConfigs;
|
|
1031
|
+
};
|
|
1032
|
+
const beforeAdd = async (addNode, parent) => {
|
|
1033
|
+
const { type, inputEvent, ...config } = addNode;
|
|
1034
|
+
const curNode = editorService.get("node");
|
|
1035
|
+
let parentNode;
|
|
1036
|
+
const isPage2 = type === schema.NodeType.PAGE;
|
|
1037
|
+
if (isPage2) {
|
|
1038
|
+
parentNode = editorService.get("root");
|
|
1039
|
+
} else if (parent && typeof parent !== "function") {
|
|
1040
|
+
parentNode = parent;
|
|
1041
|
+
} else if (curNode.items) {
|
|
1042
|
+
parentNode = curNode;
|
|
1043
|
+
} else {
|
|
1044
|
+
parentNode = editorService.getParentById(curNode.id, false);
|
|
1045
|
+
}
|
|
1046
|
+
if (!parentNode)
|
|
1047
|
+
throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
|
|
1048
|
+
const layout = await editorService.getLayout(vue.toRaw(parentNode), addNode);
|
|
1049
|
+
const newNode = { ...vue.toRaw(await propsService.getPropsValue(type, config)) };
|
|
1050
|
+
newNode.style = getInitPositionStyle(newNode.style, layout, parentNode, editorService.get("stage"));
|
|
1051
|
+
if ((parentNode?.type === schema.NodeType.ROOT || curNode.type === schema.NodeType.ROOT) && newNode.type !== schema.NodeType.PAGE) {
|
|
1052
|
+
throw new Error("app\u4E0B\u4E0D\u80FD\u6DFB\u52A0\u7EC4\u4EF6");
|
|
1053
|
+
}
|
|
1054
|
+
parentNode?.items?.push(newNode);
|
|
1055
|
+
return {
|
|
1056
|
+
parentNode,
|
|
1057
|
+
newNode,
|
|
1058
|
+
layout,
|
|
1059
|
+
isPage: isPage2
|
|
1060
|
+
};
|
|
1061
|
+
};
|
|
1062
|
+
const getPositionInContainer = (position = {}, id) => {
|
|
1063
|
+
let { left = 0, top = 0 } = position;
|
|
1064
|
+
const parentEl = editorService.get("stage")?.renderer?.contentWindow?.document.getElementById(`${id}`);
|
|
1065
|
+
const parentElRect = parentEl?.getBoundingClientRect();
|
|
1066
|
+
left = left - (parentElRect?.left || 0);
|
|
1067
|
+
top = top - (parentElRect?.top || 0);
|
|
1068
|
+
return {
|
|
1069
|
+
left,
|
|
1070
|
+
top
|
|
1071
|
+
};
|
|
1072
|
+
};
|
|
1073
|
+
const notifyAddToStage = async (parentNode, newNode, layout) => {
|
|
1074
|
+
const stage = editorService.get("stage");
|
|
1075
|
+
const root = editorService.get("root");
|
|
1076
|
+
await stage?.add({ config: lodashEs.cloneDeep(newNode), parent: lodashEs.cloneDeep(parentNode), root: lodashEs.cloneDeep(root) });
|
|
1077
|
+
if (layout === Layout.ABSOLUTE) {
|
|
1078
|
+
const fixedLeft = fixNodeLeft(newNode, parentNode, stage?.renderer.contentWindow?.document);
|
|
1079
|
+
if (typeof fixedLeft !== "undefined" && newNode.style) {
|
|
1080
|
+
newNode.style.left = fixedLeft;
|
|
1081
|
+
await stage?.update({ config: lodashEs.cloneDeep(newNode), root: lodashEs.cloneDeep(root) });
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
};
|
|
1085
|
+
const beforeRemove = async (node) => {
|
|
1086
|
+
if (!node?.id)
|
|
1087
|
+
return;
|
|
1088
|
+
const stage = editorService.get("stage");
|
|
1089
|
+
const root = editorService.get("root");
|
|
1090
|
+
if (!root)
|
|
1091
|
+
throw new Error("\u6CA1\u6709root");
|
|
1092
|
+
const { parent, node: curNode } = editorService.getNodeInfo(node.id, false);
|
|
1093
|
+
if (!parent || !curNode)
|
|
1094
|
+
throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
|
|
1095
|
+
const index = getNodeIndex(curNode, parent);
|
|
1096
|
+
if (typeof index !== "number" || index === -1)
|
|
1097
|
+
throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
|
|
1098
|
+
parent.items?.splice(index, 1);
|
|
1099
|
+
stage?.remove({ id: node.id, root: lodashEs.cloneDeep(root) });
|
|
1100
|
+
if (node.type === schema.NodeType.PAGE) {
|
|
1101
|
+
editorService.state.pageLength -= 1;
|
|
1102
|
+
if (root.items[0]) {
|
|
1103
|
+
await editorService.select(root.items[0]);
|
|
1104
|
+
stage?.select(root.items[0].id);
|
|
1105
|
+
} else {
|
|
1106
|
+
editorService.set("node", null);
|
|
1107
|
+
editorService.set("nodes", []);
|
|
1108
|
+
editorService.set("parent", null);
|
|
1109
|
+
editorService.set("page", null);
|
|
1110
|
+
editorService.set("stage", null);
|
|
1111
|
+
editorService.set("highlightNode", null);
|
|
1112
|
+
editorService.resetModifiedNodeId();
|
|
1113
|
+
historyService.reset();
|
|
1114
|
+
editorService.emit("remove", node);
|
|
1115
|
+
return;
|
|
1116
|
+
}
|
|
1117
|
+
} else {
|
|
1118
|
+
await editorService.select(parent);
|
|
1119
|
+
stage?.select(parent.id);
|
|
1120
|
+
}
|
|
1121
|
+
return parent;
|
|
1122
|
+
};
|
|
1123
|
+
|
|
884
1124
|
class Editor$1 extends BaseService {
|
|
1125
|
+
state = vue.reactive({
|
|
1126
|
+
root: null,
|
|
1127
|
+
page: null,
|
|
1128
|
+
parent: null,
|
|
1129
|
+
node: null,
|
|
1130
|
+
nodes: [],
|
|
1131
|
+
stage: null,
|
|
1132
|
+
highlightNode: null,
|
|
1133
|
+
modifiedNodeIds: /* @__PURE__ */ new Map(),
|
|
1134
|
+
pageLength: 0
|
|
1135
|
+
});
|
|
1136
|
+
isHistoryStateChange = false;
|
|
885
1137
|
constructor() {
|
|
886
1138
|
super([
|
|
887
1139
|
"getLayout",
|
|
@@ -900,20 +1152,12 @@
|
|
|
900
1152
|
"redo",
|
|
901
1153
|
"highlight"
|
|
902
1154
|
], ["select", "update", "moveLayer"]);
|
|
903
|
-
this.isHistoryStateChange = false;
|
|
904
|
-
this.state = vue.reactive({
|
|
905
|
-
root: null,
|
|
906
|
-
page: null,
|
|
907
|
-
parent: null,
|
|
908
|
-
node: null,
|
|
909
|
-
stage: null,
|
|
910
|
-
highlightNode: null,
|
|
911
|
-
modifiedNodeIds: /* @__PURE__ */ new Map(),
|
|
912
|
-
pageLength: 0
|
|
913
|
-
});
|
|
914
1155
|
}
|
|
915
1156
|
set(name, value) {
|
|
916
1157
|
this.state[name] = value;
|
|
1158
|
+
if (name === "nodes") {
|
|
1159
|
+
this.set("node", value[0]);
|
|
1160
|
+
}
|
|
917
1161
|
if (name === "root") {
|
|
918
1162
|
this.state.pageLength = value?.items?.length || 0;
|
|
919
1163
|
this.emit("root-change", value);
|
|
@@ -968,9 +1212,9 @@
|
|
|
968
1212
|
}
|
|
969
1213
|
return Layout.ABSOLUTE;
|
|
970
1214
|
}
|
|
971
|
-
async select(
|
|
972
|
-
const { node, page, parent } = this.selectedConfigExceptionHandler(
|
|
973
|
-
this.set("
|
|
1215
|
+
async select(config) {
|
|
1216
|
+
const { node, page, parent } = this.selectedConfigExceptionHandler(config);
|
|
1217
|
+
this.set("nodes", [node]);
|
|
974
1218
|
this.set("page", page || null);
|
|
975
1219
|
this.set("parent", parent || null);
|
|
976
1220
|
if (page) {
|
|
@@ -1010,106 +1254,87 @@
|
|
|
1010
1254
|
this.get("stage")?.select(nextPage.id);
|
|
1011
1255
|
return nextPage;
|
|
1012
1256
|
}
|
|
1013
|
-
highlight(
|
|
1014
|
-
const { node } = this.selectedConfigExceptionHandler(
|
|
1257
|
+
highlight(config) {
|
|
1258
|
+
const { node } = this.selectedConfigExceptionHandler(config);
|
|
1015
1259
|
const currentHighlightNode = this.get("highlightNode");
|
|
1016
1260
|
if (currentHighlightNode === node)
|
|
1017
1261
|
return;
|
|
1018
1262
|
this.set("highlightNode", node);
|
|
1019
1263
|
}
|
|
1264
|
+
multiSelect(ids) {
|
|
1265
|
+
const nodes = [];
|
|
1266
|
+
const idsUnique = lodashEs.uniq(ids);
|
|
1267
|
+
idsUnique.forEach((id) => {
|
|
1268
|
+
const { node } = this.getNodeInfo(id);
|
|
1269
|
+
if (!node)
|
|
1270
|
+
return;
|
|
1271
|
+
nodes.push(node);
|
|
1272
|
+
});
|
|
1273
|
+
this.set("nodes", nodes);
|
|
1274
|
+
}
|
|
1275
|
+
async multiAdd(configs) {
|
|
1276
|
+
const stage = this.get("stage");
|
|
1277
|
+
const newNodes = await Promise.all(configs.map(async (configItem) => {
|
|
1278
|
+
const { parentNode, newNode, layout } = await beforeAdd(configItem);
|
|
1279
|
+
await notifyAddToStage(parentNode, newNode, layout);
|
|
1280
|
+
return newNode;
|
|
1281
|
+
}));
|
|
1282
|
+
const newNodeIds = newNodes.map((node) => node.id);
|
|
1283
|
+
this.addModifiedNodeId(newNodeIds.join("-"));
|
|
1284
|
+
this.pushHistoryState();
|
|
1285
|
+
stage?.multiSelect(newNodeIds);
|
|
1286
|
+
this.emit("multiAdd", newNodes);
|
|
1287
|
+
return newNodes;
|
|
1288
|
+
}
|
|
1020
1289
|
async add(addNode, parent) {
|
|
1021
|
-
const { type, ...config2 } = addNode;
|
|
1022
|
-
const curNode = this.get("node");
|
|
1023
|
-
let parentNode;
|
|
1024
|
-
const isPage2 = type === schema.NodeType.PAGE;
|
|
1025
|
-
if (isPage2) {
|
|
1026
|
-
parentNode = this.get("root");
|
|
1027
|
-
} else if (parent && typeof parent !== "function") {
|
|
1028
|
-
parentNode = parent;
|
|
1029
|
-
} else if (curNode.items) {
|
|
1030
|
-
parentNode = curNode;
|
|
1031
|
-
} else {
|
|
1032
|
-
parentNode = this.getParentById(curNode.id, false);
|
|
1033
|
-
}
|
|
1034
|
-
if (!parentNode)
|
|
1035
|
-
throw new Error("\u672A\u627E\u5230\u7236\u5143\u7D20");
|
|
1036
|
-
const layout = await this.getLayout(vue.toRaw(parentNode), addNode);
|
|
1037
|
-
const newNode = { ...vue.toRaw(await propsService.getPropsValue(type, config2)) };
|
|
1038
|
-
newNode.style = getInitPositionStyle(newNode.style, layout, parentNode, this.get("stage"));
|
|
1039
|
-
if ((parentNode?.type === schema.NodeType.ROOT || curNode.type === schema.NodeType.ROOT) && newNode.type !== schema.NodeType.PAGE) {
|
|
1040
|
-
throw new Error("app\u4E0B\u4E0D\u80FD\u6DFB\u52A0\u7EC4\u4EF6");
|
|
1041
|
-
}
|
|
1042
|
-
parentNode?.items?.push(newNode);
|
|
1043
1290
|
const stage = this.get("stage");
|
|
1044
|
-
const
|
|
1045
|
-
await
|
|
1046
|
-
if (layout === Layout.ABSOLUTE) {
|
|
1047
|
-
const fixedLeft = fixNodeLeft(newNode, parentNode, stage?.renderer.contentWindow?.document);
|
|
1048
|
-
if (typeof fixedLeft !== "undefined") {
|
|
1049
|
-
newNode.style.left = fixedLeft;
|
|
1050
|
-
await stage?.update({ config: lodashEs.cloneDeep(newNode), root: lodashEs.cloneDeep(root) });
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1291
|
+
const { parentNode, newNode, layout, isPage: isPage2 } = await beforeAdd(addNode, parent);
|
|
1292
|
+
await notifyAddToStage(parentNode, newNode, layout);
|
|
1053
1293
|
await this.select(newNode);
|
|
1054
1294
|
this.addModifiedNodeId(newNode.id);
|
|
1055
1295
|
if (!isPage2) {
|
|
1056
1296
|
this.pushHistoryState();
|
|
1057
1297
|
}
|
|
1058
|
-
stage?.select(newNode.id);
|
|
1059
1298
|
if (isPage2) {
|
|
1060
1299
|
this.state.pageLength += 1;
|
|
1300
|
+
} else {
|
|
1301
|
+
stage?.select(newNode.id);
|
|
1061
1302
|
}
|
|
1062
1303
|
this.emit("add", newNode);
|
|
1063
1304
|
return newNode;
|
|
1064
1305
|
}
|
|
1065
|
-
async remove(
|
|
1066
|
-
if (
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
if (!root)
|
|
1070
|
-
throw new Error("\u6CA1\u6709root");
|
|
1071
|
-
const { parent, node: curNode } = this.getNodeInfo(node.id, false);
|
|
1072
|
-
if (!parent || !curNode)
|
|
1073
|
-
throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
|
|
1074
|
-
const index = getNodeIndex(curNode, parent);
|
|
1075
|
-
if (typeof index !== "number" || index === -1)
|
|
1076
|
-
throw new Error("\u627E\u4E0D\u8981\u5220\u9664\u7684\u8282\u70B9");
|
|
1077
|
-
parent.items?.splice(index, 1);
|
|
1078
|
-
const stage = this.get("stage");
|
|
1079
|
-
stage?.remove({ id: node.id, root: lodashEs.cloneDeep(this.get("root")) });
|
|
1080
|
-
if (node.type === schema.NodeType.PAGE) {
|
|
1081
|
-
this.state.pageLength -= 1;
|
|
1082
|
-
if (root.items[0]) {
|
|
1083
|
-
await this.select(root.items[0]);
|
|
1084
|
-
stage?.select(root.items[0].id);
|
|
1085
|
-
} else {
|
|
1086
|
-
this.set("node", null);
|
|
1087
|
-
this.set("parent", null);
|
|
1088
|
-
this.set("page", null);
|
|
1089
|
-
this.set("stage", null);
|
|
1090
|
-
this.set("highlightNode", null);
|
|
1091
|
-
this.resetModifiedNodeId();
|
|
1092
|
-
historyService.reset();
|
|
1093
|
-
this.emit("remove", node);
|
|
1094
|
-
return node;
|
|
1095
|
-
}
|
|
1096
|
-
} else {
|
|
1097
|
-
await this.select(parent);
|
|
1098
|
-
stage?.select(parent.id);
|
|
1306
|
+
async remove(nodeOrNodeList) {
|
|
1307
|
+
if (Array.isArray(nodeOrNodeList)) {
|
|
1308
|
+
const nodes = nodeOrNodeList;
|
|
1309
|
+
return this.multiRemove(nodes);
|
|
1099
1310
|
}
|
|
1100
|
-
|
|
1311
|
+
const node = nodeOrNodeList;
|
|
1312
|
+
const removeParent = await beforeRemove(node);
|
|
1313
|
+
if (!removeParent)
|
|
1314
|
+
return node;
|
|
1315
|
+
this.addModifiedNodeId(removeParent.id);
|
|
1101
1316
|
this.pushHistoryState();
|
|
1102
1317
|
this.emit("remove", node);
|
|
1103
1318
|
return node;
|
|
1104
1319
|
}
|
|
1105
|
-
async
|
|
1106
|
-
|
|
1320
|
+
async multiRemove(nodes) {
|
|
1321
|
+
await Promise.all(nodes.map(async (removeNode) => {
|
|
1322
|
+
await beforeRemove(removeNode);
|
|
1323
|
+
}));
|
|
1324
|
+
const nodeIds = nodes.map((node) => node.id);
|
|
1325
|
+
this.addModifiedNodeId(nodeIds.join("-"));
|
|
1326
|
+
this.pushHistoryState();
|
|
1327
|
+
this.emit("multiRemove", nodes);
|
|
1328
|
+
return nodes;
|
|
1329
|
+
}
|
|
1330
|
+
async update(config) {
|
|
1331
|
+
if (!config?.id)
|
|
1107
1332
|
throw new Error("\u6CA1\u6709\u914D\u7F6E\u6216\u8005\u914D\u7F6E\u7F3A\u5C11id\u503C");
|
|
1108
|
-
const info = this.getNodeInfo(
|
|
1333
|
+
const info = this.getNodeInfo(config.id, false);
|
|
1109
1334
|
if (!info.node)
|
|
1110
|
-
throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${
|
|
1335
|
+
throw new Error(`\u83B7\u53D6\u4E0D\u5230id\u4E3A${config.id}\u7684\u8282\u70B9`);
|
|
1111
1336
|
const node = lodashEs.cloneDeep(vue.toRaw(info.node));
|
|
1112
|
-
let newConfig = await this.toggleFixedPosition(vue.toRaw(
|
|
1337
|
+
let newConfig = await this.toggleFixedPosition(vue.toRaw(config), node, this.get("root"));
|
|
1113
1338
|
newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), newConfig, (objValue, srcValue) => {
|
|
1114
1339
|
if (Array.isArray(srcValue)) {
|
|
1115
1340
|
return srcValue;
|
|
@@ -1134,9 +1359,10 @@
|
|
|
1134
1359
|
newConfig = setLayout(newConfig, newLayout);
|
|
1135
1360
|
}
|
|
1136
1361
|
parentNodeItems[index] = newConfig;
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1362
|
+
const nodes = this.get("nodes");
|
|
1363
|
+
const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
|
|
1364
|
+
nodes.splice(targetIndex, 1, newConfig);
|
|
1365
|
+
this.set("nodes", nodes);
|
|
1140
1366
|
this.get("stage")?.update({ config: lodashEs.cloneDeep(newConfig), root: lodashEs.cloneDeep(this.get("root")) });
|
|
1141
1367
|
if (newConfig.type === schema.NodeType.PAGE) {
|
|
1142
1368
|
this.set("page", newConfig);
|
|
@@ -1160,34 +1386,19 @@
|
|
|
1160
1386
|
this.addModifiedNodeId(parent.id);
|
|
1161
1387
|
this.pushHistoryState();
|
|
1162
1388
|
}
|
|
1163
|
-
async copy(
|
|
1164
|
-
|
|
1389
|
+
async copy(config) {
|
|
1390
|
+
await storageService.setItem(COPY_STORAGE_KEY, Array.isArray(config) ? config : [config], {
|
|
1391
|
+
protocol: Protocol.OBJECT
|
|
1392
|
+
});
|
|
1165
1393
|
}
|
|
1166
1394
|
async paste(position = {}) {
|
|
1167
|
-
const
|
|
1168
|
-
|
|
1169
|
-
if (!configStr) {
|
|
1395
|
+
const config = await storageService.getItem(COPY_STORAGE_KEY);
|
|
1396
|
+
if (!config)
|
|
1170
1397
|
return;
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
eval(`config = ${configStr}`);
|
|
1174
|
-
} catch (e) {
|
|
1175
|
-
console.error(e);
|
|
1176
|
-
return;
|
|
1177
|
-
}
|
|
1178
|
-
await propsService.setNewItemId(config, this.get("root"));
|
|
1179
|
-
if (config.style) {
|
|
1180
|
-
config.style = {
|
|
1181
|
-
...config.style,
|
|
1182
|
-
...position
|
|
1183
|
-
};
|
|
1184
|
-
}
|
|
1185
|
-
if (utils.isPage(config)) {
|
|
1186
|
-
config.name = generatePageNameByApp(this.get("root"));
|
|
1187
|
-
}
|
|
1188
|
-
return await this.add(config);
|
|
1398
|
+
const pasteConfigs = await beforePaste(position, config);
|
|
1399
|
+
return await this.multiAdd(pasteConfigs);
|
|
1189
1400
|
}
|
|
1190
|
-
async alignCenter(
|
|
1401
|
+
async alignCenter(config) {
|
|
1191
1402
|
const parent = this.get("parent");
|
|
1192
1403
|
const node = this.get("node");
|
|
1193
1404
|
const layout = await this.getLayout(vue.toRaw(parent), vue.toRaw(node));
|
|
@@ -1199,8 +1410,8 @@
|
|
|
1199
1410
|
const stage = this.get("stage");
|
|
1200
1411
|
const doc = stage?.renderer.contentWindow?.document;
|
|
1201
1412
|
if (doc) {
|
|
1202
|
-
const parentEl = doc.getElementById(`${parent.id}`);
|
|
1203
1413
|
const el = doc.getElementById(`${node.id}`);
|
|
1414
|
+
const parentEl = el?.offsetParent;
|
|
1204
1415
|
if (parentEl && el) {
|
|
1205
1416
|
node.style.left = (parentEl.clientWidth - el.clientWidth) / 2;
|
|
1206
1417
|
}
|
|
@@ -1212,9 +1423,9 @@
|
|
|
1212
1423
|
config: lodashEs.cloneDeep(vue.toRaw(node)),
|
|
1213
1424
|
root: lodashEs.cloneDeep(this.get("root"))
|
|
1214
1425
|
});
|
|
1215
|
-
this.addModifiedNodeId(
|
|
1426
|
+
this.addModifiedNodeId(config.id);
|
|
1216
1427
|
this.pushHistoryState();
|
|
1217
|
-
return
|
|
1428
|
+
return config;
|
|
1218
1429
|
}
|
|
1219
1430
|
async moveLayer(offset) {
|
|
1220
1431
|
const parent = this.get("parent");
|
|
@@ -1233,8 +1444,8 @@
|
|
|
1233
1444
|
root: lodashEs.cloneDeep(this.get("root"))
|
|
1234
1445
|
});
|
|
1235
1446
|
}
|
|
1236
|
-
async moveToContainer(
|
|
1237
|
-
const { node, parent } = this.getNodeInfo(
|
|
1447
|
+
async moveToContainer(config, targetId) {
|
|
1448
|
+
const { node, parent } = this.getNodeInfo(config.id, false);
|
|
1238
1449
|
const target = this.getNodeById(targetId, false);
|
|
1239
1450
|
const stage = this.get("stage");
|
|
1240
1451
|
if (node && parent && stage) {
|
|
@@ -1243,7 +1454,7 @@
|
|
|
1243
1454
|
parent.items?.splice(index, 1);
|
|
1244
1455
|
await stage.remove({ id: node.id, root });
|
|
1245
1456
|
const layout = await this.getLayout(target);
|
|
1246
|
-
const newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node),
|
|
1457
|
+
const newConfig = lodashEs.mergeWith(lodashEs.cloneDeep(node), config, (objValue, srcValue) => {
|
|
1247
1458
|
if (Array.isArray(srcValue)) {
|
|
1248
1459
|
return srcValue;
|
|
1249
1460
|
}
|
|
@@ -1294,6 +1505,7 @@
|
|
|
1294
1505
|
this.removeAllListeners();
|
|
1295
1506
|
this.set("root", null);
|
|
1296
1507
|
this.set("node", null);
|
|
1508
|
+
this.set("nodes", []);
|
|
1297
1509
|
this.set("page", null);
|
|
1298
1510
|
this.set("parent", null);
|
|
1299
1511
|
}
|
|
@@ -1340,12 +1552,12 @@
|
|
|
1340
1552
|
}
|
|
1341
1553
|
return newConfig;
|
|
1342
1554
|
}
|
|
1343
|
-
selectedConfigExceptionHandler(
|
|
1555
|
+
selectedConfigExceptionHandler(config) {
|
|
1344
1556
|
let id;
|
|
1345
|
-
if (typeof
|
|
1346
|
-
id =
|
|
1557
|
+
if (typeof config === "string" || typeof config === "number") {
|
|
1558
|
+
id = config;
|
|
1347
1559
|
} else {
|
|
1348
|
-
id =
|
|
1560
|
+
id = config.id;
|
|
1349
1561
|
}
|
|
1350
1562
|
if (!id) {
|
|
1351
1563
|
throw new Error("\u6CA1\u6709ID\uFF0C\u65E0\u6CD5\u9009\u4E2D");
|
|
@@ -1363,7 +1575,7 @@
|
|
|
1363
1575
|
};
|
|
1364
1576
|
}
|
|
1365
1577
|
}
|
|
1366
|
-
|
|
1578
|
+
const editorService = new Editor$1();
|
|
1367
1579
|
|
|
1368
1580
|
const eventMap = vue.reactive({});
|
|
1369
1581
|
const methodMap = vue.reactive({});
|
|
@@ -1407,7 +1619,7 @@
|
|
|
1407
1619
|
return lodashEs.cloneDeep(methodMap[type] || core.DEFAULT_METHODS);
|
|
1408
1620
|
}
|
|
1409
1621
|
}
|
|
1410
|
-
|
|
1622
|
+
const eventsService = new Events();
|
|
1411
1623
|
|
|
1412
1624
|
const fillConfig = (config = []) => [
|
|
1413
1625
|
{
|
|
@@ -1613,29 +1825,31 @@
|
|
|
1613
1825
|
}
|
|
1614
1826
|
];
|
|
1615
1827
|
const DEFAULT_CONFIG = fillConfig([]);
|
|
1616
|
-
const getDefaultPropsValue = (type, id) => ["page", "container"].includes(type) ? {
|
|
1617
|
-
type,
|
|
1618
|
-
id,
|
|
1619
|
-
layout: "absolute",
|
|
1620
|
-
style: {},
|
|
1621
|
-
name: type,
|
|
1622
|
-
items: []
|
|
1623
|
-
} : {
|
|
1624
|
-
type,
|
|
1625
|
-
id,
|
|
1626
|
-
style: {},
|
|
1627
|
-
name: type
|
|
1628
|
-
};
|
|
1629
1828
|
|
|
1630
1829
|
const log = (...args) => {
|
|
1830
|
+
if (process.env.NODE_ENV === "development") {
|
|
1831
|
+
console.log("magic editor: ", ...args);
|
|
1832
|
+
}
|
|
1631
1833
|
};
|
|
1632
1834
|
const info = (...args) => {
|
|
1835
|
+
if (process.env.NODE_ENV === "development") {
|
|
1836
|
+
console.info("magic editor: ", ...args);
|
|
1837
|
+
}
|
|
1633
1838
|
};
|
|
1634
1839
|
const warn = (...args) => {
|
|
1840
|
+
if (process.env.NODE_ENV === "development") {
|
|
1841
|
+
console.warn("magic editor: ", ...args);
|
|
1842
|
+
}
|
|
1635
1843
|
};
|
|
1636
1844
|
const debug = (...args) => {
|
|
1845
|
+
if (process.env.NODE_ENV === "development") {
|
|
1846
|
+
console.debug("magic editor: ", ...args);
|
|
1847
|
+
}
|
|
1637
1848
|
};
|
|
1638
1849
|
const error = (...args) => {
|
|
1850
|
+
if (process.env.NODE_ENV === "development") {
|
|
1851
|
+
console.error("magic editor: ", ...args);
|
|
1852
|
+
}
|
|
1639
1853
|
};
|
|
1640
1854
|
|
|
1641
1855
|
const _sfc_main$i = vue.defineComponent({
|
|
@@ -1655,10 +1869,11 @@
|
|
|
1655
1869
|
};
|
|
1656
1870
|
}
|
|
1657
1871
|
});
|
|
1872
|
+
|
|
1658
1873
|
const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
1659
1874
|
const _hoisted_2$4 = { class: "m-editor-empty-content" };
|
|
1660
1875
|
const _hoisted_3$2 = /* @__PURE__ */ vue.createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
1661
|
-
function _sfc_render$
|
|
1876
|
+
function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1662
1877
|
const _component_plus = vue.resolveComponent("plus");
|
|
1663
1878
|
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
1664
1879
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
|
|
@@ -1680,7 +1895,7 @@
|
|
|
1680
1895
|
])
|
|
1681
1896
|
]);
|
|
1682
1897
|
}
|
|
1683
|
-
|
|
1898
|
+
const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$i, [["render", _sfc_render$d]]);
|
|
1684
1899
|
|
|
1685
1900
|
const _sfc_main$h = vue.defineComponent({
|
|
1686
1901
|
name: "m-editor-resize",
|
|
@@ -1696,7 +1911,7 @@
|
|
|
1696
1911
|
vue.onMounted(() => {
|
|
1697
1912
|
if (!target.value)
|
|
1698
1913
|
return;
|
|
1699
|
-
getso = new Gesto__default
|
|
1914
|
+
getso = new Gesto__default.default(target.value, {
|
|
1700
1915
|
container: window,
|
|
1701
1916
|
pinchOutside: true
|
|
1702
1917
|
}).on("drag", (e) => {
|
|
@@ -1724,16 +1939,17 @@
|
|
|
1724
1939
|
};
|
|
1725
1940
|
}
|
|
1726
1941
|
});
|
|
1942
|
+
|
|
1727
1943
|
const _hoisted_1$a = {
|
|
1728
1944
|
ref: "target",
|
|
1729
1945
|
class: "m-editor-resizer"
|
|
1730
1946
|
};
|
|
1731
|
-
function _sfc_render$
|
|
1947
|
+
function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1732
1948
|
return vue.openBlock(), vue.createElementBlock("span", _hoisted_1$a, [
|
|
1733
1949
|
vue.renderSlot(_ctx.$slots, "default")
|
|
1734
1950
|
], 512);
|
|
1735
1951
|
}
|
|
1736
|
-
|
|
1952
|
+
const Resizer = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["render", _sfc_render$c]]);
|
|
1737
1953
|
|
|
1738
1954
|
const _sfc_main$g = vue.defineComponent({
|
|
1739
1955
|
components: {
|
|
@@ -1764,12 +1980,13 @@
|
|
|
1764
1980
|
};
|
|
1765
1981
|
}
|
|
1766
1982
|
});
|
|
1983
|
+
|
|
1767
1984
|
const _hoisted_1$9 = { class: "m-editor" };
|
|
1768
1985
|
const _hoisted_2$3 = {
|
|
1769
1986
|
key: 1,
|
|
1770
1987
|
class: "m-editor-content"
|
|
1771
1988
|
};
|
|
1772
|
-
function _sfc_render$
|
|
1989
|
+
function _sfc_render$b(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1773
1990
|
const _component_magic_code_editor = vue.resolveComponent("magic-code-editor");
|
|
1774
1991
|
const _component_resizer = vue.resolveComponent("resizer");
|
|
1775
1992
|
const _component_el_scrollbar = vue.resolveComponent("el-scrollbar");
|
|
@@ -1815,7 +2032,7 @@
|
|
|
1815
2032
|
]))
|
|
1816
2033
|
]);
|
|
1817
2034
|
}
|
|
1818
|
-
|
|
2035
|
+
const Framework = /* @__PURE__ */ _export_sfc(_sfc_main$g, [["render", _sfc_render$b]]);
|
|
1819
2036
|
|
|
1820
2037
|
const _sfc_main$f = vue.defineComponent({
|
|
1821
2038
|
name: "m-icon",
|
|
@@ -1831,8 +2048,9 @@
|
|
|
1831
2048
|
};
|
|
1832
2049
|
}
|
|
1833
2050
|
});
|
|
2051
|
+
|
|
1834
2052
|
const _hoisted_1$8 = ["src"];
|
|
1835
|
-
function _sfc_render$
|
|
2053
|
+
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1836
2054
|
const _component_edit = vue.resolveComponent("edit");
|
|
1837
2055
|
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
1838
2056
|
return !_ctx.icon ? (vue.openBlock(), vue.createBlock(_component_el_icon, { key: 0 }, {
|
|
@@ -1853,10 +2071,19 @@
|
|
|
1853
2071
|
_: 1
|
|
1854
2072
|
}));
|
|
1855
2073
|
}
|
|
1856
|
-
|
|
2074
|
+
const MIcon = /* @__PURE__ */ _export_sfc(_sfc_main$f, [["render", _sfc_render$a]]);
|
|
1857
2075
|
|
|
1858
|
-
const
|
|
1859
|
-
|
|
2076
|
+
const _hoisted_1$7 = {
|
|
2077
|
+
key: 1,
|
|
2078
|
+
class: "menu-item-text"
|
|
2079
|
+
};
|
|
2080
|
+
const _hoisted_2$2 = {
|
|
2081
|
+
class: "menu-item-text",
|
|
2082
|
+
style: { "margin": "0 5px" }
|
|
2083
|
+
};
|
|
2084
|
+
const _hoisted_3$1 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2085
|
+
const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
|
|
2086
|
+
__name: "ToolButton",
|
|
1860
2087
|
props: {
|
|
1861
2088
|
data: {
|
|
1862
2089
|
type: [Object, String],
|
|
@@ -1871,7 +2098,8 @@
|
|
|
1871
2098
|
default: "click"
|
|
1872
2099
|
}
|
|
1873
2100
|
},
|
|
1874
|
-
setup(
|
|
2101
|
+
setup(__props) {
|
|
2102
|
+
const props = __props;
|
|
1875
2103
|
const services = vue.inject("services");
|
|
1876
2104
|
const uiService = services?.uiService;
|
|
1877
2105
|
const zoom = vue.computed(() => uiService?.get("zoom") ?? 1);
|
|
@@ -1968,176 +2196,155 @@
|
|
|
1968
2196
|
item2.handler?.(services, event);
|
|
1969
2197
|
}
|
|
1970
2198
|
};
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
item
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
|
|
1979
|
-
|
|
1980
|
-
|
|
1981
|
-
|
|
1982
|
-
|
|
1983
|
-
|
|
1984
|
-
}
|
|
1985
|
-
return item.value.display ?? true;
|
|
1986
|
-
}),
|
|
1987
|
-
zoomInHandler,
|
|
1988
|
-
zoomOutHandler,
|
|
1989
|
-
dropdownHandler(command) {
|
|
1990
|
-
if (command.item.handler) {
|
|
1991
|
-
command.item.handler(services);
|
|
1992
|
-
}
|
|
1993
|
-
},
|
|
1994
|
-
clickHandler(item2, event) {
|
|
1995
|
-
if (props.eventType !== "click")
|
|
1996
|
-
return;
|
|
1997
|
-
if (item2.type === "button") {
|
|
1998
|
-
buttonHandler(item2, event);
|
|
1999
|
-
}
|
|
2000
|
-
},
|
|
2001
|
-
mousedownHandler(item2, event) {
|
|
2002
|
-
if (props.eventType !== "mousedown")
|
|
2003
|
-
return;
|
|
2004
|
-
if (item2.type === "button") {
|
|
2005
|
-
buttonHandler(item2, event);
|
|
2006
|
-
}
|
|
2007
|
-
},
|
|
2008
|
-
mouseupHandler(item2, event) {
|
|
2009
|
-
if (props.eventType !== "mouseup")
|
|
2010
|
-
return;
|
|
2011
|
-
if (item2.type === "button") {
|
|
2012
|
-
buttonHandler(item2, event);
|
|
2013
|
-
}
|
|
2199
|
+
const display = vue.computed(() => {
|
|
2200
|
+
if (!item.value)
|
|
2201
|
+
return false;
|
|
2202
|
+
if (typeof item.value === "string")
|
|
2203
|
+
return true;
|
|
2204
|
+
if (typeof item.value.display === "function") {
|
|
2205
|
+
return item.value.display(services);
|
|
2206
|
+
}
|
|
2207
|
+
return item.value.display ?? true;
|
|
2208
|
+
});
|
|
2209
|
+
const dropdownHandler = (command) => {
|
|
2210
|
+
if (command.item.handler) {
|
|
2211
|
+
command.item.handler(services);
|
|
2014
2212
|
}
|
|
2015
2213
|
};
|
|
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
|
-
|
|
2047
|
-
direction: _ctx.item.direction || "vertical"
|
|
2048
|
-
}, null, 8, ["direction"])) : _ctx.item.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, vue.toDisplayString(_ctx.item.text), 1)) : _ctx.item.type === "zoom" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
2049
|
-
vue.createVNode(_component_tool_button, {
|
|
2050
|
-
data: { type: "button", icon: _ctx.ZoomOut, handler: _ctx.zoomOutHandler, tooltip: "\u7F29\u5C0F" },
|
|
2051
|
-
"event-type": _ctx.eventType
|
|
2052
|
-
}, null, 8, ["data", "event-type"]),
|
|
2053
|
-
vue.createElementVNode("span", _hoisted_2$2, vue.toDisplayString(parseInt(`${_ctx.zoom * 100}`, 10)) + "%", 1),
|
|
2054
|
-
vue.createVNode(_component_tool_button, {
|
|
2055
|
-
data: { type: "button", icon: _ctx.ZoomIn, handler: _ctx.zoomInHandler, tooltip: "\u653E\u5927" },
|
|
2056
|
-
"event-type": _ctx.eventType
|
|
2057
|
-
}, null, 8, ["data", "event-type"])
|
|
2058
|
-
], 64)) : _ctx.item.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
|
|
2059
|
-
_ctx.item.tooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
|
|
2214
|
+
const clickHandler = (item2, event) => {
|
|
2215
|
+
if (props.eventType !== "click")
|
|
2216
|
+
return;
|
|
2217
|
+
if (item2.type === "button") {
|
|
2218
|
+
buttonHandler(item2, event);
|
|
2219
|
+
}
|
|
2220
|
+
};
|
|
2221
|
+
const mousedownHandler = (item2, event) => {
|
|
2222
|
+
if (props.eventType !== "mousedown")
|
|
2223
|
+
return;
|
|
2224
|
+
if (item2.type === "button") {
|
|
2225
|
+
buttonHandler(item2, event);
|
|
2226
|
+
}
|
|
2227
|
+
};
|
|
2228
|
+
const mouseupHandler = (item2, event) => {
|
|
2229
|
+
if (props.eventType !== "mouseup")
|
|
2230
|
+
return;
|
|
2231
|
+
if (item2.type === "button") {
|
|
2232
|
+
buttonHandler(item2, event);
|
|
2233
|
+
}
|
|
2234
|
+
};
|
|
2235
|
+
return (_ctx, _cache) => {
|
|
2236
|
+
const _component_el_divider = vue.resolveComponent("el-divider");
|
|
2237
|
+
const _component_tool_button = vue.resolveComponent("tool-button", true);
|
|
2238
|
+
const _component_el_button = vue.resolveComponent("el-button");
|
|
2239
|
+
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
2240
|
+
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
2241
|
+
const _component_el_dropdown_item = vue.resolveComponent("el-dropdown-item");
|
|
2242
|
+
const _component_el_dropdown_menu = vue.resolveComponent("el-dropdown-menu");
|
|
2243
|
+
const _component_el_dropdown = vue.resolveComponent("el-dropdown");
|
|
2244
|
+
return vue.unref(display) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
2060
2245
|
key: 0,
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2246
|
+
class: vue.normalizeClass(["menu-item", vue.unref(item).type]),
|
|
2247
|
+
onClick: _cache[0] || (_cache[0] = ($event) => clickHandler(vue.unref(item), $event)),
|
|
2248
|
+
onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(vue.unref(item), $event)),
|
|
2249
|
+
onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(vue.unref(item), $event))
|
|
2250
|
+
}, [
|
|
2251
|
+
vue.unref(item).type === "divider" ? (vue.openBlock(), vue.createBlock(_component_el_divider, {
|
|
2252
|
+
key: 0,
|
|
2253
|
+
direction: vue.unref(item).direction || "vertical"
|
|
2254
|
+
}, null, 8, ["direction"])) : vue.unref(item).type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$7, vue.toDisplayString(vue.unref(item).text), 1)) : vue.unref(item).type === "zoom" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
2255
|
+
vue.createVNode(_component_tool_button, {
|
|
2256
|
+
data: { type: "button", icon: vue.unref(iconsVue.ZoomOut), handler: zoomOutHandler, tooltip: "\u7F29\u5C0F" },
|
|
2257
|
+
"event-type": __props.eventType
|
|
2258
|
+
}, null, 8, ["data", "event-type"]),
|
|
2259
|
+
vue.createElementVNode("span", _hoisted_2$2, vue.toDisplayString(parseInt(`${vue.unref(zoom) * 100}`, 10)) + "%", 1),
|
|
2260
|
+
vue.createVNode(_component_tool_button, {
|
|
2261
|
+
data: { type: "button", icon: vue.unref(iconsVue.ZoomIn), handler: zoomInHandler, tooltip: "\u653E\u5927" },
|
|
2262
|
+
"event-type": __props.eventType
|
|
2263
|
+
}, null, 8, ["data", "event-type"])
|
|
2264
|
+
], 64)) : vue.unref(item).type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 3 }, [
|
|
2265
|
+
vue.unref(item).tooltip ? (vue.openBlock(), vue.createBlock(_component_el_tooltip, {
|
|
2266
|
+
key: 0,
|
|
2267
|
+
effect: "dark",
|
|
2268
|
+
placement: "bottom-start",
|
|
2269
|
+
content: vue.unref(item).tooltip
|
|
2270
|
+
}, {
|
|
2271
|
+
default: vue.withCtx(() => [
|
|
2272
|
+
vue.createVNode(_component_el_button, {
|
|
2273
|
+
size: "small",
|
|
2274
|
+
text: "",
|
|
2275
|
+
disabled: vue.unref(disabled)
|
|
2276
|
+
}, {
|
|
2277
|
+
default: vue.withCtx(() => [
|
|
2278
|
+
vue.unref(item).icon ? (vue.openBlock(), vue.createBlock(MIcon, {
|
|
2279
|
+
key: 0,
|
|
2280
|
+
icon: vue.unref(item).icon
|
|
2281
|
+
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
2282
|
+
vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(item).text), 1)
|
|
2283
|
+
]),
|
|
2284
|
+
_: 1
|
|
2285
|
+
}, 8, ["disabled"])
|
|
2286
|
+
]),
|
|
2287
|
+
_: 1
|
|
2288
|
+
}, 8, ["content"])) : (vue.openBlock(), vue.createBlock(_component_el_button, {
|
|
2289
|
+
key: 1,
|
|
2067
2290
|
size: "small",
|
|
2068
2291
|
text: "",
|
|
2069
|
-
disabled:
|
|
2292
|
+
disabled: vue.unref(disabled)
|
|
2070
2293
|
}, {
|
|
2071
2294
|
default: vue.withCtx(() => [
|
|
2072
|
-
|
|
2295
|
+
vue.unref(item).icon ? (vue.openBlock(), vue.createBlock(MIcon, {
|
|
2073
2296
|
key: 0,
|
|
2074
|
-
icon:
|
|
2297
|
+
icon: vue.unref(item).icon
|
|
2075
2298
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
2076
|
-
vue.createElementVNode("span", null, vue.toDisplayString(
|
|
2299
|
+
vue.createElementVNode("span", null, vue.toDisplayString(vue.unref(item).text), 1)
|
|
2077
2300
|
]),
|
|
2078
2301
|
_: 1
|
|
2079
|
-
}, 8, ["disabled"])
|
|
2080
|
-
]),
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
_ctx.item.items && _ctx.item.items.length ? (vue.openBlock(), vue.createBlock(_component_el_dropdown_menu, { key: 0 }, {
|
|
2302
|
+
}, 8, ["disabled"]))
|
|
2303
|
+
], 64)) : vue.unref(item).type === "dropdown" ? (vue.openBlock(), vue.createBlock(_component_el_dropdown, {
|
|
2304
|
+
key: 4,
|
|
2305
|
+
trigger: "click",
|
|
2306
|
+
disabled: vue.unref(disabled),
|
|
2307
|
+
onCommand: dropdownHandler
|
|
2308
|
+
}, {
|
|
2309
|
+
dropdown: vue.withCtx(() => [
|
|
2310
|
+
vue.unref(item).items && vue.unref(item).items.length ? (vue.openBlock(), vue.createBlock(_component_el_dropdown_menu, { key: 0 }, {
|
|
2311
|
+
default: vue.withCtx(() => [
|
|
2312
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(item).items, (subItem, index) => {
|
|
2313
|
+
return vue.openBlock(), vue.createBlock(_component_el_dropdown_item, {
|
|
2314
|
+
key: index,
|
|
2315
|
+
command: { item: vue.unref(item), subItem }
|
|
2316
|
+
}, {
|
|
2317
|
+
default: vue.withCtx(() => [
|
|
2318
|
+
vue.createTextVNode(vue.toDisplayString(subItem.text), 1)
|
|
2319
|
+
]),
|
|
2320
|
+
_: 2
|
|
2321
|
+
}, 1032, ["command"]);
|
|
2322
|
+
}), 128))
|
|
2323
|
+
]),
|
|
2324
|
+
_: 1
|
|
2325
|
+
})) : vue.createCommentVNode("", true)
|
|
2326
|
+
]),
|
|
2105
2327
|
default: vue.withCtx(() => [
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
command: { item: _ctx.item, subItem }
|
|
2110
|
-
}, {
|
|
2328
|
+
vue.createElementVNode("span", _hoisted_3$1, [
|
|
2329
|
+
vue.createTextVNode(vue.toDisplayString(vue.unref(item).text), 1),
|
|
2330
|
+
vue.createVNode(_component_el_icon, { class: "el-icon--right" }, {
|
|
2111
2331
|
default: vue.withCtx(() => [
|
|
2112
|
-
vue.
|
|
2332
|
+
vue.createVNode(vue.unref(iconsVue.ArrowDown))
|
|
2113
2333
|
]),
|
|
2114
|
-
_:
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2334
|
+
_: 1
|
|
2335
|
+
})
|
|
2336
|
+
])
|
|
2117
2337
|
]),
|
|
2118
2338
|
_: 1
|
|
2119
|
-
})) : vue.createCommentVNode("", true)
|
|
2120
|
-
]),
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
vue.createVNode(_component_el_icon, { class: "el-icon--right" }, {
|
|
2125
|
-
default: vue.withCtx(() => [
|
|
2126
|
-
vue.createVNode(_component_arrow_down)
|
|
2127
|
-
]),
|
|
2128
|
-
_: 1
|
|
2129
|
-
})
|
|
2130
|
-
])
|
|
2131
|
-
]),
|
|
2132
|
-
_: 1
|
|
2133
|
-
}, 8, ["disabled", "onCommand"])) : _ctx.item.type === "component" ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(_ctx.item.component), vue.normalizeProps(vue.mergeProps({ key: 5 }, _ctx.item.props || {})), null, 16)) : vue.createCommentVNode("", true)
|
|
2134
|
-
], 34)) : vue.createCommentVNode("", true);
|
|
2135
|
-
}
|
|
2136
|
-
var ToolButton = /* @__PURE__ */ _export_sfc(_sfc_main$e, [["render", _sfc_render$e]]);
|
|
2339
|
+
}, 8, ["disabled"])) : vue.unref(item).type === "component" ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(vue.unref(item).component), vue.normalizeProps(vue.mergeProps({ key: 5 }, vue.unref(item).props || {})), null, 16)) : vue.createCommentVNode("", true)
|
|
2340
|
+
], 34)) : vue.createCommentVNode("", true);
|
|
2341
|
+
};
|
|
2342
|
+
}
|
|
2343
|
+
});
|
|
2137
2344
|
|
|
2138
2345
|
const _sfc_main$d = vue.defineComponent({
|
|
2139
2346
|
name: "nav-menu",
|
|
2140
|
-
components: { ToolButton },
|
|
2347
|
+
components: { ToolButton: _sfc_main$e },
|
|
2141
2348
|
props: {
|
|
2142
2349
|
data: {
|
|
2143
2350
|
type: Object,
|
|
@@ -2155,7 +2362,8 @@
|
|
|
2155
2362
|
};
|
|
2156
2363
|
}
|
|
2157
2364
|
});
|
|
2158
|
-
|
|
2365
|
+
|
|
2366
|
+
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2159
2367
|
const _component_tool_button = vue.resolveComponent("tool-button");
|
|
2160
2368
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
2161
2369
|
class: "m-editor-nav-menu",
|
|
@@ -2177,7 +2385,7 @@
|
|
|
2177
2385
|
}), 128))
|
|
2178
2386
|
], 4);
|
|
2179
2387
|
}
|
|
2180
|
-
|
|
2388
|
+
const NavMenu = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render$9]]);
|
|
2181
2389
|
|
|
2182
2390
|
const _sfc_main$c = vue.defineComponent({
|
|
2183
2391
|
name: "m-editor-props-panel",
|
|
@@ -2226,8 +2434,9 @@
|
|
|
2226
2434
|
};
|
|
2227
2435
|
}
|
|
2228
2436
|
});
|
|
2437
|
+
|
|
2229
2438
|
const _hoisted_1$6 = { class: "`m-editor-props-panel" };
|
|
2230
|
-
function _sfc_render$
|
|
2439
|
+
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2231
2440
|
const _component_m_form = vue.resolveComponent("m-form");
|
|
2232
2441
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [
|
|
2233
2442
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
@@ -2242,7 +2451,7 @@
|
|
|
2242
2451
|
}, null, 8, ["class", "popper-class", "size", "init-values", "config", "onChange"])
|
|
2243
2452
|
]);
|
|
2244
2453
|
}
|
|
2245
|
-
|
|
2454
|
+
const PropsPanel = /* @__PURE__ */ _export_sfc(_sfc_main$c, [["render", _sfc_render$8]]);
|
|
2246
2455
|
|
|
2247
2456
|
const _sfc_main$b = vue.defineComponent({
|
|
2248
2457
|
name: "ui-component-panel",
|
|
@@ -2274,7 +2483,7 @@
|
|
|
2274
2483
|
dragstartHandler({ text, type, data = {} }, e) {
|
|
2275
2484
|
if (e.dataTransfer) {
|
|
2276
2485
|
e.dataTransfer.effectAllowed = "move";
|
|
2277
|
-
e.dataTransfer.setData("data", serialize__default
|
|
2486
|
+
e.dataTransfer.setData("data", serialize__default.default({
|
|
2278
2487
|
name: text,
|
|
2279
2488
|
type,
|
|
2280
2489
|
...data
|
|
@@ -2310,9 +2519,10 @@
|
|
|
2310
2519
|
};
|
|
2311
2520
|
}
|
|
2312
2521
|
});
|
|
2522
|
+
|
|
2313
2523
|
const _hoisted_1$5 = /* @__PURE__ */ vue.createElementVNode("i", { class: "el-icon-s-grid" }, null, -1);
|
|
2314
2524
|
const _hoisted_2$1 = ["onClick", "onDragstart"];
|
|
2315
|
-
function _sfc_render$
|
|
2525
|
+
function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2316
2526
|
const _component_el_input = vue.resolveComponent("el-input");
|
|
2317
2527
|
const _component_m_icon = vue.resolveComponent("m-icon");
|
|
2318
2528
|
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
@@ -2384,22 +2594,17 @@
|
|
|
2384
2594
|
_: 3
|
|
2385
2595
|
});
|
|
2386
2596
|
}
|
|
2387
|
-
|
|
2597
|
+
const ComponentListPanel = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$7]]);
|
|
2388
2598
|
|
|
2389
|
-
const _sfc_main$a = vue.defineComponent({
|
|
2390
|
-
|
|
2599
|
+
const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
2600
|
+
__name: "ContentMenu",
|
|
2391
2601
|
props: {
|
|
2392
|
-
menuData: {
|
|
2393
|
-
|
|
2394
|
-
default: () => []
|
|
2395
|
-
},
|
|
2396
|
-
isSubMenu: {
|
|
2397
|
-
type: Boolean,
|
|
2398
|
-
default: false
|
|
2399
|
-
}
|
|
2602
|
+
menuData: { default: () => [] },
|
|
2603
|
+
isSubMenu: { type: Boolean, default: false }
|
|
2400
2604
|
},
|
|
2401
2605
|
emits: ["hide", "show"],
|
|
2402
|
-
setup(
|
|
2606
|
+
setup(__props, { expose, emit }) {
|
|
2607
|
+
const props = __props;
|
|
2403
2608
|
const menu = vue.ref();
|
|
2404
2609
|
const subMenu = vue.ref();
|
|
2405
2610
|
const visible = vue.ref(false);
|
|
@@ -2425,6 +2630,36 @@
|
|
|
2425
2630
|
}
|
|
2426
2631
|
hide();
|
|
2427
2632
|
};
|
|
2633
|
+
const show = (e) => {
|
|
2634
|
+
setTimeout(() => {
|
|
2635
|
+
visible.value = true;
|
|
2636
|
+
vue.nextTick(() => {
|
|
2637
|
+
const menuHeight = menu.value?.clientHeight || 0;
|
|
2638
|
+
let top = e.clientY;
|
|
2639
|
+
if (menuHeight + e.clientY > document.body.clientHeight) {
|
|
2640
|
+
top = document.body.clientHeight - menuHeight;
|
|
2641
|
+
}
|
|
2642
|
+
menuStyle.value = {
|
|
2643
|
+
top: `${top}px`,
|
|
2644
|
+
left: `${e.clientX}px`
|
|
2645
|
+
};
|
|
2646
|
+
emit("show");
|
|
2647
|
+
});
|
|
2648
|
+
}, 300);
|
|
2649
|
+
};
|
|
2650
|
+
const showSubMenu = (item) => {
|
|
2651
|
+
const menuItem = item;
|
|
2652
|
+
if (typeof item !== "object" || !menuItem.items?.length) {
|
|
2653
|
+
return;
|
|
2654
|
+
}
|
|
2655
|
+
subMenuData.value = menuItem.items;
|
|
2656
|
+
if (menu.value) {
|
|
2657
|
+
subMenu.value.show({
|
|
2658
|
+
clientX: menu.value.offsetLeft + menu.value.clientWidth,
|
|
2659
|
+
clientY: menu.value.offsetTop
|
|
2660
|
+
});
|
|
2661
|
+
}
|
|
2662
|
+
};
|
|
2428
2663
|
vue.onMounted(() => {
|
|
2429
2664
|
if (props.isSubMenu)
|
|
2430
2665
|
return;
|
|
@@ -2435,81 +2670,47 @@
|
|
|
2435
2670
|
return;
|
|
2436
2671
|
globalThis.removeEventListener("mousedown", hideHandler, true);
|
|
2437
2672
|
});
|
|
2438
|
-
|
|
2439
|
-
menu,
|
|
2440
|
-
subMenu,
|
|
2441
|
-
visible,
|
|
2442
|
-
menuStyle,
|
|
2443
|
-
subMenuData,
|
|
2673
|
+
expose({
|
|
2444
2674
|
hide,
|
|
2445
|
-
show
|
|
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
|
-
|
|
2474
|
-
|
|
2675
|
+
show
|
|
2676
|
+
});
|
|
2677
|
+
return (_ctx, _cache) => {
|
|
2678
|
+
const _component_content_menu = vue.resolveComponent("content-menu", true);
|
|
2679
|
+
return __props.menuData.length && visible.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
2680
|
+
key: 0,
|
|
2681
|
+
class: "magic-editor-content-menu",
|
|
2682
|
+
ref_key: "menu",
|
|
2683
|
+
ref: menu,
|
|
2684
|
+
style: vue.normalizeStyle(menuStyle.value)
|
|
2685
|
+
}, [
|
|
2686
|
+
vue.createElementVNode("div", null, [
|
|
2687
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(__props.menuData, (item, index) => {
|
|
2688
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$e, {
|
|
2689
|
+
"event-type": "mouseup",
|
|
2690
|
+
data: item,
|
|
2691
|
+
key: index,
|
|
2692
|
+
onMouseup: hide,
|
|
2693
|
+
onMouseenter: ($event) => showSubMenu(item)
|
|
2694
|
+
}, null, 8, ["data", "onMouseenter"]);
|
|
2695
|
+
}), 128))
|
|
2696
|
+
]),
|
|
2697
|
+
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
2698
|
+
vue.createVNode(_component_content_menu, {
|
|
2699
|
+
class: "sub-menu",
|
|
2700
|
+
ref_key: "subMenu",
|
|
2701
|
+
ref: subMenu,
|
|
2702
|
+
"menu-data": subMenuData.value,
|
|
2703
|
+
"is-sub-menu": true,
|
|
2704
|
+
onHide: hide
|
|
2705
|
+
}, null, 8, ["menu-data"])
|
|
2706
|
+
]))
|
|
2707
|
+
], 4)) : vue.createCommentVNode("", true);
|
|
2475
2708
|
};
|
|
2476
2709
|
}
|
|
2477
2710
|
});
|
|
2478
|
-
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2479
|
-
const _component_tool_button = vue.resolveComponent("tool-button");
|
|
2480
|
-
const _component_content_menu = vue.resolveComponent("content-menu", true);
|
|
2481
|
-
return _ctx.menuData.length && _ctx.visible ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
2482
|
-
key: 0,
|
|
2483
|
-
class: "magic-editor-content-menu",
|
|
2484
|
-
ref: "menu",
|
|
2485
|
-
style: vue.normalizeStyle(_ctx.menuStyle)
|
|
2486
|
-
}, [
|
|
2487
|
-
vue.createElementVNode("div", null, [
|
|
2488
|
-
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.menuData, (item, index) => {
|
|
2489
|
-
return vue.openBlock(), vue.createBlock(_component_tool_button, {
|
|
2490
|
-
"event-type": "mouseup",
|
|
2491
|
-
data: item,
|
|
2492
|
-
key: index,
|
|
2493
|
-
onMouseup: _ctx.hide,
|
|
2494
|
-
onMouseenter: ($event) => _ctx.showSubMenu(item)
|
|
2495
|
-
}, null, 8, ["data", "onMouseup", "onMouseenter"]);
|
|
2496
|
-
}), 128))
|
|
2497
|
-
]),
|
|
2498
|
-
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
2499
|
-
vue.createVNode(_component_content_menu, {
|
|
2500
|
-
class: "sub-menu",
|
|
2501
|
-
ref: "subMenu",
|
|
2502
|
-
"menu-data": _ctx.subMenuData,
|
|
2503
|
-
"is-sub-menu": true,
|
|
2504
|
-
onHide: _ctx.hide
|
|
2505
|
-
}, null, 8, ["menu-data", "onHide"])
|
|
2506
|
-
]))
|
|
2507
|
-
], 4)) : vue.createCommentVNode("", true);
|
|
2508
|
-
}
|
|
2509
|
-
var ContentMenu = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$a]]);
|
|
2510
2711
|
|
|
2511
2712
|
const _sfc_main$9 = vue.defineComponent({
|
|
2512
|
-
components: { ContentMenu },
|
|
2713
|
+
components: { ContentMenu: _sfc_main$a },
|
|
2513
2714
|
setup() {
|
|
2514
2715
|
const services = vue.inject("services");
|
|
2515
2716
|
const menu = vue.ref();
|
|
@@ -2591,7 +2792,8 @@
|
|
|
2591
2792
|
};
|
|
2592
2793
|
}
|
|
2593
2794
|
});
|
|
2594
|
-
|
|
2795
|
+
|
|
2796
|
+
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2595
2797
|
const _component_content_menu = vue.resolveComponent("content-menu");
|
|
2596
2798
|
return vue.openBlock(), vue.createBlock(_component_content_menu, {
|
|
2597
2799
|
"menu-data": _ctx.menuData,
|
|
@@ -2599,7 +2801,7 @@
|
|
|
2599
2801
|
style: { "overflow": "initial" }
|
|
2600
2802
|
}, null, 8, ["menu-data"]);
|
|
2601
2803
|
}
|
|
2602
|
-
|
|
2804
|
+
const LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$6]]);
|
|
2603
2805
|
|
|
2604
2806
|
const throttleTime = 150;
|
|
2605
2807
|
const select = async (data, editorService) => {
|
|
@@ -2633,9 +2835,17 @@
|
|
|
2633
2835
|
return true;
|
|
2634
2836
|
return false;
|
|
2635
2837
|
},
|
|
2636
|
-
handleDragEnd() {
|
|
2838
|
+
async handleDragEnd(e) {
|
|
2637
2839
|
if (!tree.value)
|
|
2638
2840
|
return;
|
|
2841
|
+
const { data: node } = e;
|
|
2842
|
+
const parent = editorService?.getParentById(node.id, false);
|
|
2843
|
+
const layout = await editorService?.getLayout(parent);
|
|
2844
|
+
node.style.position = layout;
|
|
2845
|
+
if (layout === Layout.RELATIVE) {
|
|
2846
|
+
node.style.top = 0;
|
|
2847
|
+
node.style.left = 0;
|
|
2848
|
+
}
|
|
2639
2849
|
const { data } = tree.value;
|
|
2640
2850
|
const [page] = data;
|
|
2641
2851
|
editorService?.update(page);
|
|
@@ -2738,8 +2948,9 @@
|
|
|
2738
2948
|
};
|
|
2739
2949
|
}
|
|
2740
2950
|
});
|
|
2951
|
+
|
|
2741
2952
|
const _hoisted_1$4 = ["id", "onMouseenter"];
|
|
2742
|
-
function _sfc_render$
|
|
2953
|
+
function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2743
2954
|
const _component_el_input = vue.resolveComponent("el-input");
|
|
2744
2955
|
const _component_el_tree = vue.resolveComponent("el-tree");
|
|
2745
2956
|
const _component_layer_menu = vue.resolveComponent("layer-menu");
|
|
@@ -2801,7 +3012,7 @@
|
|
|
2801
3012
|
_: 3
|
|
2802
3013
|
});
|
|
2803
3014
|
}
|
|
2804
|
-
|
|
3015
|
+
const LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$5]]);
|
|
2805
3016
|
|
|
2806
3017
|
const _sfc_main$7 = vue.defineComponent({
|
|
2807
3018
|
components: { MIcon },
|
|
@@ -2840,11 +3051,12 @@
|
|
|
2840
3051
|
};
|
|
2841
3052
|
}
|
|
2842
3053
|
});
|
|
3054
|
+
|
|
2843
3055
|
const _hoisted_1$3 = {
|
|
2844
3056
|
key: 1,
|
|
2845
3057
|
class: "magic-editor-tab-panel-title"
|
|
2846
3058
|
};
|
|
2847
|
-
function _sfc_render$
|
|
3059
|
+
function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2848
3060
|
const _component_m_icon = vue.resolveComponent("m-icon");
|
|
2849
3061
|
const _component_el_tab_pane = vue.resolveComponent("el-tab-pane");
|
|
2850
3062
|
return _ctx.config ? (vue.openBlock(), vue.createBlock(_component_el_tab_pane, {
|
|
@@ -2890,7 +3102,7 @@
|
|
|
2890
3102
|
_: 3
|
|
2891
3103
|
}, 8, ["name"])) : vue.createCommentVNode("", true);
|
|
2892
3104
|
}
|
|
2893
|
-
|
|
3105
|
+
const TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$7, [["render", _sfc_render$4]]);
|
|
2894
3106
|
|
|
2895
3107
|
const _sfc_main$6 = vue.defineComponent({
|
|
2896
3108
|
components: { TabPane },
|
|
@@ -2911,7 +3123,8 @@
|
|
|
2911
3123
|
};
|
|
2912
3124
|
}
|
|
2913
3125
|
});
|
|
2914
|
-
|
|
3126
|
+
|
|
3127
|
+
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2915
3128
|
const _component_tab_pane = vue.resolveComponent("tab-pane");
|
|
2916
3129
|
const _component_el_tabs = vue.resolveComponent("el-tabs");
|
|
2917
3130
|
return _ctx.data.type === "tabs" && _ctx.data.items.length ? (vue.openBlock(), vue.createBlock(_component_el_tabs, {
|
|
@@ -2946,331 +3159,249 @@
|
|
|
2946
3159
|
_: 3
|
|
2947
3160
|
}, 8, ["modelValue"])) : vue.createCommentVNode("", true);
|
|
2948
3161
|
}
|
|
2949
|
-
|
|
3162
|
+
const Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["render", _sfc_render$3]]);
|
|
2950
3163
|
|
|
2951
|
-
const useScroll = (root) => {
|
|
2952
|
-
const pageBar = vue.ref();
|
|
2953
|
-
const itemsContainer = vue.ref();
|
|
2954
|
-
const pageBarWidth = vue.ref(0);
|
|
2955
|
-
const canScroll = vue.ref(false);
|
|
2956
|
-
const itemsContainerWidth = vue.computed(() => pageBarWidth.value - 105);
|
|
2957
|
-
let translateLeft = 0;
|
|
2958
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
2959
|
-
for (const { contentRect } of entries) {
|
|
2960
|
-
const { width } = contentRect;
|
|
2961
|
-
pageBarWidth.value = width || 0;
|
|
2962
|
-
setCanScroll();
|
|
2963
|
-
}
|
|
2964
|
-
});
|
|
2965
|
-
const setCanScroll = () => {
|
|
2966
|
-
if (itemsContainer.value) {
|
|
2967
|
-
canScroll.value = itemsContainer.value.scrollWidth > pageBarWidth.value - 105;
|
|
2968
|
-
}
|
|
2969
|
-
};
|
|
2970
|
-
const scroll = (type) => {
|
|
2971
|
-
if (!itemsContainer.value)
|
|
2972
|
-
return;
|
|
2973
|
-
const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
|
|
2974
|
-
if (type === "left") {
|
|
2975
|
-
translateLeft += 100;
|
|
2976
|
-
if (translateLeft > 0) {
|
|
2977
|
-
translateLeft = 0;
|
|
2978
|
-
}
|
|
2979
|
-
} else if (type === "right") {
|
|
2980
|
-
translateLeft -= 100;
|
|
2981
|
-
if (-translateLeft > maxScrollLeft) {
|
|
2982
|
-
translateLeft = -maxScrollLeft;
|
|
2983
|
-
}
|
|
2984
|
-
} else if (type === "start") {
|
|
2985
|
-
translateLeft = 0;
|
|
2986
|
-
} else if (type === "end") {
|
|
2987
|
-
translateLeft = -maxScrollLeft;
|
|
2988
|
-
}
|
|
2989
|
-
itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
|
|
2990
|
-
};
|
|
2991
|
-
vue.onMounted(() => {
|
|
2992
|
-
pageBar.value && resizeObserver.observe(pageBar.value);
|
|
2993
|
-
});
|
|
2994
|
-
vue.onUnmounted(() => {
|
|
2995
|
-
resizeObserver.disconnect();
|
|
2996
|
-
});
|
|
2997
|
-
vue.watch(() => root.value?.items.length, (length = 0, preLength = 0) => {
|
|
2998
|
-
setTimeout(() => {
|
|
2999
|
-
setCanScroll();
|
|
3000
|
-
if (length < preLength) {
|
|
3001
|
-
scroll("start");
|
|
3002
|
-
} else {
|
|
3003
|
-
scroll("end");
|
|
3004
|
-
}
|
|
3005
|
-
});
|
|
3006
|
-
});
|
|
3007
|
-
return {
|
|
3008
|
-
pageBar,
|
|
3009
|
-
itemsContainer,
|
|
3010
|
-
canScroll,
|
|
3011
|
-
itemsContainerWidth,
|
|
3012
|
-
scroll
|
|
3013
|
-
};
|
|
3014
|
-
};
|
|
3015
|
-
const _sfc_main$5 = vue.defineComponent({
|
|
3016
|
-
components: { ArrowLeftBold: iconsVue.ArrowLeftBold, ArrowRightBold: iconsVue.ArrowRightBold, CaretBottom: iconsVue.CaretBottom, Plus: iconsVue.Plus, ToolButton },
|
|
3017
|
-
setup() {
|
|
3018
|
-
const services = vue.inject("services");
|
|
3019
|
-
const editorService = services?.editorService;
|
|
3020
|
-
const root = vue.computed(() => editorService?.get("root"));
|
|
3021
|
-
return {
|
|
3022
|
-
Delete: vue.markRaw(iconsVue.Delete),
|
|
3023
|
-
DocumentCopy: vue.markRaw(iconsVue.DocumentCopy),
|
|
3024
|
-
...useScroll(root),
|
|
3025
|
-
root,
|
|
3026
|
-
page: vue.computed(() => editorService?.get("page")),
|
|
3027
|
-
switchPage(page) {
|
|
3028
|
-
editorService?.select(page);
|
|
3029
|
-
},
|
|
3030
|
-
addPage() {
|
|
3031
|
-
if (!editorService)
|
|
3032
|
-
return;
|
|
3033
|
-
const pageConfig = {
|
|
3034
|
-
type: schema.NodeType.PAGE,
|
|
3035
|
-
name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
|
|
3036
|
-
};
|
|
3037
|
-
editorService.add(pageConfig);
|
|
3038
|
-
},
|
|
3039
|
-
copy(node) {
|
|
3040
|
-
node && editorService?.copy(node);
|
|
3041
|
-
editorService?.paste({
|
|
3042
|
-
left: 0,
|
|
3043
|
-
top: 0
|
|
3044
|
-
});
|
|
3045
|
-
},
|
|
3046
|
-
remove(node) {
|
|
3047
|
-
editorService?.remove(node);
|
|
3048
|
-
}
|
|
3049
|
-
};
|
|
3050
|
-
}
|
|
3051
|
-
});
|
|
3052
3164
|
const _hoisted_1$2 = {
|
|
3053
3165
|
class: "m-editor-page-bar",
|
|
3054
3166
|
ref: "pageBar"
|
|
3055
3167
|
};
|
|
3056
3168
|
const _hoisted_2 = ["onClick"];
|
|
3057
3169
|
const _hoisted_3 = { class: "m-editor-page-bar-title" };
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
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
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3170
|
+
const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
|
|
3171
|
+
__name: "PageBar",
|
|
3172
|
+
setup(__props) {
|
|
3173
|
+
const useScroll = (root2) => {
|
|
3174
|
+
const pageBar = vue.ref();
|
|
3175
|
+
const itemsContainer = vue.ref();
|
|
3176
|
+
const pageBarWidth = vue.ref(0);
|
|
3177
|
+
const canScroll = vue.ref(false);
|
|
3178
|
+
const itemsContainerWidth = vue.computed(() => pageBarWidth.value - 105);
|
|
3179
|
+
let translateLeft = 0;
|
|
3180
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
3181
|
+
for (const { contentRect } of entries) {
|
|
3182
|
+
const { width } = contentRect;
|
|
3183
|
+
pageBarWidth.value = width || 0;
|
|
3184
|
+
setCanScroll();
|
|
3185
|
+
}
|
|
3186
|
+
});
|
|
3187
|
+
const setCanScroll = () => {
|
|
3188
|
+
if (itemsContainer.value) {
|
|
3189
|
+
canScroll.value = itemsContainer.value.scrollWidth > pageBarWidth.value - 105;
|
|
3190
|
+
}
|
|
3191
|
+
};
|
|
3192
|
+
const scroll = (type) => {
|
|
3193
|
+
if (!itemsContainer.value)
|
|
3194
|
+
return;
|
|
3195
|
+
const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
|
|
3196
|
+
if (type === "left") {
|
|
3197
|
+
translateLeft += 100;
|
|
3198
|
+
if (translateLeft > 0) {
|
|
3199
|
+
translateLeft = 0;
|
|
3200
|
+
}
|
|
3201
|
+
} else if (type === "right") {
|
|
3202
|
+
translateLeft -= 100;
|
|
3203
|
+
if (-translateLeft > maxScrollLeft) {
|
|
3204
|
+
translateLeft = -maxScrollLeft;
|
|
3205
|
+
}
|
|
3206
|
+
} else if (type === "start") {
|
|
3207
|
+
translateLeft = 0;
|
|
3208
|
+
} else if (type === "end") {
|
|
3209
|
+
translateLeft = -maxScrollLeft;
|
|
3210
|
+
}
|
|
3211
|
+
itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
|
|
3212
|
+
};
|
|
3213
|
+
vue.onMounted(() => {
|
|
3214
|
+
pageBar.value && resizeObserver.observe(pageBar.value);
|
|
3215
|
+
});
|
|
3216
|
+
vue.onUnmounted(() => {
|
|
3217
|
+
resizeObserver.disconnect();
|
|
3218
|
+
});
|
|
3219
|
+
vue.watch(() => root2.value?.items.length, (length = 0, preLength = 0) => {
|
|
3220
|
+
setTimeout(() => {
|
|
3221
|
+
setCanScroll();
|
|
3222
|
+
if (length < preLength) {
|
|
3223
|
+
scroll("start");
|
|
3224
|
+
} else {
|
|
3225
|
+
scroll("end");
|
|
3226
|
+
}
|
|
3227
|
+
});
|
|
3228
|
+
});
|
|
3229
|
+
return {
|
|
3230
|
+
pageBar,
|
|
3231
|
+
itemsContainer,
|
|
3232
|
+
canScroll,
|
|
3233
|
+
itemsContainerWidth,
|
|
3234
|
+
scroll
|
|
3235
|
+
};
|
|
3236
|
+
};
|
|
3237
|
+
const services = vue.inject("services");
|
|
3238
|
+
const editorService = services?.editorService;
|
|
3239
|
+
const root = vue.computed(() => editorService?.get("root"));
|
|
3240
|
+
const scrollState = useScroll(root);
|
|
3241
|
+
const page = vue.computed(() => editorService?.get("page"));
|
|
3242
|
+
const switchPage = (page2) => {
|
|
3243
|
+
editorService?.select(page2);
|
|
3244
|
+
};
|
|
3245
|
+
const addPage = () => {
|
|
3246
|
+
if (!editorService)
|
|
3247
|
+
return;
|
|
3248
|
+
const pageConfig = {
|
|
3249
|
+
type: schema.NodeType.PAGE,
|
|
3250
|
+
name: generatePageNameByApp(vue.toRaw(editorService.get("root")))
|
|
3251
|
+
};
|
|
3252
|
+
editorService.add(pageConfig);
|
|
3253
|
+
};
|
|
3254
|
+
const copy = (node) => {
|
|
3255
|
+
node && editorService?.copy(node);
|
|
3256
|
+
editorService?.paste({
|
|
3257
|
+
left: 0,
|
|
3258
|
+
top: 0
|
|
3259
|
+
});
|
|
3260
|
+
};
|
|
3261
|
+
const remove = (node) => {
|
|
3262
|
+
editorService?.remove(node);
|
|
3263
|
+
};
|
|
3264
|
+
return (_ctx, _cache) => {
|
|
3265
|
+
const _component_el_icon = vue.resolveComponent("el-icon");
|
|
3266
|
+
const _component_el_tooltip = vue.resolveComponent("el-tooltip");
|
|
3267
|
+
const _component_el_popover = vue.resolveComponent("el-popover");
|
|
3268
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [
|
|
3269
|
+
vue.createElementVNode("div", {
|
|
3270
|
+
id: "m-editor-page-bar-add-icon",
|
|
3271
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3272
|
+
onClick: addPage
|
|
3103
3273
|
}, [
|
|
3104
|
-
vue.
|
|
3105
|
-
vue.
|
|
3106
|
-
vue.createVNode(
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3274
|
+
vue.createVNode(_component_el_icon, null, {
|
|
3275
|
+
default: vue.withCtx(() => [
|
|
3276
|
+
vue.createVNode(vue.unref(iconsVue.Plus))
|
|
3277
|
+
]),
|
|
3278
|
+
_: 1
|
|
3279
|
+
})
|
|
3280
|
+
]),
|
|
3281
|
+
vue.unref(scrollState).canScroll ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3282
|
+
key: 0,
|
|
3283
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3284
|
+
onClick: _cache[0] || (_cache[0] = ($event) => vue.unref(scrollState).scroll("left"))
|
|
3285
|
+
}, [
|
|
3286
|
+
vue.createVNode(_component_el_icon, null, {
|
|
3287
|
+
default: vue.withCtx(() => [
|
|
3288
|
+
vue.createVNode(vue.unref(iconsVue.ArrowLeftBold))
|
|
3289
|
+
]),
|
|
3290
|
+
_: 1
|
|
3291
|
+
})
|
|
3292
|
+
])) : vue.createCommentVNode("", true),
|
|
3293
|
+
vue.unref(root) ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3294
|
+
key: 1,
|
|
3295
|
+
class: "m-editor-page-bar-items",
|
|
3296
|
+
ref: "itemsContainer",
|
|
3297
|
+
style: vue.normalizeStyle(`width: ${vue.unref(scrollState).itemsContainerWidth}px`)
|
|
3298
|
+
}, [
|
|
3299
|
+
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(root).items, (item) => {
|
|
3300
|
+
return vue.openBlock(), vue.createElementBlock("div", {
|
|
3301
|
+
key: item.key,
|
|
3302
|
+
class: vue.normalizeClass(["m-editor-page-bar-item", { active: vue.unref(page)?.id === item.id }]),
|
|
3303
|
+
onClick: ($event) => switchPage(item)
|
|
3304
|
+
}, [
|
|
3305
|
+
vue.createElementVNode("div", _hoisted_3, [
|
|
3306
|
+
vue.renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
|
|
3307
|
+
vue.createVNode(_component_el_tooltip, {
|
|
3308
|
+
effect: "dark",
|
|
3309
|
+
placement: "top-start",
|
|
3310
|
+
content: item.name
|
|
3311
|
+
}, {
|
|
3312
|
+
default: vue.withCtx(() => [
|
|
3313
|
+
vue.createElementVNode("span", null, vue.toDisplayString(item.name), 1)
|
|
3314
|
+
]),
|
|
3315
|
+
_: 2
|
|
3316
|
+
}, 1032, ["content"])
|
|
3317
|
+
])
|
|
3318
|
+
]),
|
|
3319
|
+
vue.createVNode(_component_el_popover, {
|
|
3320
|
+
"popper-class": "page-bar-popover",
|
|
3321
|
+
placement: "top",
|
|
3322
|
+
width: 160,
|
|
3323
|
+
trigger: "hover"
|
|
3110
3324
|
}, {
|
|
3111
|
-
|
|
3112
|
-
vue.
|
|
3325
|
+
reference: vue.withCtx(() => [
|
|
3326
|
+
vue.createVNode(_component_el_icon, { class: "m-editor-page-bar-menu-icon" }, {
|
|
3327
|
+
default: vue.withCtx(() => [
|
|
3328
|
+
vue.createVNode(vue.unref(iconsVue.CaretBottom))
|
|
3329
|
+
]),
|
|
3330
|
+
_: 1
|
|
3331
|
+
})
|
|
3113
3332
|
]),
|
|
3114
|
-
_: 2
|
|
3115
|
-
}, 1032, ["content"])
|
|
3116
|
-
])
|
|
3117
|
-
]),
|
|
3118
|
-
vue.createVNode(_component_el_popover, {
|
|
3119
|
-
"popper-class": "page-bar-popover",
|
|
3120
|
-
placement: "top",
|
|
3121
|
-
width: 160,
|
|
3122
|
-
trigger: "hover"
|
|
3123
|
-
}, {
|
|
3124
|
-
reference: vue.withCtx(() => [
|
|
3125
|
-
vue.createVNode(_component_el_icon, { class: "m-editor-page-bar-menu-icon" }, {
|
|
3126
3333
|
default: vue.withCtx(() => [
|
|
3127
|
-
vue.
|
|
3334
|
+
vue.createElementVNode("div", null, [
|
|
3335
|
+
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
3336
|
+
vue.createVNode(_sfc_main$e, {
|
|
3337
|
+
data: {
|
|
3338
|
+
type: "button",
|
|
3339
|
+
text: "\u590D\u5236",
|
|
3340
|
+
icon: vue.unref(iconsVue.DocumentCopy),
|
|
3341
|
+
handler: () => copy(item)
|
|
3342
|
+
}
|
|
3343
|
+
}, null, 8, ["data"]),
|
|
3344
|
+
vue.createVNode(_sfc_main$e, {
|
|
3345
|
+
data: {
|
|
3346
|
+
type: "button",
|
|
3347
|
+
text: "\u5220\u9664",
|
|
3348
|
+
icon: vue.unref(iconsVue.Delete),
|
|
3349
|
+
handler: () => remove(item)
|
|
3350
|
+
}
|
|
3351
|
+
}, null, 8, ["data"])
|
|
3352
|
+
])
|
|
3353
|
+
])
|
|
3128
3354
|
]),
|
|
3129
|
-
_:
|
|
3130
|
-
})
|
|
3131
|
-
])
|
|
3355
|
+
_: 2
|
|
3356
|
+
}, 1024)
|
|
3357
|
+
], 10, _hoisted_2);
|
|
3358
|
+
}), 128))
|
|
3359
|
+
], 4)) : vue.createCommentVNode("", true),
|
|
3360
|
+
vue.unref(scrollState).canScroll ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
3361
|
+
key: 2,
|
|
3362
|
+
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3363
|
+
onClick: _cache[1] || (_cache[1] = ($event) => vue.unref(scrollState).scroll("right"))
|
|
3364
|
+
}, [
|
|
3365
|
+
vue.createVNode(_component_el_icon, null, {
|
|
3132
3366
|
default: vue.withCtx(() => [
|
|
3133
|
-
vue.
|
|
3134
|
-
vue.renderSlot(_ctx.$slots, "page-bar-popover", { page: item }, () => [
|
|
3135
|
-
vue.createVNode(_component_tool_button, {
|
|
3136
|
-
data: {
|
|
3137
|
-
type: "button",
|
|
3138
|
-
text: "\u590D\u5236",
|
|
3139
|
-
icon: _ctx.DocumentCopy,
|
|
3140
|
-
handler: () => _ctx.copy(item)
|
|
3141
|
-
}
|
|
3142
|
-
}, null, 8, ["data"]),
|
|
3143
|
-
vue.createVNode(_component_tool_button, {
|
|
3144
|
-
data: {
|
|
3145
|
-
type: "button",
|
|
3146
|
-
text: "\u5220\u9664",
|
|
3147
|
-
icon: _ctx.Delete,
|
|
3148
|
-
handler: () => _ctx.remove(item)
|
|
3149
|
-
}
|
|
3150
|
-
}, null, 8, ["data"])
|
|
3151
|
-
])
|
|
3152
|
-
])
|
|
3367
|
+
vue.createVNode(vue.unref(iconsVue.ArrowRightBold))
|
|
3153
3368
|
]),
|
|
3154
|
-
_:
|
|
3155
|
-
}
|
|
3156
|
-
]
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
3162
|
-
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.scroll("right"))
|
|
3163
|
-
}, [
|
|
3164
|
-
vue.createVNode(_component_el_icon, null, {
|
|
3165
|
-
default: vue.withCtx(() => [
|
|
3166
|
-
vue.createVNode(_component_arrow_right_bold)
|
|
3167
|
-
]),
|
|
3168
|
-
_: 1
|
|
3169
|
-
})
|
|
3170
|
-
])) : vue.createCommentVNode("", true)
|
|
3171
|
-
], 512);
|
|
3172
|
-
}
|
|
3173
|
-
var PageBar = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["render", _sfc_render$5]]);
|
|
3369
|
+
_: 1
|
|
3370
|
+
})
|
|
3371
|
+
])) : vue.createCommentVNode("", true)
|
|
3372
|
+
], 512);
|
|
3373
|
+
};
|
|
3374
|
+
}
|
|
3375
|
+
});
|
|
3174
3376
|
|
|
3175
3377
|
class ScrollViewer$1 {
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
if (targetHeight < height) {
|
|
3196
|
-
this.target._top = 0;
|
|
3197
|
-
}
|
|
3198
|
-
this.scroll();
|
|
3199
|
-
}
|
|
3200
|
-
});
|
|
3201
|
-
this.wheelHandler = (event) => {
|
|
3202
|
-
if (this.targetEnter)
|
|
3203
|
-
return;
|
|
3204
|
-
const { deltaX, deltaY, currentTarget } = event;
|
|
3205
|
-
if (currentTarget !== this.container)
|
|
3206
|
-
return;
|
|
3207
|
-
this.setScrollOffset(deltaX, deltaY);
|
|
3208
|
-
this.scroll();
|
|
3209
|
-
this.scrollLeft = this.target._left;
|
|
3210
|
-
this.scrollTop = this.target._top;
|
|
3211
|
-
};
|
|
3212
|
-
this.mouseEnterHandler = () => {
|
|
3213
|
-
this.enter = true;
|
|
3214
|
-
};
|
|
3215
|
-
this.mouseLeaveHandler = () => {
|
|
3216
|
-
this.enter = false;
|
|
3217
|
-
};
|
|
3218
|
-
this.targetMouseEnterHandler = () => {
|
|
3219
|
-
this.targetEnter = true;
|
|
3220
|
-
};
|
|
3221
|
-
this.targetMouseLeaveHandler = () => {
|
|
3222
|
-
this.targetEnter = false;
|
|
3223
|
-
};
|
|
3224
|
-
this.mousedownHandler = (event) => {
|
|
3225
|
-
if (!this.keydown)
|
|
3226
|
-
return;
|
|
3227
|
-
event.stopImmediatePropagation();
|
|
3228
|
-
event.stopPropagation();
|
|
3229
|
-
this.target.style.cursor = "grabbing";
|
|
3230
|
-
this.x = event.clientX;
|
|
3231
|
-
this.y = event.clientY;
|
|
3232
|
-
document.addEventListener("mousemove", this.mousemoveHandler);
|
|
3233
|
-
document.addEventListener("mouseup", this.mouseupHandler);
|
|
3234
|
-
};
|
|
3235
|
-
this.mouseupHandler = () => {
|
|
3236
|
-
this.x = 0;
|
|
3237
|
-
this.y = 0;
|
|
3238
|
-
this.scrollLeft = this.target._left;
|
|
3239
|
-
this.scrollTop = this.target._top;
|
|
3240
|
-
this.removeHandler();
|
|
3241
|
-
};
|
|
3242
|
-
this.mousemoveHandler = (event) => {
|
|
3243
|
-
event.stopImmediatePropagation();
|
|
3244
|
-
event.stopPropagation();
|
|
3245
|
-
const deltaX = event.clientX - this.x;
|
|
3246
|
-
const deltaY = event.clientY - this.y;
|
|
3247
|
-
this.setScrollOffset(deltaX, deltaY);
|
|
3248
|
-
this.scroll();
|
|
3249
|
-
};
|
|
3250
|
-
this.keydownHandler = (event) => {
|
|
3251
|
-
if (event.code === Keys.ESCAPE && this.enter) {
|
|
3252
|
-
event.preventDefault();
|
|
3253
|
-
event.stopImmediatePropagation();
|
|
3254
|
-
event.stopPropagation();
|
|
3255
|
-
}
|
|
3256
|
-
if (event.code !== Keys.ESCAPE || !this.enter || this.keydown) {
|
|
3257
|
-
return;
|
|
3378
|
+
enter = false;
|
|
3379
|
+
targetEnter = false;
|
|
3380
|
+
keydown = false;
|
|
3381
|
+
container;
|
|
3382
|
+
target;
|
|
3383
|
+
zoom = 1;
|
|
3384
|
+
scrollLeft = 0;
|
|
3385
|
+
scrollTop = 0;
|
|
3386
|
+
x = 0;
|
|
3387
|
+
y = 0;
|
|
3388
|
+
resizeObserver = new ResizeObserver((entries) => {
|
|
3389
|
+
for (const { contentRect } of entries) {
|
|
3390
|
+
const { width, height } = contentRect;
|
|
3391
|
+
const targetRect = this.target.getBoundingClientRect();
|
|
3392
|
+
const targetWidth = targetRect.width * this.zoom;
|
|
3393
|
+
const targetMarginTop = Number(this.target.style.marginTop) || 0;
|
|
3394
|
+
const targetHeight = (targetRect.height + targetMarginTop) * this.zoom;
|
|
3395
|
+
if (targetWidth < width) {
|
|
3396
|
+
this.target._left = 0;
|
|
3258
3397
|
}
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
this.container.addEventListener("mousedown", this.mousedownHandler);
|
|
3262
|
-
};
|
|
3263
|
-
this.keyupHandler = (event) => {
|
|
3264
|
-
if (event.code !== Keys.ESCAPE || !this.keydown) {
|
|
3265
|
-
return;
|
|
3398
|
+
if (targetHeight < height) {
|
|
3399
|
+
this.target._top = 0;
|
|
3266
3400
|
}
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
event.preventDefault();
|
|
3272
|
-
this.removeHandler();
|
|
3273
|
-
};
|
|
3401
|
+
this.scroll();
|
|
3402
|
+
}
|
|
3403
|
+
});
|
|
3404
|
+
constructor(options) {
|
|
3274
3405
|
this.container = options.container;
|
|
3275
3406
|
this.target = options.target;
|
|
3276
3407
|
this.zoom = options.zoom;
|
|
@@ -3306,6 +3437,79 @@
|
|
|
3306
3437
|
document.removeEventListener("mousemove", this.mousemoveHandler);
|
|
3307
3438
|
document.removeEventListener("mouseup", this.mouseupHandler);
|
|
3308
3439
|
}
|
|
3440
|
+
wheelHandler = (event) => {
|
|
3441
|
+
if (this.targetEnter)
|
|
3442
|
+
return;
|
|
3443
|
+
const { deltaX, deltaY, currentTarget } = event;
|
|
3444
|
+
if (currentTarget !== this.container)
|
|
3445
|
+
return;
|
|
3446
|
+
this.setScrollOffset(deltaX, deltaY);
|
|
3447
|
+
this.scroll();
|
|
3448
|
+
this.scrollLeft = this.target._left;
|
|
3449
|
+
this.scrollTop = this.target._top;
|
|
3450
|
+
};
|
|
3451
|
+
mouseEnterHandler = () => {
|
|
3452
|
+
this.enter = true;
|
|
3453
|
+
};
|
|
3454
|
+
mouseLeaveHandler = () => {
|
|
3455
|
+
this.enter = false;
|
|
3456
|
+
};
|
|
3457
|
+
targetMouseEnterHandler = () => {
|
|
3458
|
+
this.targetEnter = true;
|
|
3459
|
+
};
|
|
3460
|
+
targetMouseLeaveHandler = () => {
|
|
3461
|
+
this.targetEnter = false;
|
|
3462
|
+
};
|
|
3463
|
+
mousedownHandler = (event) => {
|
|
3464
|
+
if (!this.keydown)
|
|
3465
|
+
return;
|
|
3466
|
+
event.stopImmediatePropagation();
|
|
3467
|
+
event.stopPropagation();
|
|
3468
|
+
this.target.style.cursor = "grabbing";
|
|
3469
|
+
this.x = event.clientX;
|
|
3470
|
+
this.y = event.clientY;
|
|
3471
|
+
document.addEventListener("mousemove", this.mousemoveHandler);
|
|
3472
|
+
document.addEventListener("mouseup", this.mouseupHandler);
|
|
3473
|
+
};
|
|
3474
|
+
mouseupHandler = () => {
|
|
3475
|
+
this.x = 0;
|
|
3476
|
+
this.y = 0;
|
|
3477
|
+
this.scrollLeft = this.target._left;
|
|
3478
|
+
this.scrollTop = this.target._top;
|
|
3479
|
+
this.removeHandler();
|
|
3480
|
+
};
|
|
3481
|
+
mousemoveHandler = (event) => {
|
|
3482
|
+
event.stopImmediatePropagation();
|
|
3483
|
+
event.stopPropagation();
|
|
3484
|
+
const deltaX = event.clientX - this.x;
|
|
3485
|
+
const deltaY = event.clientY - this.y;
|
|
3486
|
+
this.setScrollOffset(deltaX, deltaY);
|
|
3487
|
+
this.scroll();
|
|
3488
|
+
};
|
|
3489
|
+
keydownHandler = (event) => {
|
|
3490
|
+
if (event.code === Keys.ESCAPE && this.enter) {
|
|
3491
|
+
event.preventDefault();
|
|
3492
|
+
event.stopImmediatePropagation();
|
|
3493
|
+
event.stopPropagation();
|
|
3494
|
+
}
|
|
3495
|
+
if (event.code !== Keys.ESCAPE || !this.enter || this.keydown) {
|
|
3496
|
+
return;
|
|
3497
|
+
}
|
|
3498
|
+
this.keydown = true;
|
|
3499
|
+
this.target.style.cursor = "grab";
|
|
3500
|
+
this.container.addEventListener("mousedown", this.mousedownHandler);
|
|
3501
|
+
};
|
|
3502
|
+
keyupHandler = (event) => {
|
|
3503
|
+
if (event.code !== Keys.ESCAPE || !this.keydown) {
|
|
3504
|
+
return;
|
|
3505
|
+
}
|
|
3506
|
+
event.preventDefault();
|
|
3507
|
+
event.stopImmediatePropagation();
|
|
3508
|
+
event.stopPropagation();
|
|
3509
|
+
this.keydown = false;
|
|
3510
|
+
event.preventDefault();
|
|
3511
|
+
this.removeHandler();
|
|
3512
|
+
};
|
|
3309
3513
|
setScrollOffset(deltaX, deltaY) {
|
|
3310
3514
|
const { width, height } = this.container.getBoundingClientRect();
|
|
3311
3515
|
const targetRect = this.target.getBoundingClientRect();
|
|
@@ -3366,18 +3570,19 @@
|
|
|
3366
3570
|
el,
|
|
3367
3571
|
style: vue.computed(() => `
|
|
3368
3572
|
width: ${props.width}px;
|
|
3369
|
-
height: ${
|
|
3573
|
+
height: ${props.height}px;
|
|
3370
3574
|
position: absolute;
|
|
3371
3575
|
margin-top: 30px;
|
|
3372
3576
|
`)
|
|
3373
3577
|
};
|
|
3374
3578
|
}
|
|
3375
3579
|
});
|
|
3580
|
+
|
|
3376
3581
|
const _hoisted_1$1 = {
|
|
3377
3582
|
class: "m-editor-scroll-viewer-container",
|
|
3378
3583
|
ref: "container"
|
|
3379
3584
|
};
|
|
3380
|
-
function _sfc_render$
|
|
3585
|
+
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3381
3586
|
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$1, [
|
|
3382
3587
|
vue.createElementVNode("div", {
|
|
3383
3588
|
ref: "el",
|
|
@@ -3387,170 +3592,172 @@
|
|
|
3387
3592
|
], 4)
|
|
3388
3593
|
], 512);
|
|
3389
3594
|
}
|
|
3390
|
-
|
|
3595
|
+
const ScrollViewer = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["render", _sfc_render$2]]);
|
|
3391
3596
|
|
|
3392
|
-
const _sfc_main$3 = vue.defineComponent({
|
|
3393
|
-
|
|
3394
|
-
|
|
3597
|
+
const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
|
|
3598
|
+
__name: "ViewerMenu",
|
|
3599
|
+
props: {
|
|
3600
|
+
isMultiSelect: { type: Boolean, default: false }
|
|
3601
|
+
},
|
|
3602
|
+
setup(__props, { expose }) {
|
|
3603
|
+
const props = __props;
|
|
3395
3604
|
const services = vue.inject("services");
|
|
3396
3605
|
const editorService = services?.editorService;
|
|
3397
3606
|
const menu = vue.ref();
|
|
3398
3607
|
const canPaste = vue.ref(false);
|
|
3399
3608
|
const canCenter = vue.ref(false);
|
|
3400
3609
|
const node = vue.computed(() => editorService?.get("node"));
|
|
3610
|
+
const nodes = vue.computed(() => editorService?.get("nodes"));
|
|
3401
3611
|
const parent = vue.computed(() => editorService?.get("parent"));
|
|
3402
|
-
const
|
|
3612
|
+
const stage = vue.computed(() => editorService?.get("stage"));
|
|
3403
3613
|
const stageContentMenu = vue.inject("stageContentMenu", []);
|
|
3404
|
-
vue.
|
|
3405
|
-
|
|
3614
|
+
const menuData = vue.reactive([
|
|
3615
|
+
{
|
|
3616
|
+
type: "button",
|
|
3617
|
+
text: "\u6C34\u5E73\u5C45\u4E2D",
|
|
3618
|
+
display: () => canCenter.value && !props.isMultiSelect,
|
|
3619
|
+
handler: () => {
|
|
3620
|
+
if (!node.value)
|
|
3621
|
+
return;
|
|
3622
|
+
editorService?.alignCenter(node.value);
|
|
3623
|
+
}
|
|
3624
|
+
},
|
|
3625
|
+
{
|
|
3626
|
+
type: "button",
|
|
3627
|
+
text: "\u590D\u5236",
|
|
3628
|
+
icon: vue.markRaw(iconsVue.DocumentCopy),
|
|
3629
|
+
handler: () => {
|
|
3630
|
+
nodes.value && editorService?.copy(nodes.value);
|
|
3631
|
+
canPaste.value = true;
|
|
3632
|
+
}
|
|
3633
|
+
},
|
|
3634
|
+
{
|
|
3635
|
+
type: "button",
|
|
3636
|
+
text: "\u7C98\u8D34",
|
|
3637
|
+
display: () => canPaste.value,
|
|
3638
|
+
handler: () => {
|
|
3639
|
+
const rect = menu.value?.$el.getBoundingClientRect();
|
|
3640
|
+
const parentRect = stage.value?.container?.getBoundingClientRect();
|
|
3641
|
+
const initialLeft = (rect?.left || 0) - (parentRect?.left || 0);
|
|
3642
|
+
const initialTop = (rect?.top || 0) - (parentRect?.top || 0);
|
|
3643
|
+
if (!nodes.value || nodes.value.length === 0)
|
|
3644
|
+
return;
|
|
3645
|
+
editorService?.paste({ left: initialLeft, top: initialTop });
|
|
3646
|
+
}
|
|
3647
|
+
},
|
|
3648
|
+
{
|
|
3649
|
+
type: "divider",
|
|
3650
|
+
direction: "horizontal",
|
|
3651
|
+
display: () => {
|
|
3652
|
+
if (!node.value)
|
|
3653
|
+
return false;
|
|
3654
|
+
return !utils.isPage(node.value);
|
|
3655
|
+
}
|
|
3656
|
+
},
|
|
3657
|
+
{
|
|
3658
|
+
type: "button",
|
|
3659
|
+
text: "\u4E0A\u79FB\u4E00\u5C42",
|
|
3660
|
+
icon: vue.markRaw(iconsVue.Top),
|
|
3661
|
+
display: () => !utils.isPage(node.value) && !props.isMultiSelect,
|
|
3662
|
+
handler: () => {
|
|
3663
|
+
editorService?.moveLayer(1);
|
|
3664
|
+
}
|
|
3665
|
+
},
|
|
3666
|
+
{
|
|
3667
|
+
type: "button",
|
|
3668
|
+
text: "\u4E0B\u79FB\u4E00\u5C42",
|
|
3669
|
+
icon: vue.markRaw(iconsVue.Bottom),
|
|
3670
|
+
display: () => !utils.isPage(node.value) && !props.isMultiSelect,
|
|
3671
|
+
handler: () => {
|
|
3672
|
+
editorService?.moveLayer(-1);
|
|
3673
|
+
}
|
|
3674
|
+
},
|
|
3675
|
+
{
|
|
3676
|
+
type: "button",
|
|
3677
|
+
text: "\u7F6E\u9876",
|
|
3678
|
+
display: () => !utils.isPage(node.value) && !props.isMultiSelect,
|
|
3679
|
+
handler: () => {
|
|
3680
|
+
editorService?.moveLayer(LayerOffset.TOP);
|
|
3681
|
+
}
|
|
3682
|
+
},
|
|
3683
|
+
{
|
|
3684
|
+
type: "button",
|
|
3685
|
+
text: "\u7F6E\u5E95",
|
|
3686
|
+
display: () => !utils.isPage(node.value) && !props.isMultiSelect,
|
|
3687
|
+
handler: () => {
|
|
3688
|
+
editorService?.moveLayer(LayerOffset.BOTTOM);
|
|
3689
|
+
}
|
|
3690
|
+
},
|
|
3691
|
+
{
|
|
3692
|
+
type: "divider",
|
|
3693
|
+
direction: "horizontal",
|
|
3694
|
+
display: () => !utils.isPage(node.value) && !props.isMultiSelect
|
|
3695
|
+
},
|
|
3696
|
+
{
|
|
3697
|
+
type: "button",
|
|
3698
|
+
text: "\u5220\u9664",
|
|
3699
|
+
icon: iconsVue.Delete,
|
|
3700
|
+
display: () => !utils.isPage(node.value),
|
|
3701
|
+
handler: () => {
|
|
3702
|
+
nodes.value && editorService?.remove(nodes.value);
|
|
3703
|
+
}
|
|
3704
|
+
},
|
|
3705
|
+
{
|
|
3706
|
+
type: "divider",
|
|
3707
|
+
direction: "horizontal"
|
|
3708
|
+
},
|
|
3709
|
+
{
|
|
3710
|
+
type: "button",
|
|
3711
|
+
text: "\u6E05\u7A7A\u53C2\u8003\u7EBF",
|
|
3712
|
+
handler: () => {
|
|
3713
|
+
editorService?.get("stage").clearGuides();
|
|
3714
|
+
}
|
|
3715
|
+
},
|
|
3716
|
+
...stageContentMenu
|
|
3717
|
+
]);
|
|
3718
|
+
vue.onMounted(async () => {
|
|
3719
|
+
const data = await storageService.getItem(COPY_STORAGE_KEY);
|
|
3406
3720
|
canPaste.value = data !== "undefined" && !!data;
|
|
3407
3721
|
});
|
|
3408
3722
|
vue.watch(parent, async () => {
|
|
3409
3723
|
if (!parent.value || !editorService)
|
|
3410
3724
|
return canCenter.value = false;
|
|
3411
3725
|
const layout = await editorService.getLayout(parent.value);
|
|
3412
|
-
|
|
3726
|
+
const isLayoutConform = [Layout.ABSOLUTE, Layout.FIXED].includes(layout);
|
|
3727
|
+
const isTypeConform = nodes.value?.every((selectedNode) => ![schema.NodeType.ROOT, schema.NodeType.PAGE, "pop"].includes(`${selectedNode?.type}`));
|
|
3728
|
+
canCenter.value = isLayoutConform && !!isTypeConform;
|
|
3413
3729
|
}, { immediate: true });
|
|
3414
|
-
|
|
3415
|
-
menu
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
},
|
|
3425
|
-
{
|
|
3426
|
-
type: "button",
|
|
3427
|
-
text: "\u590D\u5236",
|
|
3428
|
-
icon: vue.markRaw(iconsVue.DocumentCopy),
|
|
3429
|
-
handler: () => {
|
|
3430
|
-
node.value && editorService?.copy(node.value);
|
|
3431
|
-
canPaste.value = true;
|
|
3432
|
-
}
|
|
3433
|
-
},
|
|
3434
|
-
{
|
|
3435
|
-
type: "button",
|
|
3436
|
-
text: "\u7C98\u8D34",
|
|
3437
|
-
display: () => canPaste.value,
|
|
3438
|
-
handler: () => {
|
|
3439
|
-
const stage = editorService?.get("stage");
|
|
3440
|
-
const rect = menu.value?.$el.getBoundingClientRect();
|
|
3441
|
-
const parentRect = stage?.container?.getBoundingClientRect();
|
|
3442
|
-
let left = (rect?.left || 0) - (parentRect?.left || 0);
|
|
3443
|
-
let top = (rect?.top || 0) - (parentRect?.top || 0);
|
|
3444
|
-
if (node.value?.items && stage) {
|
|
3445
|
-
const parentEl = stage.renderer.contentWindow?.document.getElementById(`${node.value.id}`);
|
|
3446
|
-
const parentElRect = parentEl?.getBoundingClientRect();
|
|
3447
|
-
left = left - (parentElRect?.left || 0);
|
|
3448
|
-
top = top - (parentElRect?.top || 0);
|
|
3449
|
-
}
|
|
3450
|
-
editorService?.paste({ left, top });
|
|
3451
|
-
}
|
|
3452
|
-
},
|
|
3453
|
-
{
|
|
3454
|
-
type: "divider",
|
|
3455
|
-
direction: "horizontal",
|
|
3456
|
-
display: () => !isPage.value
|
|
3457
|
-
},
|
|
3458
|
-
{
|
|
3459
|
-
type: "button",
|
|
3460
|
-
text: "\u4E0A\u79FB\u4E00\u5C42",
|
|
3461
|
-
icon: vue.markRaw(iconsVue.Top),
|
|
3462
|
-
display: () => !isPage.value,
|
|
3463
|
-
handler: () => {
|
|
3464
|
-
editorService?.moveLayer(1);
|
|
3465
|
-
}
|
|
3466
|
-
},
|
|
3467
|
-
{
|
|
3468
|
-
type: "button",
|
|
3469
|
-
text: "\u4E0B\u79FB\u4E00\u5C42",
|
|
3470
|
-
icon: vue.markRaw(iconsVue.Bottom),
|
|
3471
|
-
display: () => !isPage.value,
|
|
3472
|
-
handler: () => {
|
|
3473
|
-
editorService?.moveLayer(-1);
|
|
3474
|
-
}
|
|
3475
|
-
},
|
|
3476
|
-
{
|
|
3477
|
-
type: "button",
|
|
3478
|
-
text: "\u7F6E\u9876",
|
|
3479
|
-
display: () => !isPage.value,
|
|
3480
|
-
handler: () => {
|
|
3481
|
-
editorService?.moveLayer(LayerOffset.TOP);
|
|
3482
|
-
}
|
|
3483
|
-
},
|
|
3484
|
-
{
|
|
3485
|
-
type: "button",
|
|
3486
|
-
text: "\u7F6E\u5E95",
|
|
3487
|
-
display: () => !isPage.value,
|
|
3488
|
-
handler: () => {
|
|
3489
|
-
editorService?.moveLayer(LayerOffset.BOTTOM);
|
|
3490
|
-
}
|
|
3491
|
-
},
|
|
3492
|
-
{
|
|
3493
|
-
type: "divider",
|
|
3494
|
-
direction: "horizontal",
|
|
3495
|
-
display: () => !isPage.value
|
|
3496
|
-
},
|
|
3497
|
-
{
|
|
3498
|
-
type: "button",
|
|
3499
|
-
text: "\u5220\u9664",
|
|
3500
|
-
icon: iconsVue.Delete,
|
|
3501
|
-
display: () => !isPage.value,
|
|
3502
|
-
handler: () => {
|
|
3503
|
-
node.value && editorService?.remove(node.value);
|
|
3504
|
-
}
|
|
3505
|
-
},
|
|
3506
|
-
{
|
|
3507
|
-
type: "divider",
|
|
3508
|
-
direction: "horizontal"
|
|
3509
|
-
},
|
|
3510
|
-
{
|
|
3511
|
-
type: "button",
|
|
3512
|
-
text: "\u6E05\u7A7A\u53C2\u8003\u7EBF",
|
|
3513
|
-
handler: () => {
|
|
3514
|
-
editorService?.get("stage").clearGuides();
|
|
3515
|
-
}
|
|
3516
|
-
},
|
|
3517
|
-
...stageContentMenu
|
|
3518
|
-
]),
|
|
3519
|
-
show(e) {
|
|
3520
|
-
menu.value?.show(e);
|
|
3521
|
-
}
|
|
3730
|
+
const show = (e) => {
|
|
3731
|
+
menu.value?.show(e);
|
|
3732
|
+
};
|
|
3733
|
+
expose({ show });
|
|
3734
|
+
return (_ctx, _cache) => {
|
|
3735
|
+
return vue.openBlock(), vue.createBlock(_sfc_main$a, {
|
|
3736
|
+
"menu-data": menuData,
|
|
3737
|
+
ref_key: "menu",
|
|
3738
|
+
ref: menu
|
|
3739
|
+
}, null, 8, ["menu-data"]);
|
|
3522
3740
|
};
|
|
3523
3741
|
}
|
|
3524
3742
|
});
|
|
3525
|
-
function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3526
|
-
const _component_content_menu = vue.resolveComponent("content-menu");
|
|
3527
|
-
return vue.openBlock(), vue.createBlock(_component_content_menu, {
|
|
3528
|
-
"menu-data": _ctx.menuData,
|
|
3529
|
-
ref: "menu"
|
|
3530
|
-
}, null, 8, ["menu-data"]);
|
|
3531
|
-
}
|
|
3532
|
-
var ViewerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["render", _sfc_render$3]]);
|
|
3533
3743
|
|
|
3534
|
-
const _sfc_main$2 = vue.defineComponent({
|
|
3535
|
-
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
},
|
|
3540
|
-
setup() {
|
|
3744
|
+
const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
|
|
3745
|
+
__name: "Stage",
|
|
3746
|
+
setup(__props) {
|
|
3747
|
+
let stage = null;
|
|
3748
|
+
let runtime = null;
|
|
3541
3749
|
const services = vue.inject("services");
|
|
3542
3750
|
const stageOptions = vue.inject("stageOptions");
|
|
3543
3751
|
const stageWrap = vue.ref();
|
|
3544
3752
|
const stageContainer = vue.ref();
|
|
3545
3753
|
const menu = vue.ref();
|
|
3754
|
+
const isMultiSelect = vue.computed(() => services?.editorService.get("nodes")?.length > 1);
|
|
3546
3755
|
const stageRect = vue.computed(() => services?.uiService.get("stageRect"));
|
|
3547
3756
|
const uiSelectMode = vue.computed(() => services?.uiService.get("uiSelectMode"));
|
|
3548
3757
|
const root = vue.computed(() => services?.editorService.get("root"));
|
|
3549
3758
|
const page = vue.computed(() => services?.editorService.get("page"));
|
|
3550
3759
|
const zoom = vue.computed(() => services?.uiService.get("zoom") || 1);
|
|
3551
3760
|
const node = vue.computed(() => services?.editorService.get("node"));
|
|
3552
|
-
let stage = null;
|
|
3553
|
-
let runtime = null;
|
|
3554
3761
|
const getGuideLineKey = (key) => `${key}_${root.value?.id}_${page.value?.id}`;
|
|
3555
3762
|
vue.watchEffect(() => {
|
|
3556
3763
|
if (stage)
|
|
@@ -3559,7 +3766,7 @@
|
|
|
3559
3766
|
return;
|
|
3560
3767
|
if (!(stageOptions?.runtimeUrl || stageOptions?.render) || !root.value)
|
|
3561
3768
|
return;
|
|
3562
|
-
stage = new StageCore__default
|
|
3769
|
+
stage = new StageCore__default.default({
|
|
3563
3770
|
render: stageOptions.render,
|
|
3564
3771
|
runtimeUrl: stageOptions.runtimeUrl,
|
|
3565
3772
|
zoom: zoom.value,
|
|
@@ -3590,6 +3797,9 @@
|
|
|
3590
3797
|
stage?.on("highlight", (el) => {
|
|
3591
3798
|
services?.editorService.highlight(el.id);
|
|
3592
3799
|
});
|
|
3800
|
+
stage?.on("multiSelect", (els) => {
|
|
3801
|
+
services?.editorService.multiSelect(els.map((el) => el.id));
|
|
3802
|
+
});
|
|
3593
3803
|
stage?.on("update", (ev) => {
|
|
3594
3804
|
if (ev.parentEl) {
|
|
3595
3805
|
services?.editorService.moveToContainer({ id: ev.el.id, style: ev.style }, ev.parentEl.id);
|
|
@@ -3648,99 +3858,96 @@
|
|
|
3648
3858
|
resizeObserver.disconnect();
|
|
3649
3859
|
services?.editorService.set("stage", null);
|
|
3650
3860
|
});
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
e2.
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
const
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
}
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
|
|
3679
|
-
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
top = e.clientY - containerRect.top + scrollTop;
|
|
3687
|
-
left = e.clientX - containerRect.left + scrollLeft;
|
|
3688
|
-
if (parentEl && doc) {
|
|
3689
|
-
const { left: parentLeft, top: parentTop } = StageCore.getOffset(parentEl);
|
|
3690
|
-
left = left - StageCore.calcValueByFontsize(doc, parentLeft);
|
|
3691
|
-
top = top - StageCore.calcValueByFontsize(doc, parentTop);
|
|
3692
|
-
}
|
|
3861
|
+
const contextmenuHandler = (e2) => {
|
|
3862
|
+
e2.preventDefault();
|
|
3863
|
+
menu.value?.show(e2);
|
|
3864
|
+
};
|
|
3865
|
+
const dragoverHandler = (e2) => {
|
|
3866
|
+
e2.preventDefault();
|
|
3867
|
+
if (e2.dataTransfer) {
|
|
3868
|
+
e2.dataTransfer.dropEffect = "move";
|
|
3869
|
+
}
|
|
3870
|
+
};
|
|
3871
|
+
const dropHandler = async (e) => {
|
|
3872
|
+
e.preventDefault();
|
|
3873
|
+
const doc = stage?.renderer.contentWindow?.document;
|
|
3874
|
+
const parentEl = doc?.querySelector(`.${stageOptions?.containerHighlightClassName}`);
|
|
3875
|
+
let parent = page.value;
|
|
3876
|
+
if (parentEl) {
|
|
3877
|
+
parent = services?.editorService.getNodeById(parentEl.id, false);
|
|
3878
|
+
}
|
|
3879
|
+
if (e.dataTransfer && parent && stageContainer.value && stage) {
|
|
3880
|
+
const config = eval(`(${e.dataTransfer.getData("data")})`);
|
|
3881
|
+
const layout = await services?.editorService.getLayout(parent);
|
|
3882
|
+
const containerRect = stageContainer.value.getBoundingClientRect();
|
|
3883
|
+
const { scrollTop, scrollLeft } = stage.mask;
|
|
3884
|
+
const { style = {} } = config;
|
|
3885
|
+
let top = 0;
|
|
3886
|
+
let left = 0;
|
|
3887
|
+
let position = "relative";
|
|
3888
|
+
if (layout === Layout.ABSOLUTE) {
|
|
3889
|
+
position = "absolute";
|
|
3890
|
+
top = e.clientY - containerRect.top + scrollTop;
|
|
3891
|
+
left = e.clientX - containerRect.left + scrollLeft;
|
|
3892
|
+
if (parentEl && doc) {
|
|
3893
|
+
const { left: parentLeft, top: parentTop } = StageCore.getOffset(parentEl);
|
|
3894
|
+
left = left - StageCore.calcValueByFontsize(doc, parentLeft);
|
|
3895
|
+
top = top - StageCore.calcValueByFontsize(doc, parentTop);
|
|
3693
3896
|
}
|
|
3694
|
-
config.style = {
|
|
3695
|
-
...style,
|
|
3696
|
-
position,
|
|
3697
|
-
top,
|
|
3698
|
-
left
|
|
3699
|
-
};
|
|
3700
|
-
services?.editorService.add(config, parent);
|
|
3701
3897
|
}
|
|
3898
|
+
config.style = {
|
|
3899
|
+
...style,
|
|
3900
|
+
position,
|
|
3901
|
+
top,
|
|
3902
|
+
left
|
|
3903
|
+
};
|
|
3904
|
+
config.inputEvent = e;
|
|
3905
|
+
services?.editorService.add(config, parent);
|
|
3702
3906
|
}
|
|
3703
3907
|
};
|
|
3908
|
+
return (_ctx, _cache) => {
|
|
3909
|
+
return vue.openBlock(), vue.createBlock(ScrollViewer, {
|
|
3910
|
+
class: "m-editor-stage",
|
|
3911
|
+
ref_key: "stageWrap",
|
|
3912
|
+
ref: stageWrap,
|
|
3913
|
+
width: vue.unref(stageRect)?.width,
|
|
3914
|
+
height: vue.unref(stageRect)?.height,
|
|
3915
|
+
zoom: vue.unref(zoom)
|
|
3916
|
+
}, {
|
|
3917
|
+
default: vue.withCtx(() => [
|
|
3918
|
+
vue.createElementVNode("div", {
|
|
3919
|
+
class: "m-editor-stage-container",
|
|
3920
|
+
ref_key: "stageContainer",
|
|
3921
|
+
ref: stageContainer,
|
|
3922
|
+
style: vue.normalizeStyle(`transform: scale(${vue.unref(zoom)})`),
|
|
3923
|
+
onContextmenu: contextmenuHandler,
|
|
3924
|
+
onDrop: dropHandler,
|
|
3925
|
+
onDragover: dragoverHandler
|
|
3926
|
+
}, null, 36),
|
|
3927
|
+
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
3928
|
+
vue.createVNode(_sfc_main$3, {
|
|
3929
|
+
ref_key: "menu",
|
|
3930
|
+
ref: menu,
|
|
3931
|
+
"is-multi-select": vue.unref(isMultiSelect)
|
|
3932
|
+
}, null, 8, ["is-multi-select"])
|
|
3933
|
+
]))
|
|
3934
|
+
]),
|
|
3935
|
+
_: 1
|
|
3936
|
+
}, 8, ["width", "height", "zoom"]);
|
|
3937
|
+
};
|
|
3704
3938
|
}
|
|
3705
3939
|
});
|
|
3706
|
-
function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3707
|
-
const _component_viewer_menu = vue.resolveComponent("viewer-menu");
|
|
3708
|
-
const _component_scroll_viewer = vue.resolveComponent("scroll-viewer");
|
|
3709
|
-
return vue.openBlock(), vue.createBlock(_component_scroll_viewer, {
|
|
3710
|
-
class: "m-editor-stage",
|
|
3711
|
-
ref: "stageWrap",
|
|
3712
|
-
width: _ctx.stageRect?.width,
|
|
3713
|
-
height: _ctx.stageRect?.height,
|
|
3714
|
-
zoom: _ctx.zoom
|
|
3715
|
-
}, {
|
|
3716
|
-
default: vue.withCtx(() => [
|
|
3717
|
-
vue.createElementVNode("div", {
|
|
3718
|
-
class: "m-editor-stage-container",
|
|
3719
|
-
ref: "stageContainer",
|
|
3720
|
-
style: vue.normalizeStyle(`transform: scale(${_ctx.zoom})`),
|
|
3721
|
-
onContextmenu: _cache[0] || (_cache[0] = (...args) => _ctx.contextmenuHandler && _ctx.contextmenuHandler(...args)),
|
|
3722
|
-
onDrop: _cache[1] || (_cache[1] = (...args) => _ctx.dropHandler && _ctx.dropHandler(...args)),
|
|
3723
|
-
onDragover: _cache[2] || (_cache[2] = (...args) => _ctx.dragoverHandler && _ctx.dragoverHandler(...args))
|
|
3724
|
-
}, null, 36),
|
|
3725
|
-
(vue.openBlock(), vue.createBlock(vue.Teleport, { to: "body" }, [
|
|
3726
|
-
vue.createVNode(_component_viewer_menu, { ref: "menu" }, null, 512)
|
|
3727
|
-
]))
|
|
3728
|
-
]),
|
|
3729
|
-
_: 1
|
|
3730
|
-
}, 8, ["width", "height", "zoom"]);
|
|
3731
|
-
}
|
|
3732
|
-
var MagicStage = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["render", _sfc_render$2]]);
|
|
3733
3940
|
|
|
3734
3941
|
const _sfc_main$1 = vue.defineComponent({
|
|
3735
3942
|
name: "m-editor-workspace",
|
|
3736
3943
|
components: {
|
|
3737
|
-
PageBar,
|
|
3738
|
-
MagicStage
|
|
3944
|
+
PageBar: _sfc_main$5,
|
|
3945
|
+
MagicStage: _sfc_main$2
|
|
3739
3946
|
},
|
|
3740
3947
|
setup() {
|
|
3741
3948
|
const services = vue.inject("services");
|
|
3742
3949
|
const workspace = vue.ref();
|
|
3743
|
-
const
|
|
3950
|
+
const nodes = vue.computed(() => services?.editorService.get("nodes"));
|
|
3744
3951
|
let keycon;
|
|
3745
3952
|
const mouseenterHandler = () => {
|
|
3746
3953
|
workspace.value?.focus();
|
|
@@ -3751,31 +3958,31 @@
|
|
|
3751
3958
|
vue.onMounted(() => {
|
|
3752
3959
|
workspace.value?.addEventListener("mouseenter", mouseenterHandler);
|
|
3753
3960
|
workspace.value?.addEventListener("mouseleave", mouseleaveHandler);
|
|
3754
|
-
keycon = new KeyController__default
|
|
3961
|
+
keycon = new KeyController__default.default(workspace.value);
|
|
3755
3962
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
3756
3963
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
3757
3964
|
keycon.keyup("delete", (e) => {
|
|
3758
3965
|
e.inputEvent.preventDefault();
|
|
3759
|
-
if (!
|
|
3966
|
+
if (!nodes.value || utils.isPage(nodes.value[0]))
|
|
3760
3967
|
return;
|
|
3761
|
-
services?.editorService.remove(
|
|
3968
|
+
services?.editorService.remove(nodes.value);
|
|
3762
3969
|
}).keyup("backspace", (e) => {
|
|
3763
3970
|
e.inputEvent.preventDefault();
|
|
3764
|
-
if (!
|
|
3971
|
+
if (!nodes.value || utils.isPage(nodes.value[0]))
|
|
3765
3972
|
return;
|
|
3766
|
-
services?.editorService.remove(
|
|
3973
|
+
services?.editorService.remove(nodes.value);
|
|
3767
3974
|
}).keydown([ctrl, "c"], (e) => {
|
|
3768
3975
|
e.inputEvent.preventDefault();
|
|
3769
|
-
|
|
3976
|
+
nodes.value && services?.editorService.copy(nodes.value);
|
|
3770
3977
|
}).keydown([ctrl, "v"], (e) => {
|
|
3771
3978
|
e.inputEvent.preventDefault();
|
|
3772
|
-
|
|
3979
|
+
nodes.value && services?.editorService.paste();
|
|
3773
3980
|
}).keydown([ctrl, "x"], (e) => {
|
|
3774
3981
|
e.inputEvent.preventDefault();
|
|
3775
|
-
if (!
|
|
3982
|
+
if (!nodes.value || utils.isPage(nodes.value[0]))
|
|
3776
3983
|
return;
|
|
3777
|
-
services?.editorService.copy(
|
|
3778
|
-
services?.editorService.remove(
|
|
3984
|
+
services?.editorService.copy(nodes.value);
|
|
3985
|
+
services?.editorService.remove(nodes.value);
|
|
3779
3986
|
}).keydown([ctrl, "z"], (e) => {
|
|
3780
3987
|
e.inputEvent.preventDefault();
|
|
3781
3988
|
services?.editorService.undo();
|
|
@@ -3837,6 +4044,7 @@
|
|
|
3837
4044
|
};
|
|
3838
4045
|
}
|
|
3839
4046
|
});
|
|
4047
|
+
|
|
3840
4048
|
const _hoisted_1 = {
|
|
3841
4049
|
class: "m-editor-workspace",
|
|
3842
4050
|
tabindex: "1",
|
|
@@ -3861,14 +4069,14 @@
|
|
|
3861
4069
|
})
|
|
3862
4070
|
], 512);
|
|
3863
4071
|
}
|
|
3864
|
-
|
|
4072
|
+
const Workspace = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
|
|
3865
4073
|
|
|
3866
4074
|
class ComponentList extends BaseService {
|
|
4075
|
+
state = vue.reactive({
|
|
4076
|
+
list: []
|
|
4077
|
+
});
|
|
3867
4078
|
constructor() {
|
|
3868
4079
|
super([]);
|
|
3869
|
-
this.state = vue.reactive({
|
|
3870
|
-
list: []
|
|
3871
|
-
});
|
|
3872
4080
|
}
|
|
3873
4081
|
setList(componentGroupList) {
|
|
3874
4082
|
this.state.list = componentGroupList;
|
|
@@ -3877,7 +4085,7 @@
|
|
|
3877
4085
|
return this.state.list;
|
|
3878
4086
|
}
|
|
3879
4087
|
}
|
|
3880
|
-
|
|
4088
|
+
const componentListService = new ComponentList();
|
|
3881
4089
|
|
|
3882
4090
|
const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
3883
4091
|
const MIN_LEFT_COLUMN_WIDTH = 45;
|
|
@@ -3989,13 +4197,15 @@
|
|
|
3989
4197
|
const { height, width } = stageContainerRect;
|
|
3990
4198
|
if (!width || !height)
|
|
3991
4199
|
return 1;
|
|
3992
|
-
|
|
4200
|
+
const stageWidth = stageRect.width + 30;
|
|
4201
|
+
const stageHeight = stageRect.height + 30;
|
|
4202
|
+
if (width > stageWidth && height > stageHeight) {
|
|
3993
4203
|
return 1;
|
|
3994
4204
|
}
|
|
3995
|
-
return Math.min((width -
|
|
4205
|
+
return Math.min((width - 60) / stageWidth || 1, (height - 80) / stageHeight || 1);
|
|
3996
4206
|
}
|
|
3997
4207
|
}
|
|
3998
|
-
|
|
4208
|
+
const uiService = new Ui();
|
|
3999
4209
|
|
|
4000
4210
|
const _sfc_main = vue.defineComponent({
|
|
4001
4211
|
name: "m-editor",
|
|
@@ -4125,7 +4335,8 @@
|
|
|
4125
4335
|
historyService,
|
|
4126
4336
|
propsService,
|
|
4127
4337
|
editorService,
|
|
4128
|
-
uiService
|
|
4338
|
+
uiService,
|
|
4339
|
+
storageService
|
|
4129
4340
|
};
|
|
4130
4341
|
vue.provide("services", services);
|
|
4131
4342
|
vue.provide("layerContentMenu", props.layerContentMenu);
|
|
@@ -4144,6 +4355,7 @@
|
|
|
4144
4355
|
return services;
|
|
4145
4356
|
}
|
|
4146
4357
|
});
|
|
4358
|
+
|
|
4147
4359
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
4148
4360
|
const _component_nav_menu = vue.resolveComponent("nav-menu");
|
|
4149
4361
|
const _component_sidebar = vue.resolveComponent("sidebar");
|
|
@@ -4204,18 +4416,18 @@
|
|
|
4204
4416
|
_: 3
|
|
4205
4417
|
}, 8, ["code-options"]);
|
|
4206
4418
|
}
|
|
4207
|
-
|
|
4419
|
+
const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
4208
4420
|
|
|
4209
|
-
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 border: 1px solid #d9dbdd;\n transition: transform 0.3s;\n box-sizing: content-box;\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}")();
|
|
4421
|
+
const index$1 = '';
|
|
4210
4422
|
|
|
4211
4423
|
const defaultInstallOpt = {};
|
|
4212
|
-
|
|
4424
|
+
const index = {
|
|
4213
4425
|
install: (app, opt) => {
|
|
4214
4426
|
const option = Object.assign(defaultInstallOpt, opt || {});
|
|
4215
4427
|
app.config.globalProperties.$TMAGIC_EDITOR = option;
|
|
4216
4428
|
setConfig(option);
|
|
4217
4429
|
app.component(Editor.name, Editor);
|
|
4218
|
-
app.component(
|
|
4430
|
+
app.component(_sfc_main$k.name, _sfc_main$k);
|
|
4219
4431
|
app.component(CodeLink.name, CodeLink);
|
|
4220
4432
|
app.component(Code.name, Code);
|
|
4221
4433
|
app.component(CodeEditor.name, CodeEditor);
|
|
@@ -4234,11 +4446,11 @@
|
|
|
4234
4446
|
exports.PropsPanel = PropsPanel;
|
|
4235
4447
|
exports.TMagicCodeEditor = CodeEditor;
|
|
4236
4448
|
exports.TMagicEditor = Editor;
|
|
4237
|
-
exports.ToolButton =
|
|
4449
|
+
exports.ToolButton = _sfc_main$e;
|
|
4238
4450
|
exports.V_GUIDE_LINE_STORAGE_KEY = V_GUIDE_LINE_STORAGE_KEY;
|
|
4239
4451
|
exports.change2Fixed = change2Fixed;
|
|
4240
4452
|
exports.debug = debug;
|
|
4241
|
-
exports
|
|
4453
|
+
exports.default = index;
|
|
4242
4454
|
exports.editorService = editorService;
|
|
4243
4455
|
exports.error = error;
|
|
4244
4456
|
exports.eventsService = eventsService;
|
|
@@ -4247,7 +4459,6 @@
|
|
|
4247
4459
|
exports.generatePageName = generatePageName;
|
|
4248
4460
|
exports.generatePageNameByApp = generatePageNameByApp;
|
|
4249
4461
|
exports.getConfig = getConfig;
|
|
4250
|
-
exports.getDefaultPropsValue = getDefaultPropsValue;
|
|
4251
4462
|
exports.getGuideLineFromCache = getGuideLineFromCache;
|
|
4252
4463
|
exports.getInitPositionStyle = getInitPositionStyle;
|
|
4253
4464
|
exports.getNodeIndex = getNodeIndex;
|
|
@@ -4261,6 +4472,7 @@
|
|
|
4261
4472
|
exports.propsService = propsService;
|
|
4262
4473
|
exports.setConfig = setConfig;
|
|
4263
4474
|
exports.setLayout = setLayout;
|
|
4475
|
+
exports.storageService = storageService;
|
|
4264
4476
|
exports.uiService = uiService;
|
|
4265
4477
|
exports.warn = warn;
|
|
4266
4478
|
|