@tmagic/editor 1.2.0-beta.1 → 1.2.0-beta.11
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 +14 -8
- package/dist/tmagic-editor.mjs +1112 -981
- package/dist/tmagic-editor.mjs.map +1 -1
- package/dist/tmagic-editor.umd.js +1124 -991
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +11 -10
- package/src/Editor.vue +11 -13
- package/src/components/ContentMenu.vue +4 -4
- package/src/components/Icon.vue +7 -5
- package/src/{layouts → components}/Layout.vue +14 -4
- package/src/components/ScrollBar.vue +1 -1
- package/src/components/ScrollViewer.vue +10 -1
- package/src/components/ToolButton.vue +30 -15
- package/src/fields/Code.vue +5 -2
- package/src/fields/CodeLink.vue +20 -12
- package/src/fields/CodeSelect.vue +19 -27
- package/src/fields/UISelect.vue +9 -8
- package/src/index.ts +3 -1
- package/src/layouts/AddPageBox.vue +13 -20
- package/src/layouts/CodeEditor.vue +106 -120
- package/src/layouts/Framework.vue +62 -40
- package/src/layouts/NavMenu.vue +1 -1
- package/src/layouts/PropsPanel.vue +4 -9
- package/src/layouts/Resizer.vue +1 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +15 -13
- package/src/layouts/sidebar/LayerMenu.vue +89 -92
- package/src/layouts/sidebar/LayerPanel.vue +273 -178
- package/src/layouts/sidebar/Sidebar.vue +126 -46
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +28 -24
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +22 -22
- package/src/layouts/workspace/Breadcrumb.vue +32 -0
- package/src/layouts/workspace/PageBar.vue +12 -11
- package/src/layouts/workspace/PageBarScrollContainer.vue +1 -1
- package/src/layouts/workspace/Stage.vue +15 -7
- package/src/layouts/workspace/ViewerMenu.vue +8 -7
- package/src/layouts/workspace/Workspace.vue +10 -3
- package/src/services/codeBlock.ts +16 -10
- package/src/services/editor.ts +12 -8
- package/src/theme/breadcrumb.scss +6 -0
- package/src/theme/component-list-panel.scss +3 -7
- package/src/theme/index.scss +1 -15
- package/src/theme/layer-panel.scss +7 -2
- package/src/theme/theme.scss +16 -0
- package/src/type.ts +2 -1
- package/src/utils/scroll-viewer.ts +18 -2
- package/src/utils/stage.ts +7 -0
- package/types/Editor.vue.d.ts +2 -2
- package/types/components/ContentMenu.vue.d.ts +1 -3
- package/types/components/Icon.vue.d.ts +1 -3
- package/types/{layouts → components}/Layout.vue.d.ts +0 -0
- package/types/components/ScrollBar.vue.d.ts +1 -3
- package/types/components/ScrollViewer.vue.d.ts +45 -1
- package/types/components/ToolButton.vue.d.ts +1 -3
- package/types/fields/Code.vue.d.ts +9 -3
- package/types/fields/CodeLink.vue.d.ts +5 -3
- package/types/fields/CodeSelect.vue.d.ts +1 -3
- package/types/fields/UISelect.vue.d.ts +1 -3
- package/types/index.d.ts +2 -0
- package/types/layouts/AddPageBox.vue.d.ts +43 -3
- package/types/layouts/CodeEditor.vue.d.ts +158 -45
- package/types/layouts/NavMenu.vue.d.ts +1 -3
- package/types/layouts/sidebar/LayerMenu.vue.d.ts +31 -63
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +38 -1074
- package/types/layouts/sidebar/Sidebar.vue.d.ts +119 -17
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +1 -0
- package/types/layouts/workspace/Breadcrumb.vue.d.ts +44 -0
- package/types/layouts/workspace/Stage.vue.d.ts +23 -7
- package/types/layouts/workspace/ViewerMenu.vue.d.ts +6 -3
- package/types/layouts/workspace/Workspace.vue.d.ts +23 -5
- package/types/services/codeBlock.d.ts +1 -1
- package/types/services/editor.d.ts +2 -2
- package/types/services/ui.d.ts +1 -1
- package/types/type.d.ts +2 -1
- package/types/utils/scroll-viewer.d.ts +5 -0
- package/src/layouts/sidebar/TabPane.vue +0 -126
- package/types/layouts/sidebar/TabPane.vue.d.ts +0 -14
package/dist/tmagic-editor.mjs
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, unref, reactive, watch, inject, ref, watchEffect, createElementBlock, createVNode, withCtx, createElementVNode, withModifiers, createCommentVNode, createTextVNode, toDisplayString, onMounted, onUnmounted,
|
|
1
|
+
import { defineComponent, computed, resolveComponent, openBlock, createBlock, normalizeStyle, unref, reactive, watch, inject, ref, watchEffect, createElementBlock, createVNode, withCtx, createElementVNode, withModifiers, createCommentVNode, createTextVNode, toDisplayString, onMounted, onUnmounted, renderSlot, Fragment, normalizeClass, resolveDynamicComponent, toRaw, createSlots, renderList, normalizeProps, mergeProps, markRaw, getCurrentInstance, isRef, withDirectives, Teleport, vShow, nextTick, toHandlers, provide } from 'vue';
|
|
2
2
|
import serialize from 'serialize-javascript';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { Delete, Close,
|
|
3
|
+
import { map, xor, throttle, pick, cloneDeep, isEmpty, forIn, omit, keys, mergeWith, uniq } from 'lodash-es';
|
|
4
|
+
import { TMagicCard, TMagicTooltip, tMagicMessage, TMagicButton, TMagicIcon, TMagicScrollbar, TMagicDivider, TMagicDropdown, TMagicDropdownMenu, TMagicDropdownItem, TMagicDialog, TMagicInput, TMagicTree, TMagicCollapse, TMagicCollapseItem, getConfig as getConfig$1, TMagicTabs, TMagicPopover } from '@tmagic/design';
|
|
5
|
+
import { Delete, Close, Edit, Plus, ArrowDown, Grid, Memo, FullScreen, ScaleToOriginal, ZoomOut, ZoomIn, Right, Back, View, Link, Search, Files, DocumentCopy, Coin, EditPen, ArrowLeftBold, ArrowRightBold, CaretBottom, Top, Bottom } from '@element-plus/icons-vue';
|
|
6
6
|
import * as monaco from 'monaco-editor';
|
|
7
7
|
import StageCore, { GuidesType, getOffset, calcValueByFontsize, CONTAINER_HIGHLIGHT_CLASS, ContainerHighlightType } from '@tmagic/stage';
|
|
8
|
+
import Gesto from 'gesto';
|
|
8
9
|
import { NodeType } from '@tmagic/schema';
|
|
9
10
|
import { isPop, getNodePath, isNumber, isPage, toLine, removeClassNameByClassName } from '@tmagic/utils';
|
|
10
11
|
import { EventEmitter } from 'events';
|
|
11
12
|
import { DEFAULT_EVENTS, DEFAULT_METHODS } from '@tmagic/core';
|
|
12
|
-
import Gesto from 'gesto';
|
|
13
13
|
import KeyController from 'keycon';
|
|
14
14
|
|
|
15
|
+
const __default__$r = defineComponent({
|
|
16
|
+
name: "MEditorCode"
|
|
17
|
+
});
|
|
15
18
|
const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
16
|
-
|
|
19
|
+
...__default__$r,
|
|
17
20
|
props: {
|
|
18
21
|
model: null,
|
|
19
22
|
name: null,
|
|
@@ -24,7 +27,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
24
27
|
setup(__props, { emit }) {
|
|
25
28
|
const props = __props;
|
|
26
29
|
const language = computed(() => props.config.language || "javascript");
|
|
27
|
-
const height = computed(() => `${document.body.clientHeight - 168}px`);
|
|
30
|
+
const height = computed(() => props.config.height || `${document.body.clientHeight - 168}px`);
|
|
28
31
|
const save = (v) => {
|
|
29
32
|
props.model[props.name] = v;
|
|
30
33
|
emit("change", v);
|
|
@@ -35,14 +38,18 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
35
38
|
style: normalizeStyle(`height: ${unref(height)}`),
|
|
36
39
|
"init-values": __props.model[__props.name],
|
|
37
40
|
language: unref(language),
|
|
41
|
+
options: __props.config.options,
|
|
38
42
|
onSave: save
|
|
39
|
-
}, null, 8, ["style", "init-values", "language"]);
|
|
43
|
+
}, null, 8, ["style", "init-values", "language", "options"]);
|
|
40
44
|
};
|
|
41
45
|
}
|
|
42
46
|
});
|
|
43
47
|
|
|
48
|
+
const __default__$q = defineComponent({
|
|
49
|
+
name: "MEditorCodeLink"
|
|
50
|
+
});
|
|
44
51
|
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
45
|
-
|
|
52
|
+
...__default__$q,
|
|
46
53
|
props: {
|
|
47
54
|
config: null,
|
|
48
55
|
model: null,
|
|
@@ -52,17 +59,24 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
52
59
|
emits: ["change"],
|
|
53
60
|
setup(__props, { emit }) {
|
|
54
61
|
const props = __props;
|
|
55
|
-
const formConfig = computed(() =>
|
|
56
|
-
...props.config
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
const formConfig = computed(() => {
|
|
63
|
+
const { codeOptions, ...config } = props.config;
|
|
64
|
+
return {
|
|
65
|
+
...config,
|
|
66
|
+
text: "",
|
|
67
|
+
type: "link",
|
|
68
|
+
form: [
|
|
69
|
+
{
|
|
70
|
+
name: props.name,
|
|
71
|
+
type: "vs-code",
|
|
72
|
+
options: {
|
|
73
|
+
tabSize: 2,
|
|
74
|
+
...codeOptions || {}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
};
|
|
79
|
+
});
|
|
66
80
|
const modelValue = reactive({
|
|
67
81
|
form: {
|
|
68
82
|
[props.name]: ""
|
|
@@ -153,8 +167,11 @@ const _hoisted_2$6 = /* @__PURE__ */ createElementVNode("path", {
|
|
|
153
167
|
const _hoisted_3$3 = [
|
|
154
168
|
_hoisted_2$6
|
|
155
169
|
];
|
|
170
|
+
const __default__$p = defineComponent({
|
|
171
|
+
name: "MEditorCodeSelect"
|
|
172
|
+
});
|
|
156
173
|
const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
157
|
-
|
|
174
|
+
...__default__$p,
|
|
158
175
|
props: {
|
|
159
176
|
config: null,
|
|
160
177
|
model: null,
|
|
@@ -166,6 +183,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
166
183
|
setup(__props, { emit }) {
|
|
167
184
|
const props = __props;
|
|
168
185
|
const services = inject("services");
|
|
186
|
+
const form = inject("mForm");
|
|
169
187
|
const selectConfig = computed(() => {
|
|
170
188
|
const defaultConfig = {
|
|
171
189
|
multiple: true,
|
|
@@ -188,11 +206,12 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
188
206
|
});
|
|
189
207
|
const fieldKey = ref("");
|
|
190
208
|
const multiple = ref(true);
|
|
191
|
-
const
|
|
192
|
-
let lastTagSnapshot = cloneDeep(props.model[props.name]) || [];
|
|
209
|
+
const lastTagSnapshot = ref([]);
|
|
193
210
|
watchEffect(async () => {
|
|
211
|
+
if (!props.model[props.name])
|
|
212
|
+
return;
|
|
194
213
|
const combineNames = await Promise.all(
|
|
195
|
-
|
|
214
|
+
props.model[props.name].map(async (id) => {
|
|
196
215
|
const { name = "" } = await services?.codeBlockService.getCodeContentById(id) || {};
|
|
197
216
|
return name;
|
|
198
217
|
})
|
|
@@ -203,7 +222,6 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
203
222
|
let codeIds = value;
|
|
204
223
|
if (typeof value === "string") {
|
|
205
224
|
multiple.value = false;
|
|
206
|
-
lastTagSnapshot = [lastTagSnapshot];
|
|
207
225
|
codeIds = value ? [value] : [];
|
|
208
226
|
}
|
|
209
227
|
await setCombineRelation(codeIds);
|
|
@@ -214,35 +232,28 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
214
232
|
let opFlag = CodeSelectOp.CHANGE;
|
|
215
233
|
let diffValues = codeIds;
|
|
216
234
|
if (multiple.value) {
|
|
217
|
-
|
|
218
|
-
|
|
235
|
+
lastTagSnapshot.value = form?.initValues[props.name] || [];
|
|
236
|
+
opFlag = codeIds.length < lastTagSnapshot.value.length ? CodeSelectOp.DELETE : CodeSelectOp.ADD;
|
|
237
|
+
diffValues = xor(codeIds, lastTagSnapshot.value);
|
|
219
238
|
}
|
|
220
239
|
await services?.codeBlockService.setCombineRelation(id, diffValues, opFlag, props.prop);
|
|
221
|
-
lastTagSnapshot = codeIds;
|
|
222
|
-
await setCombineIds(codeIds);
|
|
223
|
-
};
|
|
224
|
-
const setCombineIds = async (codeIds) => {
|
|
225
|
-
combineIds.value = codeIds;
|
|
226
|
-
await services?.codeBlockService.setCombineIds(codeIds);
|
|
227
240
|
};
|
|
228
241
|
const viewHandler = async () => {
|
|
229
242
|
if (props.model[props.name].length === 0) {
|
|
230
|
-
|
|
243
|
+
tMagicMessage.error("\u8BF7\u5148\u7ED1\u5B9A\u4EE3\u7801\u5757");
|
|
231
244
|
return;
|
|
232
245
|
}
|
|
233
|
-
await setCombineIds(props.model[props.name]);
|
|
246
|
+
await services?.codeBlockService.setCombineIds(props.model[props.name]);
|
|
234
247
|
await services?.codeBlockService.setMode(CodeEditorMode.LIST);
|
|
235
|
-
services?.codeBlockService.setCodeEditorContent(true,
|
|
248
|
+
services?.codeBlockService.setCodeEditorContent(true, props.model[props.name][0]);
|
|
236
249
|
};
|
|
237
250
|
return (_ctx, _cache) => {
|
|
238
251
|
const _component_m_fields_select = resolveComponent("m-fields-select");
|
|
239
|
-
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
240
|
-
const _component_el_card = resolveComponent("el-card");
|
|
241
252
|
return openBlock(), createElementBlock("div", {
|
|
242
253
|
class: "m-fields-code-select",
|
|
243
254
|
key: fieldKey.value
|
|
244
255
|
}, [
|
|
245
|
-
createVNode(
|
|
256
|
+
createVNode(unref(TMagicCard), { shadow: "never" }, {
|
|
246
257
|
header: withCtx(() => [
|
|
247
258
|
createVNode(_component_m_fields_select, {
|
|
248
259
|
config: unref(selectConfig),
|
|
@@ -255,7 +266,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
255
266
|
]),
|
|
256
267
|
default: withCtx(() => [
|
|
257
268
|
createElementVNode("div", _hoisted_1$e, [
|
|
258
|
-
createVNode(
|
|
269
|
+
createVNode(unref(TMagicTooltip), {
|
|
259
270
|
class: "tool-item",
|
|
260
271
|
effect: "dark",
|
|
261
272
|
content: "\u67E5\u770B\u4EE3\u7801\u5757",
|
|
@@ -283,8 +294,11 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
283
294
|
});
|
|
284
295
|
|
|
285
296
|
const _hoisted_1$d = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
|
|
297
|
+
const __default__$o = defineComponent({
|
|
298
|
+
name: "MEditorUISelect"
|
|
299
|
+
});
|
|
286
300
|
const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
287
|
-
|
|
301
|
+
...__default__$o,
|
|
288
302
|
props: {
|
|
289
303
|
config: null,
|
|
290
304
|
model: null,
|
|
@@ -334,14 +348,12 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
334
348
|
}
|
|
335
349
|
};
|
|
336
350
|
return (_ctx, _cache) => {
|
|
337
|
-
const _component_el_button = resolveComponent("el-button");
|
|
338
|
-
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
339
351
|
return uiSelectMode.value ? (openBlock(), createElementBlock("div", {
|
|
340
352
|
key: 0,
|
|
341
353
|
class: "m-fields-ui-select",
|
|
342
354
|
onClick: cancelHandler
|
|
343
355
|
}, [
|
|
344
|
-
createVNode(
|
|
356
|
+
createVNode(unref(TMagicButton), {
|
|
345
357
|
type: "danger",
|
|
346
358
|
icon: unref(Delete),
|
|
347
359
|
text: "",
|
|
@@ -358,12 +370,12 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
358
370
|
onClick: startSelect,
|
|
359
371
|
style: { "display": "flex" }
|
|
360
372
|
}, [
|
|
361
|
-
unref(val) ? (openBlock(), createBlock(
|
|
373
|
+
unref(val) ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
362
374
|
key: 0,
|
|
363
375
|
content: "\u6E05\u9664"
|
|
364
376
|
}, {
|
|
365
377
|
default: withCtx(() => [
|
|
366
|
-
createVNode(
|
|
378
|
+
createVNode(unref(TMagicButton), {
|
|
367
379
|
style: { "padding": "0" },
|
|
368
380
|
type: "danger",
|
|
369
381
|
icon: unref(Close),
|
|
@@ -373,11 +385,11 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
373
385
|
]),
|
|
374
386
|
_: 1
|
|
375
387
|
})) : createCommentVNode("", true),
|
|
376
|
-
createVNode(
|
|
388
|
+
createVNode(unref(TMagicTooltip), {
|
|
377
389
|
content: unref(val) ? unref(toName) + "_" + unref(val) : "\u70B9\u51FB\u6B64\u5904\u9009\u62E9"
|
|
378
390
|
}, {
|
|
379
391
|
default: withCtx(() => [
|
|
380
|
-
createVNode(
|
|
392
|
+
createVNode(unref(TMagicButton), {
|
|
381
393
|
text: "",
|
|
382
394
|
style: { "padding": "0", "margin": "0" }
|
|
383
395
|
}, {
|
|
@@ -396,45 +408,39 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
396
408
|
|
|
397
409
|
const UISelect_vue_vue_type_style_index_0_lang = '';
|
|
398
410
|
|
|
399
|
-
const
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
unsafe: true
|
|
405
|
-
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
406
|
-
} else {
|
|
407
|
-
value = v;
|
|
408
|
-
}
|
|
409
|
-
if (language === "javascript" && value.startsWith("{") && value.endsWith("}")) {
|
|
410
|
-
value = `(${value})`;
|
|
411
|
-
}
|
|
412
|
-
return value;
|
|
413
|
-
};
|
|
414
|
-
const _sfc_main$o = defineComponent({
|
|
415
|
-
name: "magic-code-editor",
|
|
411
|
+
const __default__$n = defineComponent({
|
|
412
|
+
name: "MEditorCodeEditor"
|
|
413
|
+
});
|
|
414
|
+
const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
415
|
+
...__default__$n,
|
|
416
416
|
props: {
|
|
417
|
-
initValues:
|
|
418
|
-
|
|
419
|
-
},
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
default: () => ""
|
|
426
|
-
},
|
|
427
|
-
language: {
|
|
428
|
-
type: String,
|
|
429
|
-
default: () => "javascript"
|
|
430
|
-
},
|
|
431
|
-
options: {
|
|
432
|
-
type: Object,
|
|
433
|
-
default: () => ({})
|
|
434
|
-
}
|
|
417
|
+
initValues: null,
|
|
418
|
+
modifiedValues: null,
|
|
419
|
+
type: { default: "" },
|
|
420
|
+
language: { default: "javascript" },
|
|
421
|
+
options: { default: () => ({
|
|
422
|
+
tabSize: 2
|
|
423
|
+
}) },
|
|
424
|
+
autoSave: { type: Boolean, default: true }
|
|
435
425
|
},
|
|
436
426
|
emits: ["initd", "save"],
|
|
437
|
-
setup(
|
|
427
|
+
setup(__props, { expose, emit }) {
|
|
428
|
+
const props = __props;
|
|
429
|
+
const toString = (v, language) => {
|
|
430
|
+
let value = "";
|
|
431
|
+
if (typeof v !== "string") {
|
|
432
|
+
value = serialize(v, {
|
|
433
|
+
space: 2,
|
|
434
|
+
unsafe: true
|
|
435
|
+
}).replace(/"(\w+)":\s/g, "$1: ");
|
|
436
|
+
} else {
|
|
437
|
+
value = v;
|
|
438
|
+
}
|
|
439
|
+
if (language === "javascript" && value.startsWith("{") && value.endsWith("}")) {
|
|
440
|
+
value = `(${value})`;
|
|
441
|
+
}
|
|
442
|
+
return value;
|
|
443
|
+
};
|
|
438
444
|
let vsEditor = null;
|
|
439
445
|
let vsDiffEditor = null;
|
|
440
446
|
const values = ref("");
|
|
@@ -483,7 +489,7 @@ const _sfc_main$o = defineComponent({
|
|
|
483
489
|
emit("save", getEditorValue());
|
|
484
490
|
}
|
|
485
491
|
});
|
|
486
|
-
if (props.type !== "diff") {
|
|
492
|
+
if (props.type !== "diff" && props.autoSave) {
|
|
487
493
|
vsEditor?.onDidBlurEditorWidget(() => {
|
|
488
494
|
emit("save", getEditorValue());
|
|
489
495
|
});
|
|
@@ -509,10 +515,7 @@ const _sfc_main$o = defineComponent({
|
|
|
509
515
|
onUnmounted(() => {
|
|
510
516
|
resizeObserver.disconnect();
|
|
511
517
|
});
|
|
512
|
-
|
|
513
|
-
values,
|
|
514
|
-
loading,
|
|
515
|
-
codeEditor,
|
|
518
|
+
expose({
|
|
516
519
|
getEditor() {
|
|
517
520
|
return vsEditor || vsDiffEditor;
|
|
518
521
|
},
|
|
@@ -521,33 +524,206 @@ const _sfc_main$o = defineComponent({
|
|
|
521
524
|
vsEditor?.focus();
|
|
522
525
|
vsDiffEditor?.focus();
|
|
523
526
|
}
|
|
527
|
+
});
|
|
528
|
+
return (_ctx, _cache) => {
|
|
529
|
+
return openBlock(), createElementBlock("div", {
|
|
530
|
+
ref_key: "codeEditor",
|
|
531
|
+
ref: codeEditor,
|
|
532
|
+
class: "magic-code-editor"
|
|
533
|
+
}, null, 512);
|
|
524
534
|
};
|
|
525
535
|
}
|
|
526
536
|
});
|
|
527
537
|
|
|
528
|
-
const _export_sfc = (sfc, props) => {
|
|
529
|
-
const target = sfc.__vccOpts || sfc;
|
|
530
|
-
for (const [key, val] of props) {
|
|
531
|
-
target[key] = val;
|
|
532
|
-
}
|
|
533
|
-
return target;
|
|
534
|
-
};
|
|
535
|
-
|
|
536
|
-
const _hoisted_1$c = {
|
|
537
|
-
ref: "codeEditor",
|
|
538
|
-
class: "magic-code-editor"
|
|
539
|
-
};
|
|
540
|
-
function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
|
|
541
|
-
return openBlock(), createElementBlock("div", _hoisted_1$c, null, 512);
|
|
542
|
-
}
|
|
543
|
-
const CodeEditor = /* @__PURE__ */ _export_sfc(_sfc_main$o, [["render", _sfc_render$6]]);
|
|
544
|
-
|
|
545
538
|
let $TMAGIC_EDITOR = {};
|
|
546
539
|
const setConfig = (option) => {
|
|
547
540
|
$TMAGIC_EDITOR = option;
|
|
548
541
|
};
|
|
549
542
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
550
543
|
|
|
544
|
+
const __default__$m = defineComponent({
|
|
545
|
+
name: "MEditorResizer"
|
|
546
|
+
});
|
|
547
|
+
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
548
|
+
...__default__$m,
|
|
549
|
+
emits: ["change"],
|
|
550
|
+
setup(__props, { emit }) {
|
|
551
|
+
const target = ref();
|
|
552
|
+
let getso;
|
|
553
|
+
onMounted(() => {
|
|
554
|
+
if (!target.value)
|
|
555
|
+
return;
|
|
556
|
+
getso = new Gesto(target.value, {
|
|
557
|
+
container: window,
|
|
558
|
+
pinchOutside: true
|
|
559
|
+
}).on("drag", (e) => {
|
|
560
|
+
if (!target.value)
|
|
561
|
+
return;
|
|
562
|
+
emit("change", e.deltaX);
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
onUnmounted(() => {
|
|
566
|
+
getso?.unset();
|
|
567
|
+
});
|
|
568
|
+
return (_ctx, _cache) => {
|
|
569
|
+
return openBlock(), createElementBlock("span", {
|
|
570
|
+
ref_key: "target",
|
|
571
|
+
ref: target,
|
|
572
|
+
class: "m-editor-resizer"
|
|
573
|
+
}, [
|
|
574
|
+
renderSlot(_ctx.$slots, "default")
|
|
575
|
+
], 512);
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
const __default__$l = defineComponent({
|
|
581
|
+
name: "MEditorLayout"
|
|
582
|
+
});
|
|
583
|
+
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
584
|
+
...__default__$l,
|
|
585
|
+
props: {
|
|
586
|
+
left: null,
|
|
587
|
+
right: null,
|
|
588
|
+
minLeft: { default: 1 },
|
|
589
|
+
minRight: { default: 1 },
|
|
590
|
+
leftClass: null,
|
|
591
|
+
rightClass: null,
|
|
592
|
+
centerClass: null
|
|
593
|
+
},
|
|
594
|
+
emits: ["update:left", "change", "update:right"],
|
|
595
|
+
setup(__props, { emit }) {
|
|
596
|
+
const props = __props;
|
|
597
|
+
const el = ref();
|
|
598
|
+
let clientWidth = 0;
|
|
599
|
+
const resizerObserver = new ResizeObserver((entries) => {
|
|
600
|
+
for (const { contentRect } of entries) {
|
|
601
|
+
clientWidth = contentRect.width;
|
|
602
|
+
center.value = clientWidth - (props.left || 0) - (props.right || 0);
|
|
603
|
+
emit("change", {
|
|
604
|
+
left: props.left,
|
|
605
|
+
center: center.value,
|
|
606
|
+
right: props.right
|
|
607
|
+
});
|
|
608
|
+
}
|
|
609
|
+
});
|
|
610
|
+
onMounted(() => {
|
|
611
|
+
if (el.value) {
|
|
612
|
+
resizerObserver.observe(el.value);
|
|
613
|
+
}
|
|
614
|
+
});
|
|
615
|
+
onUnmounted(() => {
|
|
616
|
+
resizerObserver.disconnect();
|
|
617
|
+
});
|
|
618
|
+
const center = ref(0);
|
|
619
|
+
const changeLeft = (deltaX) => {
|
|
620
|
+
if (typeof props.left === "undefined")
|
|
621
|
+
return;
|
|
622
|
+
let left = Math.max(props.left + deltaX, props.minLeft) || 0;
|
|
623
|
+
emit("update:left", left);
|
|
624
|
+
if (clientWidth - left - (props.right || 0) <= 0) {
|
|
625
|
+
left = props.left;
|
|
626
|
+
}
|
|
627
|
+
center.value = clientWidth - left - (props.right || 0);
|
|
628
|
+
emit("change", {
|
|
629
|
+
left,
|
|
630
|
+
center: center.value,
|
|
631
|
+
right: props.right
|
|
632
|
+
});
|
|
633
|
+
};
|
|
634
|
+
const changeRight = (deltaX) => {
|
|
635
|
+
if (typeof props.right === "undefined")
|
|
636
|
+
return;
|
|
637
|
+
let right = Math.max(props.right - deltaX, props.minRight) || 0;
|
|
638
|
+
emit("update:right", right);
|
|
639
|
+
if (clientWidth - (props.left || 0) - right <= 0) {
|
|
640
|
+
right = props.right;
|
|
641
|
+
}
|
|
642
|
+
center.value = clientWidth - (props.left || 0) - right;
|
|
643
|
+
emit("change", {
|
|
644
|
+
left: props.left,
|
|
645
|
+
center: center.value,
|
|
646
|
+
right
|
|
647
|
+
});
|
|
648
|
+
};
|
|
649
|
+
return (_ctx, _cache) => {
|
|
650
|
+
return openBlock(), createElementBlock("div", {
|
|
651
|
+
ref_key: "el",
|
|
652
|
+
ref: el,
|
|
653
|
+
class: "m-editor-layout"
|
|
654
|
+
}, [
|
|
655
|
+
typeof props.left !== "undefined" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
656
|
+
createElementVNode("div", {
|
|
657
|
+
class: normalizeClass(["m-editor-layout-left", __props.leftClass]),
|
|
658
|
+
style: normalizeStyle(`width: ${__props.left}px`)
|
|
659
|
+
}, [
|
|
660
|
+
renderSlot(_ctx.$slots, "left")
|
|
661
|
+
], 6),
|
|
662
|
+
createVNode(_sfc_main$n, { onChange: changeLeft })
|
|
663
|
+
], 64)) : createCommentVNode("", true),
|
|
664
|
+
createElementVNode("div", {
|
|
665
|
+
class: normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
666
|
+
style: normalizeStyle(`width: ${center.value}px`)
|
|
667
|
+
}, [
|
|
668
|
+
renderSlot(_ctx.$slots, "center")
|
|
669
|
+
], 6),
|
|
670
|
+
typeof props.right !== "undefined" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
671
|
+
createVNode(_sfc_main$n, { onChange: changeRight }),
|
|
672
|
+
createElementVNode("div", {
|
|
673
|
+
class: normalizeClass(["m-editor-layout-right", __props.rightClass]),
|
|
674
|
+
style: normalizeStyle(`width: ${__props.right}px`)
|
|
675
|
+
}, [
|
|
676
|
+
renderSlot(_ctx.$slots, "right")
|
|
677
|
+
], 6)
|
|
678
|
+
], 64)) : createCommentVNode("", true)
|
|
679
|
+
], 512);
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
});
|
|
683
|
+
|
|
684
|
+
const _hoisted_1$c = ["src"];
|
|
685
|
+
const __default__$k = defineComponent({
|
|
686
|
+
name: "MEditorIcon"
|
|
687
|
+
});
|
|
688
|
+
const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
689
|
+
...__default__$k,
|
|
690
|
+
props: {
|
|
691
|
+
icon: null
|
|
692
|
+
},
|
|
693
|
+
setup(__props) {
|
|
694
|
+
return (_ctx, _cache) => {
|
|
695
|
+
return !__props.icon ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
696
|
+
key: 0,
|
|
697
|
+
class: "magic-editor-icon"
|
|
698
|
+
}, {
|
|
699
|
+
default: withCtx(() => [
|
|
700
|
+
createVNode(unref(Edit))
|
|
701
|
+
]),
|
|
702
|
+
_: 1
|
|
703
|
+
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (openBlock(), createBlock(unref(TMagicIcon), {
|
|
704
|
+
key: 1,
|
|
705
|
+
class: "magic-editor-icon"
|
|
706
|
+
}, {
|
|
707
|
+
default: withCtx(() => [
|
|
708
|
+
createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$c)
|
|
709
|
+
]),
|
|
710
|
+
_: 1
|
|
711
|
+
})) : typeof __props.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
712
|
+
key: 2,
|
|
713
|
+
class: normalizeClass(["magic-editor-icon", __props.icon])
|
|
714
|
+
}, null, 2)) : (openBlock(), createBlock(unref(TMagicIcon), {
|
|
715
|
+
key: 3,
|
|
716
|
+
class: "magic-editor-icon"
|
|
717
|
+
}, {
|
|
718
|
+
default: withCtx(() => [
|
|
719
|
+
(openBlock(), createBlock(resolveDynamicComponent(toRaw(__props.icon))))
|
|
720
|
+
]),
|
|
721
|
+
_: 1
|
|
722
|
+
}));
|
|
723
|
+
};
|
|
724
|
+
}
|
|
725
|
+
});
|
|
726
|
+
|
|
551
727
|
const log = (...args) => {
|
|
552
728
|
if (process.env.NODE_ENV === "development") {
|
|
553
729
|
console.log("magic editor: ", ...args);
|
|
@@ -736,16 +912,20 @@ class CodeBlock extends BaseService {
|
|
|
736
912
|
}
|
|
737
913
|
async setCodeDslById(id, codeConfig) {
|
|
738
914
|
let codeDsl = await this.getCodeDsl();
|
|
739
|
-
if (!codeDsl)
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
[id]
|
|
745
|
-
|
|
746
|
-
...
|
|
747
|
-
|
|
748
|
-
|
|
915
|
+
if (!codeDsl) {
|
|
916
|
+
codeDsl = {
|
|
917
|
+
[id]: codeConfig
|
|
918
|
+
};
|
|
919
|
+
} else {
|
|
920
|
+
const existContent = codeDsl[id] || {};
|
|
921
|
+
codeDsl = {
|
|
922
|
+
...codeDsl,
|
|
923
|
+
[id]: {
|
|
924
|
+
...existContent,
|
|
925
|
+
...codeConfig
|
|
926
|
+
}
|
|
927
|
+
};
|
|
928
|
+
}
|
|
749
929
|
await this.setCodeDsl(codeDsl);
|
|
750
930
|
}
|
|
751
931
|
async getCodeDslByIds(ids) {
|
|
@@ -1465,7 +1645,7 @@ class Editor$1 extends BaseService {
|
|
|
1465
1645
|
"copy",
|
|
1466
1646
|
"paste",
|
|
1467
1647
|
"doPaste",
|
|
1468
|
-
"
|
|
1648
|
+
"doAlignCenter",
|
|
1469
1649
|
"alignCenter",
|
|
1470
1650
|
"moveLayer",
|
|
1471
1651
|
"moveToContainer",
|
|
@@ -1739,10 +1919,10 @@ class Editor$1 extends BaseService {
|
|
|
1739
1919
|
newConfig = setLayout(newConfig, newLayout);
|
|
1740
1920
|
}
|
|
1741
1921
|
parentNodeItems[index] = newConfig;
|
|
1742
|
-
const nodes = this.get("nodes");
|
|
1922
|
+
const nodes = this.get("nodes") || [];
|
|
1743
1923
|
const targetIndex = nodes.findIndex((nodeItem) => `${nodeItem.id}` === `${newConfig.id}`);
|
|
1744
1924
|
nodes.splice(targetIndex, 1, newConfig);
|
|
1745
|
-
this.set("nodes", nodes);
|
|
1925
|
+
this.set("nodes", [...nodes]);
|
|
1746
1926
|
this.get("stage")?.update({
|
|
1747
1927
|
config: cloneDeep(newConfig),
|
|
1748
1928
|
parentId: parent.id,
|
|
@@ -1824,7 +2004,11 @@ class Editor$1 extends BaseService {
|
|
|
1824
2004
|
const stage = this.get("stage");
|
|
1825
2005
|
const newNodes = await Promise.all(nodes.map((node) => this.doAlignCenter(node)));
|
|
1826
2006
|
const newNode = await this.update(newNodes);
|
|
1827
|
-
|
|
2007
|
+
if (newNodes.length > 1) {
|
|
2008
|
+
await stage?.multiSelect(newNodes.map((node) => node.id));
|
|
2009
|
+
} else {
|
|
2010
|
+
await stage?.select(newNodes[0].id);
|
|
2011
|
+
}
|
|
1828
2012
|
return newNode;
|
|
1829
2013
|
}
|
|
1830
2014
|
async moveLayer(offset) {
|
|
@@ -1929,12 +2113,12 @@ class Editor$1 extends BaseService {
|
|
|
1929
2113
|
const root = this.get("root");
|
|
1930
2114
|
if (!root)
|
|
1931
2115
|
return null;
|
|
1932
|
-
return root.
|
|
2116
|
+
return root.codeBlocks || null;
|
|
1933
2117
|
}
|
|
1934
2118
|
async setCodeDsl(codeDsl) {
|
|
1935
2119
|
if (!this.state.root)
|
|
1936
2120
|
return;
|
|
1937
|
-
this.state.root.
|
|
2121
|
+
this.state.root.codeBlocks = codeDsl;
|
|
1938
2122
|
}
|
|
1939
2123
|
addModifiedNodeId(id) {
|
|
1940
2124
|
if (!this.isHistoryStateChange) {
|
|
@@ -2364,6 +2548,8 @@ const useStage = (stageOptions) => {
|
|
|
2364
2548
|
getGuideLineFromCache(getGuideLineKey(V_GUIDE_LINE_STORAGE_KEY))
|
|
2365
2549
|
]);
|
|
2366
2550
|
stage.on("select", (el) => {
|
|
2551
|
+
if (`${editorService.get("node")?.id}` === el.id && editorService.get("nodes").length === 1)
|
|
2552
|
+
return;
|
|
2367
2553
|
editorService.select(el.id);
|
|
2368
2554
|
});
|
|
2369
2555
|
stage.on("highlight", (el) => {
|
|
@@ -2384,6 +2570,11 @@ const useStage = (stageOptions) => {
|
|
|
2384
2570
|
stage.on("sort", (ev) => {
|
|
2385
2571
|
editorService.sort(ev.src, ev.dist);
|
|
2386
2572
|
});
|
|
2573
|
+
stage.on("select-parent", () => {
|
|
2574
|
+
const parent = editorService.get("parent");
|
|
2575
|
+
editorService.select(parent);
|
|
2576
|
+
editorService.get("stage").select(parent.id);
|
|
2577
|
+
});
|
|
2387
2578
|
stage.on("changeGuides", (e) => {
|
|
2388
2579
|
uiService.set("showGuides", true);
|
|
2389
2580
|
if (!root.value || !page.value)
|
|
@@ -2400,182 +2591,49 @@ const useStage = (stageOptions) => {
|
|
|
2400
2591
|
return stage;
|
|
2401
2592
|
};
|
|
2402
2593
|
|
|
2403
|
-
const _sfc_main$n = defineComponent({
|
|
2404
|
-
components: { Plus },
|
|
2405
|
-
setup() {
|
|
2406
|
-
const services = inject("services");
|
|
2407
|
-
return {
|
|
2408
|
-
clickHandler() {
|
|
2409
|
-
const { editorService } = services || {};
|
|
2410
|
-
if (!editorService)
|
|
2411
|
-
return;
|
|
2412
|
-
editorService.add({
|
|
2413
|
-
type: NodeType.PAGE,
|
|
2414
|
-
name: generatePageNameByApp(toRaw(editorService.get("root")))
|
|
2415
|
-
});
|
|
2416
|
-
}
|
|
2417
|
-
};
|
|
2418
|
-
}
|
|
2419
|
-
});
|
|
2420
|
-
|
|
2421
2594
|
const _hoisted_1$b = { class: "m-editor-empty-panel" };
|
|
2422
2595
|
const _hoisted_2$5 = { class: "m-editor-empty-content" };
|
|
2423
2596
|
const _hoisted_3$2 = /* @__PURE__ */ createElementVNode("p", null, "\u65B0\u589E\u9875\u9762", -1);
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
const _component_el_icon = resolveComponent("el-icon");
|
|
2427
|
-
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
2428
|
-
createElementVNode("div", _hoisted_2$5, [
|
|
2429
|
-
createElementVNode("div", {
|
|
2430
|
-
class: "m-editor-empty-button",
|
|
2431
|
-
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickHandler && _ctx.clickHandler(...args))
|
|
2432
|
-
}, [
|
|
2433
|
-
createElementVNode("div", null, [
|
|
2434
|
-
createVNode(_component_el_icon, null, {
|
|
2435
|
-
default: withCtx(() => [
|
|
2436
|
-
createVNode(_component_plus)
|
|
2437
|
-
]),
|
|
2438
|
-
_: 1
|
|
2439
|
-
})
|
|
2440
|
-
]),
|
|
2441
|
-
_hoisted_3$2
|
|
2442
|
-
])
|
|
2443
|
-
])
|
|
2444
|
-
]);
|
|
2445
|
-
}
|
|
2446
|
-
const AddPageBox = /* @__PURE__ */ _export_sfc(_sfc_main$n, [["render", _sfc_render$5]]);
|
|
2447
|
-
|
|
2448
|
-
const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
2449
|
-
__name: "Resizer",
|
|
2450
|
-
emits: ["change"],
|
|
2451
|
-
setup(__props, { emit }) {
|
|
2452
|
-
const target = ref();
|
|
2453
|
-
let getso;
|
|
2454
|
-
onMounted(() => {
|
|
2455
|
-
if (!target.value)
|
|
2456
|
-
return;
|
|
2457
|
-
getso = new Gesto(target.value, {
|
|
2458
|
-
container: window,
|
|
2459
|
-
pinchOutside: true
|
|
2460
|
-
}).on("drag", (e) => {
|
|
2461
|
-
if (!target.value)
|
|
2462
|
-
return;
|
|
2463
|
-
emit("change", e.deltaX);
|
|
2464
|
-
});
|
|
2465
|
-
});
|
|
2466
|
-
onUnmounted(() => {
|
|
2467
|
-
getso?.unset();
|
|
2468
|
-
});
|
|
2469
|
-
return (_ctx, _cache) => {
|
|
2470
|
-
return openBlock(), createElementBlock("span", {
|
|
2471
|
-
ref_key: "target",
|
|
2472
|
-
ref: target,
|
|
2473
|
-
class: "m-editor-resizer"
|
|
2474
|
-
}, [
|
|
2475
|
-
renderSlot(_ctx.$slots, "default")
|
|
2476
|
-
], 512);
|
|
2477
|
-
};
|
|
2478
|
-
}
|
|
2597
|
+
const __default__$j = defineComponent({
|
|
2598
|
+
name: "MEditorAddPageBox"
|
|
2479
2599
|
});
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
minRight: { default: 1 },
|
|
2488
|
-
leftClass: null,
|
|
2489
|
-
rightClass: null,
|
|
2490
|
-
centerClass: null
|
|
2491
|
-
},
|
|
2492
|
-
emits: ["update:left", "change", "update:right"],
|
|
2493
|
-
setup(__props, { emit }) {
|
|
2494
|
-
const props = __props;
|
|
2495
|
-
const el = ref();
|
|
2496
|
-
let clientWidth = 0;
|
|
2497
|
-
const resizerObserver = new ResizeObserver((entries) => {
|
|
2498
|
-
for (const { contentRect } of entries) {
|
|
2499
|
-
clientWidth = contentRect.width;
|
|
2500
|
-
center.value = clientWidth - (props.left || 0) - (props.right || 0);
|
|
2501
|
-
emit("change", {
|
|
2502
|
-
left: props.left,
|
|
2503
|
-
center: center.value,
|
|
2504
|
-
right: props.right
|
|
2505
|
-
});
|
|
2506
|
-
}
|
|
2507
|
-
});
|
|
2508
|
-
onMounted(() => {
|
|
2509
|
-
if (el.value) {
|
|
2510
|
-
resizerObserver.observe(el.value);
|
|
2511
|
-
}
|
|
2512
|
-
});
|
|
2513
|
-
onUnmounted(() => {
|
|
2514
|
-
resizerObserver.disconnect();
|
|
2515
|
-
});
|
|
2516
|
-
const center = ref(0);
|
|
2517
|
-
const changeLeft = (deltaX) => {
|
|
2518
|
-
if (typeof props.left === "undefined")
|
|
2519
|
-
return;
|
|
2520
|
-
const left = Math.max(props.left + deltaX, props.minLeft) || 0;
|
|
2521
|
-
emit("update:left", left);
|
|
2522
|
-
center.value = clientWidth - left - (props.right || 0);
|
|
2523
|
-
emit("change", {
|
|
2524
|
-
left,
|
|
2525
|
-
center: center.value,
|
|
2526
|
-
right: props.right
|
|
2527
|
-
});
|
|
2528
|
-
};
|
|
2529
|
-
const changeRight = (deltaX) => {
|
|
2530
|
-
if (typeof props.right === "undefined")
|
|
2600
|
+
const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
2601
|
+
...__default__$j,
|
|
2602
|
+
setup(__props) {
|
|
2603
|
+
const services = inject("services");
|
|
2604
|
+
const clickHandler = () => {
|
|
2605
|
+
const { editorService } = services || {};
|
|
2606
|
+
if (!editorService)
|
|
2531
2607
|
return;
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
emit("change", {
|
|
2536
|
-
left: props.left,
|
|
2537
|
-
center: center.value,
|
|
2538
|
-
right
|
|
2608
|
+
editorService.add({
|
|
2609
|
+
type: NodeType.PAGE,
|
|
2610
|
+
name: generatePageNameByApp(toRaw(editorService.get("root")))
|
|
2539
2611
|
});
|
|
2540
2612
|
};
|
|
2541
2613
|
return (_ctx, _cache) => {
|
|
2542
|
-
return openBlock(), createElementBlock("div",
|
|
2543
|
-
|
|
2544
|
-
ref: el,
|
|
2545
|
-
class: "m-editor-layout"
|
|
2546
|
-
}, [
|
|
2547
|
-
typeof props.left !== "undefined" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2548
|
-
createElementVNode("div", {
|
|
2549
|
-
class: normalizeClass(["m-editor-layout-left", __props.leftClass]),
|
|
2550
|
-
style: normalizeStyle(`width: ${__props.left}px`)
|
|
2551
|
-
}, [
|
|
2552
|
-
renderSlot(_ctx.$slots, "left")
|
|
2553
|
-
], 6),
|
|
2554
|
-
createVNode(_sfc_main$m, { onChange: changeLeft })
|
|
2555
|
-
], 64)) : createCommentVNode("", true),
|
|
2556
|
-
createElementVNode("div", {
|
|
2557
|
-
class: normalizeClass(["m-editor-layout-center", __props.centerClass]),
|
|
2558
|
-
style: normalizeStyle(`width: ${center.value}px`)
|
|
2559
|
-
}, [
|
|
2560
|
-
renderSlot(_ctx.$slots, "center")
|
|
2561
|
-
], 6),
|
|
2562
|
-
typeof props.right !== "undefined" ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2563
|
-
createVNode(_sfc_main$m, { onChange: changeRight }),
|
|
2614
|
+
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
2615
|
+
createElementVNode("div", _hoisted_2$5, [
|
|
2564
2616
|
createElementVNode("div", {
|
|
2565
|
-
class:
|
|
2566
|
-
|
|
2617
|
+
class: "m-editor-empty-button",
|
|
2618
|
+
onClick: clickHandler
|
|
2567
2619
|
}, [
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2620
|
+
createElementVNode("div", null, [
|
|
2621
|
+
createVNode(_sfc_main$l, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
2622
|
+
]),
|
|
2623
|
+
_hoisted_3$2
|
|
2624
|
+
])
|
|
2625
|
+
])
|
|
2626
|
+
]);
|
|
2572
2627
|
};
|
|
2573
2628
|
}
|
|
2574
2629
|
});
|
|
2575
2630
|
|
|
2576
2631
|
const _hoisted_1$a = { class: "m-editor" };
|
|
2577
|
-
const
|
|
2578
|
-
|
|
2632
|
+
const __default__$i = defineComponent({
|
|
2633
|
+
name: "MEditorFramework"
|
|
2634
|
+
});
|
|
2635
|
+
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
2636
|
+
...__default__$i,
|
|
2579
2637
|
props: {
|
|
2580
2638
|
codeOptions: { default: () => ({}) }
|
|
2581
2639
|
},
|
|
@@ -2584,47 +2642,63 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2584
2642
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
2585
2643
|
const { editorService, uiService } = inject("services") || {};
|
|
2586
2644
|
const root = computed(() => editorService?.get("root"));
|
|
2645
|
+
const nodes = computed(() => editorService?.get("nodes") || []);
|
|
2587
2646
|
const pageLength = computed(() => editorService?.get("pageLength") || 0);
|
|
2588
2647
|
const showSrc = computed(() => uiService?.get("showSrc"));
|
|
2648
|
+
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
2649
|
+
const RIGHT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorRightColumnWidthData";
|
|
2650
|
+
const leftColumnWidthCacheData = Number(globalThis.localStorage.getItem(LEFT_COLUMN_WIDTH_STORAGE_KEY));
|
|
2651
|
+
const RightColumnWidthCacheData = Number(globalThis.localStorage.getItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY));
|
|
2589
2652
|
const columnWidth = ref({
|
|
2590
|
-
left:
|
|
2653
|
+
left: leftColumnWidthCacheData,
|
|
2591
2654
|
center: 0,
|
|
2592
|
-
right:
|
|
2655
|
+
right: RightColumnWidthCacheData
|
|
2593
2656
|
});
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
columnWidth.value.
|
|
2598
|
-
columnWidth.value.
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2657
|
+
watch(
|
|
2658
|
+
pageLength,
|
|
2659
|
+
(length) => {
|
|
2660
|
+
const left = columnWidth.value.left || DEFAULT_LEFT_COLUMN_WIDTH;
|
|
2661
|
+
columnWidth.value.left = left;
|
|
2662
|
+
if (length <= 0) {
|
|
2663
|
+
columnWidth.value.right = void 0;
|
|
2664
|
+
columnWidth.value.center = globalThis.document.body.clientWidth - left;
|
|
2665
|
+
} else {
|
|
2666
|
+
const right = columnWidth.value.right || RightColumnWidthCacheData || DEFAULT_RIGHT_COLUMN_WIDTH;
|
|
2667
|
+
columnWidth.value.right = right;
|
|
2668
|
+
columnWidth.value.center = globalThis.document.body.clientWidth - left - right;
|
|
2669
|
+
}
|
|
2670
|
+
uiService?.set("columnWidth", columnWidth);
|
|
2671
|
+
},
|
|
2672
|
+
{
|
|
2673
|
+
immediate: true
|
|
2602
2674
|
}
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2675
|
+
);
|
|
2676
|
+
watch(
|
|
2677
|
+
() => columnWidth.value.right,
|
|
2678
|
+
(right) => {
|
|
2679
|
+
if (typeof right === "undefined")
|
|
2680
|
+
return;
|
|
2681
|
+
globalThis.localStorage.setItem(RIGHT_COLUMN_WIDTH_STORAGE_KEY, `${right}`);
|
|
2682
|
+
}
|
|
2683
|
+
);
|
|
2684
|
+
watch(
|
|
2685
|
+
() => columnWidth.value.left,
|
|
2686
|
+
(left) => {
|
|
2687
|
+
globalThis.localStorage.setItem(LEFT_COLUMN_WIDTH_STORAGE_KEY, `${left}`);
|
|
2609
2688
|
}
|
|
2689
|
+
);
|
|
2690
|
+
const columnWidthChange = (columnWidth2) => {
|
|
2691
|
+
uiService?.set("columnWidth", columnWidth2);
|
|
2610
2692
|
};
|
|
2611
|
-
const
|
|
2612
|
-
const columnWidthCacheData = globalThis.localStorage.getItem(COLUMN_WIDTH_STORAGE_KEY);
|
|
2613
|
-
if (columnWidthCacheData) {
|
|
2693
|
+
const saveCode = (value) => {
|
|
2614
2694
|
try {
|
|
2615
|
-
|
|
2616
|
-
columnWidth.value = columnWidthCache;
|
|
2695
|
+
editorService?.set("root", eval(value));
|
|
2617
2696
|
} catch (e) {
|
|
2618
2697
|
console.error(e);
|
|
2619
2698
|
}
|
|
2620
|
-
}
|
|
2621
|
-
const columnWidthChange = (columnWidth2) => {
|
|
2622
|
-
uiService?.set("columnWidth", columnWidth2);
|
|
2623
|
-
globalThis.localStorage.setItem(COLUMN_WIDTH_STORAGE_KEY, JSON.stringify(columnWidth2));
|
|
2624
2699
|
};
|
|
2625
2700
|
return (_ctx, _cache) => {
|
|
2626
2701
|
const _component_magic_code_editor = resolveComponent("magic-code-editor");
|
|
2627
|
-
const _component_el_scrollbar = resolveComponent("el-scrollbar");
|
|
2628
2702
|
return openBlock(), createElementBlock("div", _hoisted_1$a, [
|
|
2629
2703
|
renderSlot(_ctx.$slots, "nav", { class: "m-editor-nav-menu" }),
|
|
2630
2704
|
unref(showSrc) ? (openBlock(), createBlock(_component_magic_code_editor, {
|
|
@@ -2633,7 +2707,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2633
2707
|
"init-values": unref(root),
|
|
2634
2708
|
options: __props.codeOptions,
|
|
2635
2709
|
onSave: saveCode
|
|
2636
|
-
}, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$
|
|
2710
|
+
}, null, 8, ["init-values", "options"])) : (openBlock(), createBlock(_sfc_main$m, {
|
|
2637
2711
|
key: 1,
|
|
2638
2712
|
class: "m-editor-content",
|
|
2639
2713
|
"left-class": "m-editor-framework-left",
|
|
@@ -2652,15 +2726,15 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2652
2726
|
]),
|
|
2653
2727
|
center: withCtx(() => [
|
|
2654
2728
|
unref(pageLength) > 0 ? renderSlot(_ctx.$slots, "workspace", { key: 0 }) : renderSlot(_ctx.$slots, "empty", { key: 1 }, () => [
|
|
2655
|
-
createVNode(
|
|
2729
|
+
createVNode(_sfc_main$k)
|
|
2656
2730
|
])
|
|
2657
2731
|
]),
|
|
2658
2732
|
_: 2
|
|
2659
2733
|
}, [
|
|
2660
|
-
unref(pageLength) > 0 ? {
|
|
2734
|
+
unref(pageLength) > 0 && unref(nodes).length === 1 ? {
|
|
2661
2735
|
name: "right",
|
|
2662
2736
|
fn: withCtx(() => [
|
|
2663
|
-
createVNode(
|
|
2737
|
+
createVNode(unref(TMagicScrollbar), null, {
|
|
2664
2738
|
default: withCtx(() => [
|
|
2665
2739
|
renderSlot(_ctx.$slots, "props-panel")
|
|
2666
2740
|
]),
|
|
@@ -2674,54 +2748,16 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
2674
2748
|
}
|
|
2675
2749
|
});
|
|
2676
2750
|
|
|
2677
|
-
const _hoisted_1$9 =
|
|
2678
|
-
const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
2679
|
-
__name: "Icon",
|
|
2680
|
-
props: {
|
|
2681
|
-
icon: null
|
|
2682
|
-
},
|
|
2683
|
-
setup(__props) {
|
|
2684
|
-
return (_ctx, _cache) => {
|
|
2685
|
-
const _component_el_icon = resolveComponent("el-icon");
|
|
2686
|
-
return !__props.icon ? (openBlock(), createBlock(_component_el_icon, {
|
|
2687
|
-
key: 0,
|
|
2688
|
-
class: "magic-editor-icon"
|
|
2689
|
-
}, {
|
|
2690
|
-
default: withCtx(() => [
|
|
2691
|
-
createVNode(unref(Edit))
|
|
2692
|
-
]),
|
|
2693
|
-
_: 1
|
|
2694
|
-
})) : typeof __props.icon === "string" && __props.icon.startsWith("http") ? (openBlock(), createBlock(_component_el_icon, {
|
|
2695
|
-
key: 1,
|
|
2696
|
-
class: "magic-editor-icon"
|
|
2697
|
-
}, {
|
|
2698
|
-
default: withCtx(() => [
|
|
2699
|
-
createElementVNode("img", { src: __props.icon }, null, 8, _hoisted_1$9)
|
|
2700
|
-
]),
|
|
2701
|
-
_: 1
|
|
2702
|
-
})) : typeof __props.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
2703
|
-
key: 2,
|
|
2704
|
-
class: normalizeClass(["magic-editor-icon", __props.icon])
|
|
2705
|
-
}, null, 2)) : (openBlock(), createBlock(_component_el_icon, {
|
|
2706
|
-
key: 3,
|
|
2707
|
-
class: "magic-editor-icon"
|
|
2708
|
-
}, {
|
|
2709
|
-
default: withCtx(() => [
|
|
2710
|
-
(openBlock(), createBlock(resolveDynamicComponent(toRaw(__props.icon))))
|
|
2711
|
-
]),
|
|
2712
|
-
_: 1
|
|
2713
|
-
}));
|
|
2714
|
-
};
|
|
2715
|
-
}
|
|
2716
|
-
});
|
|
2717
|
-
|
|
2718
|
-
const _hoisted_1$8 = {
|
|
2751
|
+
const _hoisted_1$9 = {
|
|
2719
2752
|
key: 1,
|
|
2720
2753
|
class: "menu-item-text"
|
|
2721
2754
|
};
|
|
2722
2755
|
const _hoisted_2$4 = { class: "el-dropdown-link menubar-menu-button" };
|
|
2756
|
+
const __default__$h = defineComponent({
|
|
2757
|
+
name: "MEditorToolButton"
|
|
2758
|
+
});
|
|
2723
2759
|
const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
2724
|
-
|
|
2760
|
+
...__default__$h,
|
|
2725
2761
|
props: {
|
|
2726
2762
|
data: { default: () => ({
|
|
2727
2763
|
type: "text",
|
|
@@ -2786,13 +2822,6 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2786
2822
|
}
|
|
2787
2823
|
};
|
|
2788
2824
|
return (_ctx, _cache) => {
|
|
2789
|
-
const _component_el_divider = resolveComponent("el-divider");
|
|
2790
|
-
const _component_el_button = resolveComponent("el-button");
|
|
2791
|
-
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
2792
|
-
const _component_el_icon = resolveComponent("el-icon");
|
|
2793
|
-
const _component_el_dropdown_item = resolveComponent("el-dropdown-item");
|
|
2794
|
-
const _component_el_dropdown_menu = resolveComponent("el-dropdown-menu");
|
|
2795
|
-
const _component_el_dropdown = resolveComponent("el-dropdown");
|
|
2796
2825
|
return unref(display) ? (openBlock(), createElementBlock("div", {
|
|
2797
2826
|
key: 0,
|
|
2798
2827
|
class: normalizeClass(["menu-item", `${__props.data.type} ${__props.data.className || ""}`]),
|
|
@@ -2800,24 +2829,24 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2800
2829
|
onMousedown: _cache[1] || (_cache[1] = ($event) => mousedownHandler(__props.data, $event)),
|
|
2801
2830
|
onMouseup: _cache[2] || (_cache[2] = ($event) => mouseupHandler(__props.data, $event))
|
|
2802
2831
|
}, [
|
|
2803
|
-
__props.data.type === "divider" ? (openBlock(), createBlock(
|
|
2832
|
+
__props.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
|
|
2804
2833
|
key: 0,
|
|
2805
2834
|
direction: __props.data.direction || "vertical"
|
|
2806
|
-
}, null, 8, ["direction"])) : __props.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
2807
|
-
__props.data.tooltip ? (openBlock(), createBlock(
|
|
2835
|
+
}, null, 8, ["direction"])) : __props.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$9, toDisplayString(__props.data.text), 1)) : __props.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
2836
|
+
__props.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
2808
2837
|
key: 0,
|
|
2809
2838
|
effect: "dark",
|
|
2810
2839
|
placement: "bottom-start",
|
|
2811
2840
|
content: __props.data.tooltip
|
|
2812
2841
|
}, {
|
|
2813
2842
|
default: withCtx(() => [
|
|
2814
|
-
createVNode(
|
|
2843
|
+
createVNode(unref(TMagicButton), {
|
|
2815
2844
|
size: "small",
|
|
2816
2845
|
text: "",
|
|
2817
2846
|
disabled: unref(disabled)
|
|
2818
2847
|
}, {
|
|
2819
2848
|
default: withCtx(() => [
|
|
2820
|
-
__props.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
2849
|
+
__props.data.icon ? (openBlock(), createBlock(_sfc_main$l, {
|
|
2821
2850
|
key: 0,
|
|
2822
2851
|
icon: __props.data.icon
|
|
2823
2852
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -2827,14 +2856,14 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2827
2856
|
}, 8, ["disabled"])
|
|
2828
2857
|
]),
|
|
2829
2858
|
_: 1
|
|
2830
|
-
}, 8, ["content"])) : (openBlock(), createBlock(
|
|
2859
|
+
}, 8, ["content"])) : (openBlock(), createBlock(unref(TMagicButton), {
|
|
2831
2860
|
key: 1,
|
|
2832
2861
|
size: "small",
|
|
2833
2862
|
text: "",
|
|
2834
2863
|
disabled: unref(disabled)
|
|
2835
2864
|
}, {
|
|
2836
2865
|
default: withCtx(() => [
|
|
2837
|
-
__props.data.icon ? (openBlock(), createBlock(_sfc_main$
|
|
2866
|
+
__props.data.icon ? (openBlock(), createBlock(_sfc_main$l, {
|
|
2838
2867
|
key: 0,
|
|
2839
2868
|
icon: __props.data.icon
|
|
2840
2869
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
@@ -2842,17 +2871,17 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2842
2871
|
]),
|
|
2843
2872
|
_: 1
|
|
2844
2873
|
}, 8, ["disabled"]))
|
|
2845
|
-
], 64)) : __props.data.type === "dropdown" ? (openBlock(), createBlock(
|
|
2874
|
+
], 64)) : __props.data.type === "dropdown" ? (openBlock(), createBlock(unref(TMagicDropdown), {
|
|
2846
2875
|
key: 3,
|
|
2847
2876
|
trigger: "click",
|
|
2848
2877
|
disabled: unref(disabled),
|
|
2849
2878
|
onCommand: dropdownHandler
|
|
2850
2879
|
}, {
|
|
2851
2880
|
dropdown: withCtx(() => [
|
|
2852
|
-
__props.data.items && __props.data.items.length ? (openBlock(), createBlock(
|
|
2881
|
+
__props.data.items && __props.data.items.length ? (openBlock(), createBlock(unref(TMagicDropdownMenu), { key: 0 }, {
|
|
2853
2882
|
default: withCtx(() => [
|
|
2854
2883
|
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.data.items, (subItem, index) => {
|
|
2855
|
-
return openBlock(), createBlock(
|
|
2884
|
+
return openBlock(), createBlock(unref(TMagicDropdownItem), {
|
|
2856
2885
|
key: index,
|
|
2857
2886
|
command: { data: __props.data, subItem }
|
|
2858
2887
|
}, {
|
|
@@ -2869,7 +2898,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2869
2898
|
default: withCtx(() => [
|
|
2870
2899
|
createElementVNode("span", _hoisted_2$4, [
|
|
2871
2900
|
createTextVNode(toDisplayString(__props.data.text), 1),
|
|
2872
|
-
createVNode(
|
|
2901
|
+
createVNode(unref(TMagicIcon), { class: "el-icon--right" }, {
|
|
2873
2902
|
default: withCtx(() => [
|
|
2874
2903
|
createVNode(unref(ArrowDown))
|
|
2875
2904
|
]),
|
|
@@ -2884,8 +2913,11 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
2884
2913
|
}
|
|
2885
2914
|
});
|
|
2886
2915
|
|
|
2916
|
+
const __default__$g = defineComponent({
|
|
2917
|
+
name: "MEditorNavMenu"
|
|
2918
|
+
});
|
|
2887
2919
|
const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
2888
|
-
|
|
2920
|
+
...__default__$g,
|
|
2889
2921
|
props: {
|
|
2890
2922
|
data: { default: () => ({}) },
|
|
2891
2923
|
height: { default: 35 }
|
|
@@ -3052,9 +3084,12 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
3052
3084
|
}
|
|
3053
3085
|
});
|
|
3054
3086
|
|
|
3055
|
-
const _hoisted_1$
|
|
3087
|
+
const _hoisted_1$8 = { class: "m-editor-props-panel" };
|
|
3088
|
+
const __default__$f = defineComponent({
|
|
3089
|
+
name: "MEditorPropsPanel"
|
|
3090
|
+
});
|
|
3056
3091
|
const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
3057
|
-
|
|
3092
|
+
...__default__$f,
|
|
3058
3093
|
emits: ["mounted"],
|
|
3059
3094
|
setup(__props, { expose, emit }) {
|
|
3060
3095
|
const internalInstance = getCurrentInstance();
|
|
@@ -3090,19 +3125,14 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3090
3125
|
services?.editorService.update(values2);
|
|
3091
3126
|
} catch (e) {
|
|
3092
3127
|
console.error(e);
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
duration: 1e4,
|
|
3096
|
-
showClose: true,
|
|
3097
|
-
message: e.message,
|
|
3098
|
-
dangerouslyUseHTMLString: true
|
|
3099
|
-
});
|
|
3128
|
+
tMagicMessage.closeAll();
|
|
3129
|
+
tMagicMessage.error(e.message);
|
|
3100
3130
|
}
|
|
3101
3131
|
};
|
|
3102
3132
|
expose({ submit });
|
|
3103
3133
|
return (_ctx, _cache) => {
|
|
3104
3134
|
const _component_m_form = resolveComponent("m-form");
|
|
3105
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3135
|
+
return openBlock(), createElementBlock("div", _hoisted_1$8, [
|
|
3106
3136
|
renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3107
3137
|
createVNode(_component_m_form, {
|
|
3108
3138
|
ref_key: "configForm",
|
|
@@ -3119,7 +3149,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
3119
3149
|
}
|
|
3120
3150
|
});
|
|
3121
3151
|
|
|
3122
|
-
const _hoisted_1$
|
|
3152
|
+
const _hoisted_1$7 = ["id"];
|
|
3123
3153
|
const _hoisted_2$3 = { class: "list-item" };
|
|
3124
3154
|
const _hoisted_3$1 = { class: "code-name" };
|
|
3125
3155
|
const _hoisted_4$1 = { class: "code-name-wrapper" };
|
|
@@ -3136,8 +3166,11 @@ const _hoisted_10 = {
|
|
|
3136
3166
|
class: "m-editor-content-bottom"
|
|
3137
3167
|
};
|
|
3138
3168
|
const _hoisted_11 = /* @__PURE__ */ createTextVNode("\u5173\u95ED");
|
|
3169
|
+
const __default__$e = defineComponent({
|
|
3170
|
+
name: "MEditorCodeBlockEditor"
|
|
3171
|
+
});
|
|
3139
3172
|
const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
3140
|
-
|
|
3173
|
+
...__default__$e,
|
|
3141
3174
|
setup(__props) {
|
|
3142
3175
|
const services = inject("services");
|
|
3143
3176
|
const codeEditor = ref();
|
|
@@ -3165,8 +3198,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3165
3198
|
forIn(codeDsl, (value, key) => {
|
|
3166
3199
|
state.codeList.push({
|
|
3167
3200
|
id: key,
|
|
3168
|
-
name: value.name
|
|
3169
|
-
content: value.content
|
|
3201
|
+
name: value.name
|
|
3170
3202
|
});
|
|
3171
3203
|
});
|
|
3172
3204
|
currentTitle.value = state.codeList[0]?.name || "";
|
|
@@ -3178,14 +3210,14 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3178
3210
|
const codeContent = codeEditor.value.getEditor()?.getValue();
|
|
3179
3211
|
codeConfig.value.content = eval(codeContent);
|
|
3180
3212
|
} catch (e) {
|
|
3181
|
-
|
|
3213
|
+
tMagicMessage.error(e.stack);
|
|
3182
3214
|
return false;
|
|
3183
3215
|
}
|
|
3184
3216
|
await services?.codeBlockService.setCodeDslById(id.value, {
|
|
3185
3217
|
name: codeConfig.value.name,
|
|
3186
3218
|
content: codeConfig.value.content
|
|
3187
3219
|
});
|
|
3188
|
-
|
|
3220
|
+
tMagicMessage.success("\u4EE3\u7801\u4FDD\u5B58\u6210\u529F");
|
|
3189
3221
|
return true;
|
|
3190
3222
|
};
|
|
3191
3223
|
const saveAndClose = async () => {
|
|
@@ -3199,22 +3231,17 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3199
3231
|
currentTitle.value = data.name;
|
|
3200
3232
|
};
|
|
3201
3233
|
return (_ctx, _cache) => {
|
|
3202
|
-
|
|
3203
|
-
const _component_el_input = resolveComponent("el-input");
|
|
3204
|
-
const _component_el_button = resolveComponent("el-button");
|
|
3205
|
-
const _component_el_card = resolveComponent("el-card");
|
|
3206
|
-
const _component_el_dialog = resolveComponent("el-dialog");
|
|
3207
|
-
return openBlock(), createBlock(_component_el_dialog, {
|
|
3234
|
+
return openBlock(), createBlock(unref(TMagicDialog), {
|
|
3208
3235
|
modelValue: unref(isShowCodeBlockEditor),
|
|
3209
3236
|
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(isShowCodeBlockEditor) ? isShowCodeBlockEditor.value = $event : null),
|
|
3237
|
+
class: "code-editor-dialog",
|
|
3210
3238
|
title: currentTitle.value,
|
|
3211
3239
|
fullscreen: true,
|
|
3212
3240
|
"before-close": saveAndClose,
|
|
3213
|
-
"append-to-body": true
|
|
3214
|
-
"custom-class": "code-editor-dialog"
|
|
3241
|
+
"append-to-body": true
|
|
3215
3242
|
}, {
|
|
3216
3243
|
default: withCtx(() => [
|
|
3217
|
-
createVNode(_sfc_main$
|
|
3244
|
+
createVNode(_sfc_main$m, {
|
|
3218
3245
|
left: left.value,
|
|
3219
3246
|
"onUpdate:left": _cache[1] || (_cache[1] = ($event) => left.value = $event),
|
|
3220
3247
|
"min-left": 45,
|
|
@@ -3228,11 +3255,11 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3228
3255
|
])
|
|
3229
3256
|
}, [
|
|
3230
3257
|
renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: unref(id) }),
|
|
3231
|
-
createVNode(
|
|
3258
|
+
createVNode(unref(TMagicCard), { shadow: "never" }, {
|
|
3232
3259
|
header: withCtx(() => [
|
|
3233
3260
|
createElementVNode("div", _hoisted_4$1, [
|
|
3234
3261
|
_hoisted_5$1,
|
|
3235
|
-
codeConfig.value ? (openBlock(), createBlock(
|
|
3262
|
+
codeConfig.value ? (openBlock(), createBlock(unref(TMagicInput), {
|
|
3236
3263
|
key: 0,
|
|
3237
3264
|
class: "code-name-input",
|
|
3238
3265
|
modelValue: codeConfig.value.name,
|
|
@@ -3243,7 +3270,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3243
3270
|
]),
|
|
3244
3271
|
default: withCtx(() => [
|
|
3245
3272
|
createElementVNode("div", _hoisted_6$1, [
|
|
3246
|
-
codeConfig.value ? (openBlock(), createBlock(
|
|
3273
|
+
codeConfig.value ? (openBlock(), createBlock(_sfc_main$o, {
|
|
3247
3274
|
key: 0,
|
|
3248
3275
|
ref_key: "codeEditor",
|
|
3249
3276
|
ref: codeEditor,
|
|
@@ -3258,7 +3285,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3258
3285
|
}
|
|
3259
3286
|
}, null, 8, ["init-values", "options"])) : createCommentVNode("", true),
|
|
3260
3287
|
unref(editable) ? (openBlock(), createElementBlock("div", _hoisted_7$1, [
|
|
3261
|
-
createVNode(
|
|
3288
|
+
createVNode(unref(TMagicButton), {
|
|
3262
3289
|
type: "primary",
|
|
3263
3290
|
class: "button",
|
|
3264
3291
|
onClick: saveCode
|
|
@@ -3268,7 +3295,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3268
3295
|
]),
|
|
3269
3296
|
_: 1
|
|
3270
3297
|
}),
|
|
3271
|
-
createVNode(
|
|
3298
|
+
createVNode(unref(TMagicButton), {
|
|
3272
3299
|
type: "primary",
|
|
3273
3300
|
class: "button",
|
|
3274
3301
|
onClick: saveAndClose
|
|
@@ -3279,7 +3306,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3279
3306
|
_: 1
|
|
3280
3307
|
})
|
|
3281
3308
|
])) : (openBlock(), createElementBlock("div", _hoisted_10, [
|
|
3282
|
-
createVNode(
|
|
3309
|
+
createVNode(unref(TMagicButton), {
|
|
3283
3310
|
type: "primary",
|
|
3284
3311
|
class: "button",
|
|
3285
3312
|
onClick: saveAndClose
|
|
@@ -3301,16 +3328,15 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3301
3328
|
unref(mode) === unref(CodeEditorMode).LIST ? {
|
|
3302
3329
|
name: "left",
|
|
3303
3330
|
fn: withCtx(() => [
|
|
3304
|
-
!unref(isEmpty)(state.codeList) ? (openBlock(), createBlock(
|
|
3331
|
+
!unref(isEmpty)(state.codeList) ? (openBlock(), createBlock(unref(TMagicTree), {
|
|
3305
3332
|
key: 0,
|
|
3306
|
-
|
|
3333
|
+
class: "side-tree",
|
|
3307
3334
|
"node-key": "id",
|
|
3308
3335
|
"empty-text": "\u6682\u65E0\u4EE3\u7801\u5757",
|
|
3309
3336
|
data: state.codeList,
|
|
3310
3337
|
"highlight-current": true,
|
|
3311
|
-
onNodeClick: selectHandler,
|
|
3312
3338
|
"current-node-key": state.codeList[0].id,
|
|
3313
|
-
|
|
3339
|
+
onNodeClick: selectHandler
|
|
3314
3340
|
}, {
|
|
3315
3341
|
default: withCtx(({ data }) => [
|
|
3316
3342
|
createElementVNode("div", {
|
|
@@ -3320,7 +3346,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3320
3346
|
createElementVNode("div", _hoisted_2$3, [
|
|
3321
3347
|
createElementVNode("div", _hoisted_3$1, toDisplayString(data.name) + "\uFF08" + toDisplayString(data.id) + "\uFF09", 1)
|
|
3322
3348
|
])
|
|
3323
|
-
], 8, _hoisted_1$
|
|
3349
|
+
], 8, _hoisted_1$7)
|
|
3324
3350
|
]),
|
|
3325
3351
|
_: 1
|
|
3326
3352
|
}, 8, ["data", "current-node-key"])) : createCommentVNode("", true)
|
|
@@ -3334,7 +3360,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
3334
3360
|
}
|
|
3335
3361
|
});
|
|
3336
3362
|
|
|
3337
|
-
const _hoisted_1$
|
|
3363
|
+
const _hoisted_1$6 = { class: "m-editor-code-block-list" };
|
|
3338
3364
|
const _hoisted_2$2 = { class: "code-header-wrapper" };
|
|
3339
3365
|
const _hoisted_3 = /* @__PURE__ */ createTextVNode("\u65B0\u589E");
|
|
3340
3366
|
const _hoisted_4 = ["id"];
|
|
@@ -3356,8 +3382,11 @@ const _hoisted_9 = /* @__PURE__ */ createElementVNode("svg", {
|
|
|
3356
3382
|
d: "M609.408 149.376 277.76 489.6a32 32 0 0 0 0 44.672l331.648 340.352a29.12 29.12 0 0 0 41.728 0 30.592 30.592 0 0 0 0-42.752L339.264 511.936l311.872-319.872a30.592 30.592 0 0 0 0-42.688 29.12 29.12 0 0 0-41.728 0z"
|
|
3357
3383
|
})
|
|
3358
3384
|
], -1);
|
|
3385
|
+
const __default__$d = defineComponent({
|
|
3386
|
+
name: "MEditorCodeBlockList"
|
|
3387
|
+
});
|
|
3359
3388
|
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
3360
|
-
|
|
3389
|
+
...__default__$d,
|
|
3361
3390
|
props: {
|
|
3362
3391
|
customError: null
|
|
3363
3392
|
},
|
|
@@ -3393,7 +3422,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3393
3422
|
state.codeList.push({
|
|
3394
3423
|
id: codeId,
|
|
3395
3424
|
name: value.name,
|
|
3396
|
-
|
|
3425
|
+
codeBlockContent: value,
|
|
3397
3426
|
showRelation: true
|
|
3398
3427
|
});
|
|
3399
3428
|
});
|
|
@@ -3425,7 +3454,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3425
3454
|
const createCodeBlock = async () => {
|
|
3426
3455
|
const { codeBlockService } = services || {};
|
|
3427
3456
|
if (!codeBlockService) {
|
|
3428
|
-
|
|
3457
|
+
tMagicMessage.error("\u65B0\u589E\u4EE3\u7801\u5757\u5931\u8D25");
|
|
3429
3458
|
return;
|
|
3430
3459
|
}
|
|
3431
3460
|
const codeConfig = {
|
|
@@ -3452,7 +3481,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3452
3481
|
if (typeof props.customError === "function") {
|
|
3453
3482
|
props.customError(key, existBinds ? CodeDeleteErrorType.BIND : CodeDeleteErrorType.UNDELETEABLE);
|
|
3454
3483
|
} else {
|
|
3455
|
-
|
|
3484
|
+
tMagicMessage.error("\u4EE3\u7801\u5757\u5220\u9664\u5931\u8D25");
|
|
3456
3485
|
}
|
|
3457
3486
|
}
|
|
3458
3487
|
};
|
|
@@ -3484,14 +3513,10 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3484
3513
|
stage?.select(compId);
|
|
3485
3514
|
};
|
|
3486
3515
|
return (_ctx, _cache) => {
|
|
3487
|
-
|
|
3488
|
-
const _component_el_button = resolveComponent("el-button");
|
|
3489
|
-
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
3490
|
-
const _component_el_tree = resolveComponent("el-tree");
|
|
3491
|
-
return openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
3516
|
+
return openBlock(), createElementBlock("div", _hoisted_1$6, [
|
|
3492
3517
|
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
3493
3518
|
createElementVNode("div", _hoisted_2$2, [
|
|
3494
|
-
createVNode(
|
|
3519
|
+
createVNode(unref(TMagicInput), {
|
|
3495
3520
|
class: normalizeClass([unref(editable) ? "code-filter-input" : "code-filter-input-no-btn"]),
|
|
3496
3521
|
size: "small",
|
|
3497
3522
|
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
@@ -3500,7 +3525,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3500
3525
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
3501
3526
|
onInput: filterTextChangeHandler
|
|
3502
3527
|
}, null, 8, ["class", "modelValue"]),
|
|
3503
|
-
unref(editable) ? (openBlock(), createBlock(
|
|
3528
|
+
unref(editable) ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
3504
3529
|
key: 0,
|
|
3505
3530
|
class: "create-code-button",
|
|
3506
3531
|
type: "primary",
|
|
@@ -3514,7 +3539,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3514
3539
|
})) : createCommentVNode("", true)
|
|
3515
3540
|
])
|
|
3516
3541
|
]),
|
|
3517
|
-
!unref(isEmpty)(state.codeList) ? (openBlock(), createBlock(
|
|
3542
|
+
!unref(isEmpty)(state.codeList) ? (openBlock(), createBlock(unref(TMagicTree), {
|
|
3518
3543
|
key: 0,
|
|
3519
3544
|
ref_key: "tree",
|
|
3520
3545
|
ref: tree,
|
|
@@ -3533,13 +3558,13 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3533
3558
|
createElementVNode("div", _hoisted_5, [
|
|
3534
3559
|
createElementVNode("div", _hoisted_6, toDisplayString(data.name) + "\uFF08" + toDisplayString(data.id) + "\uFF09", 1),
|
|
3535
3560
|
createElementVNode("div", _hoisted_7, [
|
|
3536
|
-
createVNode(
|
|
3561
|
+
createVNode(unref(TMagicTooltip), {
|
|
3537
3562
|
effect: "dark",
|
|
3538
3563
|
content: unref(editable) ? "\u7F16\u8F91" : "\u67E5\u770B",
|
|
3539
3564
|
placement: "bottom"
|
|
3540
3565
|
}, {
|
|
3541
3566
|
default: withCtx(() => [
|
|
3542
|
-
createVNode(_sfc_main$
|
|
3567
|
+
createVNode(_sfc_main$l, {
|
|
3543
3568
|
icon: unref(editable) ? unref(Edit) : unref(View),
|
|
3544
3569
|
class: "edit-icon",
|
|
3545
3570
|
onClick: withModifiers(($event) => editCode(`${data.id}`), ["stop"])
|
|
@@ -3547,14 +3572,14 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3547
3572
|
]),
|
|
3548
3573
|
_: 2
|
|
3549
3574
|
}, 1032, ["content"]),
|
|
3550
|
-
state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (openBlock(), createBlock(
|
|
3575
|
+
state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
3551
3576
|
key: 0,
|
|
3552
3577
|
effect: "dark",
|
|
3553
3578
|
content: "\u67E5\u770B\u7ED1\u5B9A\u5173\u7CFB",
|
|
3554
3579
|
placement: "bottom"
|
|
3555
3580
|
}, {
|
|
3556
3581
|
default: withCtx(() => [
|
|
3557
|
-
createVNode(_sfc_main$
|
|
3582
|
+
createVNode(_sfc_main$l, {
|
|
3558
3583
|
icon: unref(Link),
|
|
3559
3584
|
class: "edit-icon",
|
|
3560
3585
|
onClick: withModifiers(($event) => toggleCombineRelation(data), ["stop"])
|
|
@@ -3562,14 +3587,14 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3562
3587
|
]),
|
|
3563
3588
|
_: 2
|
|
3564
3589
|
}, 1024)) : createCommentVNode("", true),
|
|
3565
|
-
unref(editable) ? (openBlock(), createBlock(
|
|
3590
|
+
unref(editable) ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
3566
3591
|
key: 1,
|
|
3567
3592
|
effect: "dark",
|
|
3568
3593
|
content: "\u5220\u9664",
|
|
3569
3594
|
placement: "bottom"
|
|
3570
3595
|
}, {
|
|
3571
3596
|
default: withCtx(() => [
|
|
3572
|
-
createVNode(_sfc_main$
|
|
3597
|
+
createVNode(_sfc_main$l, {
|
|
3573
3598
|
icon: unref(Close),
|
|
3574
3599
|
class: "edit-icon",
|
|
3575
3600
|
onClick: withModifiers(($event) => deleteCode(`${data.id}`), ["stop"])
|
|
@@ -3578,14 +3603,15 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3578
3603
|
_: 2
|
|
3579
3604
|
}, 1024)) : createCommentVNode("", true),
|
|
3580
3605
|
renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
3581
|
-
id: data.id
|
|
3606
|
+
id: data.id,
|
|
3607
|
+
data: data.codeBlockContent
|
|
3582
3608
|
})
|
|
3583
3609
|
])
|
|
3584
3610
|
]),
|
|
3585
3611
|
data.showRelation && state.bindComps[data.id] && state.bindComps[data.id].length > 0 ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
3586
3612
|
_hoisted_9,
|
|
3587
3613
|
(openBlock(true), createElementBlock(Fragment, null, renderList(state.bindComps[data.id], (comp, index) => {
|
|
3588
|
-
return openBlock(), createBlock(
|
|
3614
|
+
return openBlock(), createBlock(unref(TMagicButton), {
|
|
3589
3615
|
key: index,
|
|
3590
3616
|
class: "code-comp",
|
|
3591
3617
|
size: "small",
|
|
@@ -3614,10 +3640,12 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
3614
3640
|
}
|
|
3615
3641
|
});
|
|
3616
3642
|
|
|
3617
|
-
const _hoisted_1$
|
|
3618
|
-
const
|
|
3643
|
+
const _hoisted_1$5 = ["onClick", "onDragstart"];
|
|
3644
|
+
const __default__$c = defineComponent({
|
|
3645
|
+
name: "MEditorComponentListPanel"
|
|
3646
|
+
});
|
|
3619
3647
|
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
3620
|
-
|
|
3648
|
+
...__default__$c,
|
|
3621
3649
|
setup(__props) {
|
|
3622
3650
|
const searchText = ref("");
|
|
3623
3651
|
const services = inject("services");
|
|
@@ -3630,7 +3658,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3630
3658
|
}))
|
|
3631
3659
|
);
|
|
3632
3660
|
const collapseValue = computed(
|
|
3633
|
-
() => Array(list.value?.length).fill(1).map((x, i) => i)
|
|
3661
|
+
() => Array(list.value?.length).fill(1).map((x, i) => `${i}`)
|
|
3634
3662
|
);
|
|
3635
3663
|
let timeout;
|
|
3636
3664
|
let clientX;
|
|
@@ -3682,36 +3710,31 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3682
3710
|
timeout = stage.value.getAddContainerHighlightClassNameTimeout(e);
|
|
3683
3711
|
};
|
|
3684
3712
|
return (_ctx, _cache) => {
|
|
3685
|
-
|
|
3686
|
-
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
3687
|
-
const _component_el_collapse_item = resolveComponent("el-collapse-item");
|
|
3688
|
-
const _component_el_collapse = resolveComponent("el-collapse");
|
|
3689
|
-
const _component_el_scrollbar = resolveComponent("el-scrollbar");
|
|
3690
|
-
return openBlock(), createBlock(_component_el_scrollbar, null, {
|
|
3713
|
+
return openBlock(), createBlock(unref(TMagicScrollbar), null, {
|
|
3691
3714
|
default: withCtx(() => [
|
|
3692
3715
|
renderSlot(_ctx.$slots, "component-list-panel-header"),
|
|
3693
|
-
createVNode(
|
|
3716
|
+
createVNode(unref(TMagicCollapse), {
|
|
3694
3717
|
class: "ui-component-panel",
|
|
3695
3718
|
"model-value": unref(collapseValue)
|
|
3696
3719
|
}, {
|
|
3697
3720
|
default: withCtx(() => [
|
|
3698
|
-
createVNode(
|
|
3699
|
-
"prefix-icon": "el-icon-search",
|
|
3721
|
+
createVNode(unref(TMagicInput), {
|
|
3700
3722
|
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
3701
3723
|
class: "search-input",
|
|
3702
3724
|
size: "small",
|
|
3703
3725
|
clearable: "",
|
|
3726
|
+
"prefix-icon": unref(Search),
|
|
3704
3727
|
modelValue: searchText.value,
|
|
3705
3728
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => searchText.value = $event)
|
|
3706
|
-
}, null, 8, ["modelValue"]),
|
|
3729
|
+
}, null, 8, ["prefix-icon", "modelValue"]),
|
|
3707
3730
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(list), (group, index) => {
|
|
3708
3731
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
3709
|
-
group.items && group.items.length ? (openBlock(), createBlock(
|
|
3732
|
+
group.items && group.items.length ? (openBlock(), createBlock(unref(TMagicCollapseItem), {
|
|
3710
3733
|
key: index,
|
|
3711
|
-
name: index
|
|
3734
|
+
name: `${index}`
|
|
3712
3735
|
}, {
|
|
3713
3736
|
title: withCtx(() => [
|
|
3714
|
-
|
|
3737
|
+
createVNode(_sfc_main$l, { icon: unref(Grid) }, null, 8, ["icon"]),
|
|
3715
3738
|
createTextVNode(toDisplayString(group.title), 1)
|
|
3716
3739
|
]),
|
|
3717
3740
|
default: withCtx(() => [
|
|
@@ -3726,10 +3749,10 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3726
3749
|
onDrag: dragHandler
|
|
3727
3750
|
}, [
|
|
3728
3751
|
renderSlot(_ctx.$slots, "component-list-item", { component: item }, () => [
|
|
3729
|
-
createVNode(_sfc_main$
|
|
3752
|
+
createVNode(_sfc_main$l, {
|
|
3730
3753
|
icon: item.icon
|
|
3731
3754
|
}, null, 8, ["icon"]),
|
|
3732
|
-
createVNode(
|
|
3755
|
+
createVNode(unref(TMagicTooltip), {
|
|
3733
3756
|
effect: "dark",
|
|
3734
3757
|
placement: "bottom",
|
|
3735
3758
|
content: item.text
|
|
@@ -3740,7 +3763,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3740
3763
|
_: 2
|
|
3741
3764
|
}, 1032, ["content"])
|
|
3742
3765
|
])
|
|
3743
|
-
], 40,
|
|
3766
|
+
], 40, _hoisted_1$5);
|
|
3744
3767
|
}), 128))
|
|
3745
3768
|
]),
|
|
3746
3769
|
_: 2
|
|
@@ -3757,8 +3780,11 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
3757
3780
|
}
|
|
3758
3781
|
});
|
|
3759
3782
|
|
|
3783
|
+
const __default__$b = defineComponent({
|
|
3784
|
+
name: "MEditorContentMenu"
|
|
3785
|
+
});
|
|
3760
3786
|
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
3761
|
-
|
|
3787
|
+
...__default__$b,
|
|
3762
3788
|
props: {
|
|
3763
3789
|
menuData: { default: () => [] },
|
|
3764
3790
|
isSubMenu: { type: Boolean, default: false }
|
|
@@ -3837,7 +3863,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
3837
3863
|
});
|
|
3838
3864
|
return (_ctx, _cache) => {
|
|
3839
3865
|
const _component_content_menu = resolveComponent("content-menu", true);
|
|
3840
|
-
return __props.menuData.length
|
|
3866
|
+
return __props.menuData.length ? withDirectives((openBlock(), createElementBlock("div", {
|
|
3841
3867
|
key: 0,
|
|
3842
3868
|
class: "magic-editor-content-menu",
|
|
3843
3869
|
ref_key: "menu",
|
|
@@ -3865,21 +3891,29 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
|
3865
3891
|
onHide: hide
|
|
3866
3892
|
}, null, 8, ["menu-data"])
|
|
3867
3893
|
]))
|
|
3868
|
-
], 4))
|
|
3894
|
+
], 4)), [
|
|
3895
|
+
[vShow, visible.value]
|
|
3896
|
+
]) : createCommentVNode("", true);
|
|
3869
3897
|
};
|
|
3870
3898
|
}
|
|
3871
3899
|
});
|
|
3872
3900
|
|
|
3873
|
-
const
|
|
3874
|
-
|
|
3875
|
-
|
|
3901
|
+
const __default__$a = defineComponent({
|
|
3902
|
+
name: "MEditorLayerMenu"
|
|
3903
|
+
});
|
|
3904
|
+
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
3905
|
+
...__default__$a,
|
|
3906
|
+
props: {
|
|
3907
|
+
layerContentMenu: null
|
|
3908
|
+
},
|
|
3909
|
+
setup(__props, { expose }) {
|
|
3910
|
+
const props = __props;
|
|
3876
3911
|
const services = inject("services");
|
|
3877
3912
|
const menu = ref();
|
|
3878
3913
|
const node = computed(() => services?.editorService.get("node"));
|
|
3879
3914
|
const isRoot = computed(() => node.value?.type === NodeType.ROOT);
|
|
3880
3915
|
const isPage = computed(() => node.value?.type === NodeType.PAGE);
|
|
3881
3916
|
const componentList = computed(() => services?.componentListService.getList() || []);
|
|
3882
|
-
const layerContentMenu = inject("layerContentMenu", []);
|
|
3883
3917
|
const createMenuItems = (group) => group.items.map((component) => ({
|
|
3884
3918
|
text: component.text,
|
|
3885
3919
|
type: "button",
|
|
@@ -3923,533 +3957,575 @@ const _sfc_main$b = defineComponent({
|
|
|
3923
3957
|
}
|
|
3924
3958
|
return [];
|
|
3925
3959
|
});
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3960
|
+
const menuData = computed(() => [
|
|
3961
|
+
{
|
|
3962
|
+
type: "button",
|
|
3963
|
+
text: "\u65B0\u589E",
|
|
3964
|
+
icon: markRaw(Plus),
|
|
3965
|
+
display: () => node.value?.items,
|
|
3966
|
+
items: getSubMenuData.value
|
|
3967
|
+
},
|
|
3968
|
+
{
|
|
3969
|
+
type: "button",
|
|
3970
|
+
text: "\u590D\u5236",
|
|
3971
|
+
icon: markRaw(DocumentCopy),
|
|
3972
|
+
display: () => !isRoot.value,
|
|
3973
|
+
handler: () => {
|
|
3974
|
+
node.value && services?.editorService.copy(node.value);
|
|
3975
|
+
}
|
|
3976
|
+
},
|
|
3977
|
+
{
|
|
3978
|
+
type: "button",
|
|
3979
|
+
text: "\u5220\u9664",
|
|
3980
|
+
icon: markRaw(Delete),
|
|
3981
|
+
display: () => !isRoot.value && !isPage.value,
|
|
3982
|
+
handler: () => {
|
|
3983
|
+
node.value && services?.editorService.remove(node.value);
|
|
3984
|
+
}
|
|
3985
|
+
},
|
|
3986
|
+
...props.layerContentMenu
|
|
3987
|
+
]);
|
|
3988
|
+
const show = (e) => {
|
|
3989
|
+
menu.value?.show(e);
|
|
3990
|
+
};
|
|
3991
|
+
expose({
|
|
3992
|
+
show
|
|
3993
|
+
});
|
|
3994
|
+
return (_ctx, _cache) => {
|
|
3995
|
+
return openBlock(), createBlock(_sfc_main$c, {
|
|
3996
|
+
"menu-data": unref(menuData),
|
|
3997
|
+
ref_key: "menu",
|
|
3998
|
+
ref: menu,
|
|
3999
|
+
style: { "overflow": "initial" }
|
|
4000
|
+
}, null, 8, ["menu-data"]);
|
|
4001
|
+
};
|
|
4002
|
+
}
|
|
4003
|
+
});
|
|
4004
|
+
|
|
4005
|
+
const _hoisted_1$4 = ["id", "onMouseenter"];
|
|
4006
|
+
const __default__$9 = defineComponent({
|
|
4007
|
+
name: "MEditorLayerPanel"
|
|
4008
|
+
});
|
|
4009
|
+
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
4010
|
+
...__default__$9,
|
|
4011
|
+
props: {
|
|
4012
|
+
layerContentMenu: null
|
|
4013
|
+
},
|
|
4014
|
+
setup(__props) {
|
|
4015
|
+
const throttleTime = 150;
|
|
4016
|
+
const services = inject("services");
|
|
4017
|
+
const tree = ref();
|
|
4018
|
+
const menu = ref();
|
|
4019
|
+
const editorService = services?.editorService;
|
|
4020
|
+
const page = computed(() => editorService?.get("page"));
|
|
4021
|
+
const values = computed(() => page.value ? [page.value] : []);
|
|
4022
|
+
const selectedNodes = ref([]);
|
|
4023
|
+
const selectedIds = computed(() => selectedNodes.value.map((node) => node.id));
|
|
4024
|
+
const isMultiSelectStatus = ref(false);
|
|
4025
|
+
const spliceNodeKey = ref();
|
|
4026
|
+
const filterText = ref("");
|
|
4027
|
+
const defaultExpandedKeys = computed(() => selectedIds.value.length > 0 ? selectedIds.value : []);
|
|
4028
|
+
editorService?.on("remove", () => {
|
|
4029
|
+
setTimeout(() => {
|
|
4030
|
+
tree.value?.getNode(editorService.get("node").id)?.updateChildren();
|
|
4031
|
+
}, 0);
|
|
4032
|
+
});
|
|
4033
|
+
const select = async (data) => {
|
|
4034
|
+
if (!data.id) {
|
|
4035
|
+
throw new Error("\u6CA1\u6709id");
|
|
4036
|
+
}
|
|
4037
|
+
await editorService?.select(data);
|
|
4038
|
+
editorService?.get("stage")?.select(data.id);
|
|
4039
|
+
};
|
|
4040
|
+
const multiSelect = async (data) => {
|
|
4041
|
+
await editorService?.multiSelect(data);
|
|
4042
|
+
editorService?.get("stage")?.multiSelect(data);
|
|
4043
|
+
};
|
|
4044
|
+
const highlight = (data) => {
|
|
4045
|
+
if (!data?.id) {
|
|
4046
|
+
throw new Error("\u6CA1\u6709id");
|
|
4047
|
+
}
|
|
4048
|
+
editorService?.highlight(data);
|
|
4049
|
+
editorService?.get("stage")?.highlight(data.id);
|
|
4050
|
+
};
|
|
4051
|
+
const expandedKeys = /* @__PURE__ */ new Map();
|
|
4052
|
+
const allowDrop = (draggingNode, dropNode, type) => {
|
|
4053
|
+
const { data } = dropNode || {};
|
|
4054
|
+
const { data: ingData } = draggingNode;
|
|
4055
|
+
const { type: ingType } = ingData;
|
|
4056
|
+
if (ingType !== NodeType.PAGE && data.type === NodeType.PAGE)
|
|
4057
|
+
return false;
|
|
4058
|
+
if (ingType === NodeType.PAGE && data.type !== NodeType.PAGE)
|
|
4059
|
+
return false;
|
|
4060
|
+
if (!data || !data.type)
|
|
4061
|
+
return false;
|
|
4062
|
+
if (["prev", "next"].includes(type))
|
|
4063
|
+
return true;
|
|
4064
|
+
if (data.items || data.type === "container")
|
|
4065
|
+
return true;
|
|
4066
|
+
return false;
|
|
4067
|
+
};
|
|
4068
|
+
const handleDragEnd = async (e) => {
|
|
4069
|
+
if (!tree.value)
|
|
4070
|
+
return;
|
|
4071
|
+
const { data: node } = e;
|
|
4072
|
+
const parent = editorService?.getParentById(node.id, false);
|
|
4073
|
+
const layout = await editorService?.getLayout(parent);
|
|
4074
|
+
node.style.position = layout;
|
|
4075
|
+
if (layout === Layout.RELATIVE) {
|
|
4076
|
+
node.style.top = 0;
|
|
4077
|
+
node.style.left = 0;
|
|
4078
|
+
}
|
|
4079
|
+
const data = tree.value.getData();
|
|
4080
|
+
const [page2] = data;
|
|
4081
|
+
editorService?.update(page2);
|
|
4082
|
+
};
|
|
4083
|
+
const loadItems = (node, resolve) => {
|
|
4084
|
+
if (Array.isArray(node.data)) {
|
|
4085
|
+
return resolve(node.data);
|
|
4086
|
+
}
|
|
4087
|
+
if (Array.isArray(node.data?.items)) {
|
|
4088
|
+
return resolve(node.data?.items);
|
|
4089
|
+
}
|
|
4090
|
+
resolve([]);
|
|
4091
|
+
};
|
|
4092
|
+
const handleCollapse = (data) => {
|
|
4093
|
+
expandedKeys.delete(data.id);
|
|
4094
|
+
};
|
|
4095
|
+
const handleExpand = (data) => {
|
|
4096
|
+
const parent = editorService?.getParentById(data.id);
|
|
4097
|
+
if (!parent?.id)
|
|
4098
|
+
return;
|
|
4099
|
+
expandedKeys.set(parent.id, parent.id);
|
|
4100
|
+
};
|
|
4101
|
+
const filterNode = (value, data) => {
|
|
4102
|
+
if (!value) {
|
|
4103
|
+
return true;
|
|
3958
4104
|
}
|
|
4105
|
+
let name = "";
|
|
4106
|
+
if (data.name) {
|
|
4107
|
+
name = data.name;
|
|
4108
|
+
} else if (data.items) {
|
|
4109
|
+
name = "container";
|
|
4110
|
+
}
|
|
4111
|
+
return `${data.id}${name}${data.type}`.indexOf(value) !== -1;
|
|
3959
4112
|
};
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
const _component_content_menu = resolveComponent("content-menu");
|
|
3965
|
-
return openBlock(), createBlock(_component_content_menu, {
|
|
3966
|
-
"menu-data": _ctx.menuData,
|
|
3967
|
-
ref: "menu",
|
|
3968
|
-
style: { "overflow": "initial" }
|
|
3969
|
-
}, null, 8, ["menu-data"]);
|
|
3970
|
-
}
|
|
3971
|
-
const LayerMenu = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["render", _sfc_render$4]]);
|
|
3972
|
-
|
|
3973
|
-
const throttleTime = 150;
|
|
3974
|
-
const select = async (data, editorService) => {
|
|
3975
|
-
if (!data.id) {
|
|
3976
|
-
throw new Error("\u6CA1\u6709id");
|
|
3977
|
-
}
|
|
3978
|
-
await editorService?.select(data);
|
|
3979
|
-
editorService?.get("stage")?.select(data.id);
|
|
3980
|
-
};
|
|
3981
|
-
const highlight = (data, editorService) => {
|
|
3982
|
-
if (!data?.id) {
|
|
3983
|
-
throw new Error("\u6CA1\u6709id");
|
|
3984
|
-
}
|
|
3985
|
-
editorService?.highlight(data);
|
|
3986
|
-
editorService?.get("stage")?.highlight(data.id);
|
|
3987
|
-
};
|
|
3988
|
-
const useDrop = (tree, editorService) => ({
|
|
3989
|
-
allowDrop: (draggingNode, dropNode, type) => {
|
|
3990
|
-
const { data } = dropNode || {};
|
|
3991
|
-
const { data: ingData } = draggingNode;
|
|
3992
|
-
const { type: ingType } = ingData;
|
|
3993
|
-
if (ingType !== NodeType.PAGE && data.type === NodeType.PAGE)
|
|
3994
|
-
return false;
|
|
3995
|
-
if (ingType === NodeType.PAGE && data.type !== NodeType.PAGE)
|
|
3996
|
-
return false;
|
|
3997
|
-
if (!data || !data.type)
|
|
3998
|
-
return false;
|
|
3999
|
-
if (["prev", "next"].includes(type))
|
|
4000
|
-
return true;
|
|
4001
|
-
if (data.items || data.type === "container")
|
|
4002
|
-
return true;
|
|
4003
|
-
return false;
|
|
4004
|
-
},
|
|
4005
|
-
async handleDragEnd(e) {
|
|
4006
|
-
if (!tree.value)
|
|
4007
|
-
return;
|
|
4008
|
-
const { data: node } = e;
|
|
4009
|
-
const parent = editorService?.getParentById(node.id, false);
|
|
4010
|
-
const layout = await editorService?.getLayout(parent);
|
|
4011
|
-
node.style.position = layout;
|
|
4012
|
-
if (layout === Layout.RELATIVE) {
|
|
4013
|
-
node.style.top = 0;
|
|
4014
|
-
node.style.left = 0;
|
|
4015
|
-
}
|
|
4016
|
-
const { data } = tree.value;
|
|
4017
|
-
const [page] = data;
|
|
4018
|
-
editorService?.update(page);
|
|
4019
|
-
}
|
|
4020
|
-
});
|
|
4021
|
-
const useStatus = (tree, editorService) => {
|
|
4022
|
-
const node = ref();
|
|
4023
|
-
const page = computed(() => editorService?.get("page"));
|
|
4024
|
-
const expandedKeys = /* @__PURE__ */ new Map();
|
|
4025
|
-
const expandNodes = () => {
|
|
4026
|
-
expandedKeys.forEach((key) => {
|
|
4113
|
+
const filterTextChangeHandler = (val) => {
|
|
4114
|
+
tree.value?.filter(val);
|
|
4115
|
+
};
|
|
4116
|
+
const expandNodes = async () => {
|
|
4027
4117
|
if (!tree.value)
|
|
4028
4118
|
return;
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
watchEffect(() => {
|
|
4033
|
-
if (!tree.value)
|
|
4034
|
-
return;
|
|
4035
|
-
if (!editorService)
|
|
4036
|
-
return;
|
|
4037
|
-
node.value = editorService.get("node");
|
|
4038
|
-
if (!node.value)
|
|
4039
|
-
return;
|
|
4040
|
-
tree.value.setCurrentKey(node.value.id, true);
|
|
4041
|
-
const parent = editorService.get("parent");
|
|
4042
|
-
if (!parent?.id)
|
|
4043
|
-
return;
|
|
4044
|
-
const treeNode = tree.value.getNode(parent.id);
|
|
4045
|
-
treeNode?.updateChildren();
|
|
4046
|
-
setTimeout(() => {
|
|
4047
|
-
tree.value && Object.entries(tree.value.store.nodesMap).forEach(([id, node2]) => {
|
|
4048
|
-
if (node2.expanded && node2.data.items) {
|
|
4119
|
+
await nextTick();
|
|
4120
|
+
tree.value && Object.entries(tree.value.getStore().nodesMap).forEach(([id, node]) => {
|
|
4121
|
+
if (node.expanded && node.data.items) {
|
|
4049
4122
|
expandedKeys.set(id, id);
|
|
4050
4123
|
}
|
|
4051
4124
|
});
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4125
|
+
expandedKeys.forEach((key) => {
|
|
4126
|
+
if (!tree.value)
|
|
4127
|
+
return;
|
|
4128
|
+
tree.value.getNode(key)?.expand();
|
|
4129
|
+
});
|
|
4130
|
+
};
|
|
4131
|
+
watch(
|
|
4132
|
+
() => editorService?.get("nodes"),
|
|
4133
|
+
(nodes) => {
|
|
4134
|
+
selectedNodes.value = nodes ?? [];
|
|
4060
4135
|
}
|
|
4061
|
-
|
|
4062
|
-
|
|
4136
|
+
);
|
|
4137
|
+
const setTreeKeyStatus = () => {
|
|
4138
|
+
if (!tree.value)
|
|
4139
|
+
return;
|
|
4140
|
+
if (selectedIds.value.length === 0) {
|
|
4141
|
+
tree.value.setCheckedKeys([]);
|
|
4142
|
+
tree.value.setCurrentKey();
|
|
4143
|
+
} else if (selectedIds.value.length === 1 && !isMultiSelectStatus.value) {
|
|
4144
|
+
tree.value.setCurrentKey(selectedIds.value[0], true);
|
|
4145
|
+
tree.value.setCheckedKeys([]);
|
|
4146
|
+
} else {
|
|
4147
|
+
tree.value.setCheckedKeys(selectedIds.value);
|
|
4148
|
+
tree.value.setCurrentKey();
|
|
4063
4149
|
}
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
handleCollapse: (data) => {
|
|
4070
|
-
expandedKeys.delete(data.id);
|
|
4071
|
-
},
|
|
4072
|
-
handleExpand: (data) => {
|
|
4073
|
-
const parent = editorService?.getParentById(data.id);
|
|
4150
|
+
};
|
|
4151
|
+
watch([selectedIds, tree], async () => {
|
|
4152
|
+
if (!tree.value || !editorService)
|
|
4153
|
+
return;
|
|
4154
|
+
const parent = editorService.get("parent");
|
|
4074
4155
|
if (!parent?.id)
|
|
4075
4156
|
return;
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
}
|
|
4098
|
-
const
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
const tree = ref();
|
|
4104
|
-
const menu = ref();
|
|
4157
|
+
const treeNode = tree.value.getNode(parent.id);
|
|
4158
|
+
treeNode?.updateChildren();
|
|
4159
|
+
await expandNodes();
|
|
4160
|
+
setTreeKeyStatus();
|
|
4161
|
+
});
|
|
4162
|
+
const keycon = ref();
|
|
4163
|
+
const addSelectModeListener = () => {
|
|
4164
|
+
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4165
|
+
const ctrl = isMac ? "meta" : "ctrl";
|
|
4166
|
+
keycon.value = new KeyController();
|
|
4167
|
+
keycon.value.keydown(ctrl, (e) => {
|
|
4168
|
+
e.inputEvent.preventDefault();
|
|
4169
|
+
isMultiSelectStatus.value = true;
|
|
4170
|
+
});
|
|
4171
|
+
keycon.value.on("blur", () => {
|
|
4172
|
+
isMultiSelectStatus.value = false;
|
|
4173
|
+
});
|
|
4174
|
+
keycon.value.keyup(ctrl, (e) => {
|
|
4175
|
+
e.inputEvent.preventDefault();
|
|
4176
|
+
isMultiSelectStatus.value = false;
|
|
4177
|
+
});
|
|
4178
|
+
};
|
|
4179
|
+
const removeSelectModeListener = () => {
|
|
4180
|
+
keycon.value?.destroy();
|
|
4181
|
+
if (selectedIds.value.length === 1)
|
|
4182
|
+
isMultiSelectStatus.value = false;
|
|
4183
|
+
};
|
|
4105
4184
|
const clicked = ref(false);
|
|
4106
|
-
const
|
|
4185
|
+
const highlightNode = computed(() => editorService?.get("highlightNode"));
|
|
4107
4186
|
const highlightHandler = throttle((data) => {
|
|
4108
|
-
highlight(data
|
|
4187
|
+
highlight(data);
|
|
4109
4188
|
}, throttleTime);
|
|
4110
4189
|
const toggleClickFlag = () => {
|
|
4111
4190
|
clicked.value = !clicked.value;
|
|
4112
4191
|
};
|
|
4113
|
-
const
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4192
|
+
const canHighlight = (data) => {
|
|
4193
|
+
if (clicked.value)
|
|
4194
|
+
return false;
|
|
4195
|
+
return data.id === highlightNode?.value?.id && !selectedIds.value.includes(data.id) && spliceNodeKey.value !== data.id;
|
|
4196
|
+
};
|
|
4197
|
+
watch(isMultiSelectStatus, () => {
|
|
4198
|
+
if (isMultiSelectStatus.value && selectedNodes.value.length === 1 && selectedNodes.value[0].type === NodeType.PAGE) {
|
|
4199
|
+
selectedNodes.value = [];
|
|
4200
|
+
}
|
|
4121
4201
|
});
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4202
|
+
const multiClickHandler = (data) => {
|
|
4203
|
+
if (!data?.id) {
|
|
4204
|
+
throw new Error("\u6CA1\u6709id");
|
|
4205
|
+
}
|
|
4206
|
+
if (data.type === NodeType.PAGE) {
|
|
4207
|
+
tree.value?.setCheckedKeys([]);
|
|
4208
|
+
return;
|
|
4209
|
+
}
|
|
4210
|
+
const index = selectedNodes.value.findIndex((node) => node.id === data.id);
|
|
4211
|
+
if (index !== -1) {
|
|
4212
|
+
selectedNodes.value.splice(index, 1);
|
|
4213
|
+
spliceNodeKey.value = data.id;
|
|
4214
|
+
} else {
|
|
4215
|
+
selectedNodes.value = [...selectedNodes.value, data];
|
|
4216
|
+
}
|
|
4217
|
+
tree.value?.setCheckedKeys(selectedIds.value);
|
|
4218
|
+
multiSelect(selectedIds.value);
|
|
4219
|
+
};
|
|
4220
|
+
const clickHandler = (data) => {
|
|
4221
|
+
if (!isMultiSelectStatus.value) {
|
|
4132
4222
|
if (services?.uiService.get("uiSelectMode")) {
|
|
4133
4223
|
document.dispatchEvent(new CustomEvent("ui-select", { detail: data }));
|
|
4134
4224
|
return;
|
|
4135
4225
|
}
|
|
4136
4226
|
tree.value?.setCurrentKey(data.id);
|
|
4137
|
-
select(data
|
|
4138
|
-
}
|
|
4139
|
-
|
|
4140
|
-
event.preventDefault();
|
|
4141
|
-
await select(data, editorService);
|
|
4142
|
-
menu.value?.show(event);
|
|
4227
|
+
select(data);
|
|
4228
|
+
} else {
|
|
4229
|
+
multiClickHandler(data);
|
|
4143
4230
|
}
|
|
4144
4231
|
};
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
default: withCtx(() => [
|
|
4156
|
-
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4157
|
-
createVNode(_component_el_input, {
|
|
4158
|
-
class: "filterInput",
|
|
4159
|
-
size: "small",
|
|
4160
|
-
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
4161
|
-
clearable: "",
|
|
4162
|
-
modelValue: _ctx.filterText,
|
|
4163
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.filterText = $event),
|
|
4164
|
-
onChange: _ctx.filterTextChangeHandler
|
|
4165
|
-
}, null, 8, ["modelValue", "onChange"]),
|
|
4166
|
-
_ctx.values.length ? (openBlock(), createBlock(_component_el_tree, {
|
|
4167
|
-
key: 0,
|
|
4168
|
-
ref: "tree",
|
|
4169
|
-
"node-key": "id",
|
|
4170
|
-
"empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
|
|
4171
|
-
draggable: "",
|
|
4172
|
-
"default-expanded-keys": _ctx.expandedKeys,
|
|
4173
|
-
load: _ctx.loadItems,
|
|
4174
|
-
data: _ctx.values,
|
|
4175
|
-
"expand-on-click-node": false,
|
|
4176
|
-
"highlight-current": true,
|
|
4177
|
-
props: {
|
|
4178
|
-
children: "items"
|
|
4179
|
-
},
|
|
4180
|
-
"filter-node-method": _ctx.filterNode,
|
|
4181
|
-
"allow-drop": _ctx.allowDrop,
|
|
4182
|
-
onNodeClick: _ctx.clickHandler,
|
|
4183
|
-
onNodeContextmenu: _ctx.contextmenu,
|
|
4184
|
-
onNodeDragEnd: _ctx.handleDragEnd,
|
|
4185
|
-
onNodeCollapse: _ctx.handleCollapse,
|
|
4186
|
-
onNodeExpand: _ctx.handleExpand
|
|
4232
|
+
const contextmenu = async (event, data) => {
|
|
4233
|
+
event.preventDefault();
|
|
4234
|
+
await select(data);
|
|
4235
|
+
menu.value?.show(event);
|
|
4236
|
+
};
|
|
4237
|
+
return (_ctx, _cache) => {
|
|
4238
|
+
return openBlock(), createBlock(unref(TMagicScrollbar), {
|
|
4239
|
+
class: "magic-editor-layer-panel",
|
|
4240
|
+
onMouseenter: addSelectModeListener,
|
|
4241
|
+
onMouseleave: removeSelectModeListener
|
|
4187
4242
|
}, {
|
|
4188
|
-
default: withCtx((
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4243
|
+
default: withCtx(() => [
|
|
4244
|
+
renderSlot(_ctx.$slots, "layer-panel-header"),
|
|
4245
|
+
createVNode(unref(TMagicInput), {
|
|
4246
|
+
modelValue: filterText.value,
|
|
4247
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => filterText.value = $event),
|
|
4248
|
+
class: "search-input",
|
|
4249
|
+
size: "small",
|
|
4250
|
+
placeholder: "\u8F93\u5165\u5173\u952E\u5B57\u8FDB\u884C\u8FC7\u6EE4",
|
|
4251
|
+
clearable: "",
|
|
4252
|
+
"prefix-icon": unref(Search),
|
|
4253
|
+
onChange: filterTextChangeHandler
|
|
4254
|
+
}, null, 8, ["modelValue", "prefix-icon"]),
|
|
4255
|
+
unref(values).length ? (openBlock(), createBlock(unref(TMagicTree), {
|
|
4256
|
+
key: 0,
|
|
4257
|
+
class: "magic-editor-layer-tree",
|
|
4258
|
+
ref_key: "tree",
|
|
4259
|
+
ref: tree,
|
|
4260
|
+
"node-key": "id",
|
|
4261
|
+
"empty-text": "\u9875\u9762\u7A7A\u8361\u8361\u7684",
|
|
4262
|
+
draggable: "",
|
|
4263
|
+
"default-expanded-keys": unref(defaultExpandedKeys),
|
|
4264
|
+
load: loadItems,
|
|
4265
|
+
data: unref(values),
|
|
4266
|
+
"expand-on-click-node": false,
|
|
4267
|
+
"highlight-current": true,
|
|
4268
|
+
props: {
|
|
4269
|
+
children: "items"
|
|
4270
|
+
},
|
|
4271
|
+
"filter-node-method": filterNode,
|
|
4272
|
+
"allow-drop": allowDrop,
|
|
4273
|
+
"show-checkbox": isMultiSelectStatus.value || unref(selectedIds).length > 1,
|
|
4274
|
+
onNodeClick: clickHandler,
|
|
4275
|
+
onNodeContextmenu: contextmenu,
|
|
4276
|
+
onNodeDragEnd: handleDragEnd,
|
|
4277
|
+
onNodeCollapse: handleCollapse,
|
|
4278
|
+
onNodeExpand: handleExpand,
|
|
4279
|
+
onCheck: multiClickHandler,
|
|
4280
|
+
onMousedown: toggleClickFlag,
|
|
4281
|
+
onMouseup: toggleClickFlag
|
|
4282
|
+
}, {
|
|
4283
|
+
default: withCtx(({ node, data }) => [
|
|
4284
|
+
createElementVNode("div", {
|
|
4285
|
+
id: data.id,
|
|
4286
|
+
class: normalizeClass(["cus-tree-node", { "cus-tree-node-hover": canHighlight(data) }]),
|
|
4287
|
+
onMouseenter: ($event) => unref(highlightHandler)(data)
|
|
4288
|
+
}, [
|
|
4289
|
+
renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4290
|
+
node,
|
|
4291
|
+
data
|
|
4292
|
+
}, () => [
|
|
4293
|
+
createElementVNode("span", null, toDisplayString(`${data.name} (${data.id})`), 1)
|
|
4294
|
+
])
|
|
4295
|
+
], 42, _hoisted_1$4)
|
|
4296
|
+
]),
|
|
4297
|
+
_: 3
|
|
4298
|
+
}, 8, ["default-expanded-keys", "data", "show-checkbox"])) : createCommentVNode("", true),
|
|
4299
|
+
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
4300
|
+
createVNode(_sfc_main$b, {
|
|
4301
|
+
ref_key: "menu",
|
|
4302
|
+
ref: menu,
|
|
4303
|
+
"layer-content-menu": __props.layerContentMenu
|
|
4304
|
+
}, null, 8, ["layer-content-menu"])
|
|
4305
|
+
]))
|
|
4203
4306
|
]),
|
|
4204
4307
|
_: 3
|
|
4205
|
-
}
|
|
4206
|
-
(openBlock(), createBlock(Teleport, { to: "body" }, [
|
|
4207
|
-
createVNode(_component_layer_menu, { ref: "menu" }, null, 512)
|
|
4208
|
-
]))
|
|
4209
|
-
]),
|
|
4210
|
-
_: 3
|
|
4211
|
-
});
|
|
4212
|
-
}
|
|
4213
|
-
const LayerPanel = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["render", _sfc_render$3]]);
|
|
4214
|
-
|
|
4215
|
-
const _sfc_main$9 = defineComponent({
|
|
4216
|
-
components: { MIcon: _sfc_main$j },
|
|
4217
|
-
props: {
|
|
4218
|
-
data: {
|
|
4219
|
-
type: [Object, String]
|
|
4220
|
-
}
|
|
4221
|
-
},
|
|
4222
|
-
setup(props) {
|
|
4223
|
-
return {
|
|
4224
|
-
config: computed(() => {
|
|
4225
|
-
if (typeof props.data !== "string") {
|
|
4226
|
-
return props.data;
|
|
4227
|
-
}
|
|
4228
|
-
switch (props.data) {
|
|
4229
|
-
case "component-list":
|
|
4230
|
-
return {
|
|
4231
|
-
type: "component",
|
|
4232
|
-
icon: Coin,
|
|
4233
|
-
text: "\u7EC4\u4EF6",
|
|
4234
|
-
component: _sfc_main$d,
|
|
4235
|
-
slots: {}
|
|
4236
|
-
};
|
|
4237
|
-
case "layer":
|
|
4238
|
-
return {
|
|
4239
|
-
type: "component",
|
|
4240
|
-
icon: Files,
|
|
4241
|
-
text: "\u5DF2\u9009\u7EC4\u4EF6",
|
|
4242
|
-
component: LayerPanel,
|
|
4243
|
-
slots: {}
|
|
4244
|
-
};
|
|
4245
|
-
case "code-block":
|
|
4246
|
-
return {
|
|
4247
|
-
type: "component",
|
|
4248
|
-
icon: EditPen,
|
|
4249
|
-
text: "\u4EE3\u7801\u7F16\u8F91",
|
|
4250
|
-
component: _sfc_main$e,
|
|
4251
|
-
slots: {}
|
|
4252
|
-
};
|
|
4253
|
-
default:
|
|
4254
|
-
return void 0;
|
|
4255
|
-
}
|
|
4256
|
-
})
|
|
4308
|
+
});
|
|
4257
4309
|
};
|
|
4258
4310
|
}
|
|
4259
4311
|
});
|
|
4260
4312
|
|
|
4261
|
-
const _hoisted_1$
|
|
4313
|
+
const _hoisted_1$3 = {
|
|
4262
4314
|
key: 1,
|
|
4263
4315
|
class: "magic-editor-tab-panel-title"
|
|
4264
4316
|
};
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
name: _ctx.config.text
|
|
4271
|
-
}, {
|
|
4272
|
-
label: withCtx(() => [
|
|
4273
|
-
(openBlock(), createElementBlock("div", {
|
|
4274
|
-
key: _ctx.config.text
|
|
4275
|
-
}, [
|
|
4276
|
-
_ctx.config.icon ? (openBlock(), createBlock(_component_m_icon, {
|
|
4277
|
-
key: 0,
|
|
4278
|
-
icon: _ctx.config.icon
|
|
4279
|
-
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
4280
|
-
_ctx.config.text ? (openBlock(), createElementBlock("div", _hoisted_1$2, toDisplayString(_ctx.config.text), 1)) : createCommentVNode("", true)
|
|
4281
|
-
]))
|
|
4282
|
-
]),
|
|
4283
|
-
default: withCtx(() => [
|
|
4284
|
-
(openBlock(), createBlock(resolveDynamicComponent(_ctx.config.component), mergeProps(_ctx.config.props || {}, toHandlers(_ctx.config?.listeners || {})), createSlots({ _: 2 }, [
|
|
4285
|
-
_ctx.data === "component-list" || _ctx.config.slots?.componentListPanelHeader ? {
|
|
4286
|
-
name: "component-list-panel-header",
|
|
4287
|
-
fn: withCtx(() => [
|
|
4288
|
-
_ctx.data === "component-list" ? renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : _ctx.config.slots?.componentListPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.slots.componentListPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
4289
|
-
])
|
|
4290
|
-
} : void 0,
|
|
4291
|
-
_ctx.data === "component-list" || _ctx.config.slots?.componentListItem ? {
|
|
4292
|
-
name: "component-list-item",
|
|
4293
|
-
fn: withCtx(({ component }) => [
|
|
4294
|
-
_ctx.data === "component-list" ? renderSlot(_ctx.$slots, "component-list-item", {
|
|
4295
|
-
key: 0,
|
|
4296
|
-
component
|
|
4297
|
-
}) : _ctx.config.slots?.componentListItem ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.slots.componentListItem), {
|
|
4298
|
-
key: 1,
|
|
4299
|
-
component
|
|
4300
|
-
}, null, 8, ["component"])) : createCommentVNode("", true)
|
|
4301
|
-
])
|
|
4302
|
-
} : void 0,
|
|
4303
|
-
_ctx.data === "layer" || _ctx.config.slots?.layerPanelHeader ? {
|
|
4304
|
-
name: "layer-panel-header",
|
|
4305
|
-
fn: withCtx(() => [
|
|
4306
|
-
_ctx.data === "layer" ? renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : _ctx.config.slots?.layerPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.slots.layerPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
4307
|
-
])
|
|
4308
|
-
} : void 0,
|
|
4309
|
-
_ctx.data === "code-block" || _ctx.config.slots?.codeBlockPanelHeader ? {
|
|
4310
|
-
name: "code-block-panel-header",
|
|
4311
|
-
fn: withCtx(() => [
|
|
4312
|
-
_ctx.data === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : _ctx.config.slots?.codeBlockPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.slots.codeBlockPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
4313
|
-
])
|
|
4314
|
-
} : void 0,
|
|
4315
|
-
_ctx.data === "code-block" || _ctx.config.slots?.codeBlockPanelTool ? {
|
|
4316
|
-
name: "code-block-panel-tool",
|
|
4317
|
-
fn: withCtx(({ id }) => [
|
|
4318
|
-
_ctx.data === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
4319
|
-
key: 0,
|
|
4320
|
-
id
|
|
4321
|
-
}) : _ctx.config.slots?.codeBlockPanelTool ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.slots.codeBlockPanelTool), { key: 1 })) : createCommentVNode("", true)
|
|
4322
|
-
])
|
|
4323
|
-
} : void 0,
|
|
4324
|
-
_ctx.data === "code-block" || _ctx.config.slots?.codeBlockEditPanelHeader ? {
|
|
4325
|
-
name: "code-block-edit-panel-header",
|
|
4326
|
-
fn: withCtx(({ id }) => [
|
|
4327
|
-
_ctx.data === "code-block" ? renderSlot(_ctx.$slots, "code-block-edit-panel-header", {
|
|
4328
|
-
key: 0,
|
|
4329
|
-
id
|
|
4330
|
-
}) : _ctx.config.slots?.codeBlockEditPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.slots.codeBlockEditPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
4331
|
-
])
|
|
4332
|
-
} : void 0,
|
|
4333
|
-
_ctx.data === "layer" || _ctx.config.slots?.layerNodeContent ? {
|
|
4334
|
-
name: "layer-node-content",
|
|
4335
|
-
fn: withCtx(({ data: nodeData, node }) => [
|
|
4336
|
-
_ctx.data === "layer" ? renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4337
|
-
key: 0,
|
|
4338
|
-
data: nodeData,
|
|
4339
|
-
node
|
|
4340
|
-
}) : _ctx.config.slots?.layerNodeContent ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.config.slots.layerNodeContent), {
|
|
4341
|
-
key: 1,
|
|
4342
|
-
data: nodeData,
|
|
4343
|
-
node
|
|
4344
|
-
}, null, 8, ["data", "node"])) : createCommentVNode("", true)
|
|
4345
|
-
])
|
|
4346
|
-
} : void 0
|
|
4347
|
-
]), 1040))
|
|
4348
|
-
]),
|
|
4349
|
-
_: 3
|
|
4350
|
-
}, 8, ["name"])) : createCommentVNode("", true);
|
|
4351
|
-
}
|
|
4352
|
-
const TabPane = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["render", _sfc_render$2]]);
|
|
4353
|
-
|
|
4354
|
-
const _sfc_main$8 = defineComponent({
|
|
4355
|
-
components: { TabPane },
|
|
4356
|
-
name: "m-sidebar",
|
|
4317
|
+
const __default__$8 = defineComponent({
|
|
4318
|
+
name: "MEditorSidebar"
|
|
4319
|
+
});
|
|
4320
|
+
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
4321
|
+
...__default__$8,
|
|
4357
4322
|
props: {
|
|
4358
|
-
data: {
|
|
4359
|
-
|
|
4360
|
-
default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] })
|
|
4361
|
-
}
|
|
4323
|
+
data: { default: () => ({ type: "tabs", status: "\u7EC4\u4EF6", items: ["component-list", "layer", "code-block"] }) },
|
|
4324
|
+
layerContentMenu: null
|
|
4362
4325
|
},
|
|
4363
|
-
setup(
|
|
4326
|
+
setup(__props, { expose }) {
|
|
4327
|
+
const props = __props;
|
|
4328
|
+
const uiComponent = getConfig$1("components").tabPane;
|
|
4364
4329
|
const activeTabName = ref(props.data?.status);
|
|
4330
|
+
const getItemConfig = (data) => {
|
|
4331
|
+
const map = {
|
|
4332
|
+
"component-list": {
|
|
4333
|
+
$key: "component-list",
|
|
4334
|
+
type: "component",
|
|
4335
|
+
icon: Coin,
|
|
4336
|
+
text: "\u7EC4\u4EF6",
|
|
4337
|
+
component: _sfc_main$d,
|
|
4338
|
+
slots: {}
|
|
4339
|
+
},
|
|
4340
|
+
layer: {
|
|
4341
|
+
$key: "layer",
|
|
4342
|
+
type: "component",
|
|
4343
|
+
icon: Files,
|
|
4344
|
+
text: "\u5DF2\u9009\u7EC4\u4EF6",
|
|
4345
|
+
props: {
|
|
4346
|
+
layerContentMenu: props.layerContentMenu
|
|
4347
|
+
},
|
|
4348
|
+
component: _sfc_main$a,
|
|
4349
|
+
slots: {}
|
|
4350
|
+
},
|
|
4351
|
+
"code-block": {
|
|
4352
|
+
$key: "code-block",
|
|
4353
|
+
type: "component",
|
|
4354
|
+
icon: EditPen,
|
|
4355
|
+
text: "\u4EE3\u7801\u7F16\u8F91",
|
|
4356
|
+
component: _sfc_main$e,
|
|
4357
|
+
slots: {}
|
|
4358
|
+
}
|
|
4359
|
+
};
|
|
4360
|
+
return typeof data === "string" ? map[data] : data;
|
|
4361
|
+
};
|
|
4362
|
+
const sideBarItems = computed(() => props.data.items.map((item) => getItemConfig(item)));
|
|
4365
4363
|
watch(
|
|
4366
|
-
() => props.data
|
|
4364
|
+
() => props.data.status,
|
|
4367
4365
|
(status) => {
|
|
4368
4366
|
activeTabName.value = status || "0";
|
|
4369
4367
|
}
|
|
4370
4368
|
);
|
|
4371
|
-
|
|
4369
|
+
expose({
|
|
4372
4370
|
activeTabName
|
|
4371
|
+
});
|
|
4372
|
+
return (_ctx, _cache) => {
|
|
4373
|
+
return __props.data.type === "tabs" && __props.data.items.length ? (openBlock(), createBlock(unref(TMagicTabs), {
|
|
4374
|
+
key: 0,
|
|
4375
|
+
class: "m-editor-sidebar",
|
|
4376
|
+
modelValue: activeTabName.value,
|
|
4377
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => activeTabName.value = $event),
|
|
4378
|
+
type: "card",
|
|
4379
|
+
"tab-position": "left"
|
|
4380
|
+
}, {
|
|
4381
|
+
default: withCtx(() => [
|
|
4382
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(sideBarItems), (config, index) => {
|
|
4383
|
+
return openBlock(), createBlock(resolveDynamicComponent(unref(uiComponent).component), {
|
|
4384
|
+
key: index,
|
|
4385
|
+
name: config.text
|
|
4386
|
+
}, {
|
|
4387
|
+
label: withCtx(() => [
|
|
4388
|
+
(openBlock(), createElementBlock("div", {
|
|
4389
|
+
key: config.text
|
|
4390
|
+
}, [
|
|
4391
|
+
config.icon ? (openBlock(), createBlock(_sfc_main$l, {
|
|
4392
|
+
key: 0,
|
|
4393
|
+
icon: config.icon
|
|
4394
|
+
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
4395
|
+
config.text ? (openBlock(), createElementBlock("div", _hoisted_1$3, toDisplayString(config.text), 1)) : createCommentVNode("", true)
|
|
4396
|
+
]))
|
|
4397
|
+
]),
|
|
4398
|
+
default: withCtx(() => [
|
|
4399
|
+
config ? (openBlock(), createBlock(resolveDynamicComponent(config.component), mergeProps({ key: 0 }, config.props || {}, toHandlers(config?.listeners || {})), createSlots({ _: 2 }, [
|
|
4400
|
+
config.$key === "component-list" || config.slots?.componentListPanelHeader ? {
|
|
4401
|
+
name: "component-list-panel-header",
|
|
4402
|
+
fn: withCtx(() => [
|
|
4403
|
+
config.$key === "component-list" ? renderSlot(_ctx.$slots, "component-list-panel-header", { key: 0 }) : config.slots?.componentListPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.componentListPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
4404
|
+
])
|
|
4405
|
+
} : void 0,
|
|
4406
|
+
config.$key === "component-list" || config.slots?.componentListItem ? {
|
|
4407
|
+
name: "component-list-item",
|
|
4408
|
+
fn: withCtx(({ component }) => [
|
|
4409
|
+
config.$key === "component-list" ? renderSlot(_ctx.$slots, "component-list-item", {
|
|
4410
|
+
key: 0,
|
|
4411
|
+
component
|
|
4412
|
+
}) : config.slots?.componentListItem ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.componentListItem), {
|
|
4413
|
+
key: 1,
|
|
4414
|
+
component
|
|
4415
|
+
}, null, 8, ["component"])) : createCommentVNode("", true)
|
|
4416
|
+
])
|
|
4417
|
+
} : void 0,
|
|
4418
|
+
config.$key === "layer" || config.slots?.layerPanelHeader ? {
|
|
4419
|
+
name: "layer-panel-header",
|
|
4420
|
+
fn: withCtx(() => [
|
|
4421
|
+
config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-panel-header", { key: 0 }) : config.slots?.layerPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
4422
|
+
])
|
|
4423
|
+
} : void 0,
|
|
4424
|
+
config.$key === "code-block" || config.slots?.codeBlockPanelHeader ? {
|
|
4425
|
+
name: "code-block-panel-header",
|
|
4426
|
+
fn: withCtx(() => [
|
|
4427
|
+
config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-header", { key: 0 }) : config.slots?.codeBlockPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
4428
|
+
])
|
|
4429
|
+
} : void 0,
|
|
4430
|
+
config.$key === "code-block" || config.slots?.codeBlockPanelTool ? {
|
|
4431
|
+
name: "code-block-panel-tool",
|
|
4432
|
+
fn: withCtx(({ id, data }) => [
|
|
4433
|
+
config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
4434
|
+
key: 0,
|
|
4435
|
+
id,
|
|
4436
|
+
data
|
|
4437
|
+
}) : config.slots?.codeBlockPanelTool ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockPanelTool), { key: 1 })) : createCommentVNode("", true)
|
|
4438
|
+
])
|
|
4439
|
+
} : void 0,
|
|
4440
|
+
config.$key === "code-block" || config.slots?.codeBlockEditPanelHeader ? {
|
|
4441
|
+
name: "code-block-edit-panel-header",
|
|
4442
|
+
fn: withCtx(({ id }) => [
|
|
4443
|
+
config.$key === "code-block" ? renderSlot(_ctx.$slots, "code-block-edit-panel-header", {
|
|
4444
|
+
key: 0,
|
|
4445
|
+
id
|
|
4446
|
+
}) : config.slots?.codeBlockEditPanelHeader ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.codeBlockEditPanelHeader), { key: 1 })) : createCommentVNode("", true)
|
|
4447
|
+
])
|
|
4448
|
+
} : void 0,
|
|
4449
|
+
config.$key === "layer" || config.slots?.layerNodeContent ? {
|
|
4450
|
+
name: "layer-node-content",
|
|
4451
|
+
fn: withCtx(({ data: nodeData, node }) => [
|
|
4452
|
+
config.$key === "layer" ? renderSlot(_ctx.$slots, "layer-node-content", {
|
|
4453
|
+
key: 0,
|
|
4454
|
+
data: nodeData,
|
|
4455
|
+
node
|
|
4456
|
+
}) : config.slots?.layerNodeContent ? (openBlock(), createBlock(resolveDynamicComponent(config.slots.layerNodeContent), {
|
|
4457
|
+
key: 1,
|
|
4458
|
+
data: nodeData,
|
|
4459
|
+
node
|
|
4460
|
+
}, null, 8, ["data", "node"])) : createCommentVNode("", true)
|
|
4461
|
+
])
|
|
4462
|
+
} : void 0
|
|
4463
|
+
]), 1040)) : createCommentVNode("", true)
|
|
4464
|
+
]),
|
|
4465
|
+
_: 2
|
|
4466
|
+
}, 1032, ["name"]);
|
|
4467
|
+
}), 128))
|
|
4468
|
+
]),
|
|
4469
|
+
_: 3
|
|
4470
|
+
}, 8, ["modelValue"])) : createCommentVNode("", true);
|
|
4373
4471
|
};
|
|
4374
4472
|
}
|
|
4375
4473
|
});
|
|
4376
4474
|
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
])
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
item === "code-block" ? {
|
|
4422
|
-
name: "code-block-panel-header",
|
|
4423
|
-
fn: withCtx(() => [
|
|
4424
|
-
renderSlot(_ctx.$slots, "code-block-panel-header")
|
|
4425
|
-
])
|
|
4426
|
-
} : void 0,
|
|
4427
|
-
item === "code-block" ? {
|
|
4428
|
-
name: "code-block-panel-tool",
|
|
4429
|
-
fn: withCtx(({ id }) => [
|
|
4430
|
-
renderSlot(_ctx.$slots, "code-block-panel-tool", { id })
|
|
4431
|
-
])
|
|
4432
|
-
} : void 0,
|
|
4433
|
-
item === "code-block" ? {
|
|
4434
|
-
name: "code-block-edit-panel-header",
|
|
4435
|
-
fn: withCtx(({ id }) => [
|
|
4436
|
-
renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
4437
|
-
])
|
|
4438
|
-
} : void 0
|
|
4439
|
-
]), 1032, ["data"]);
|
|
4440
|
-
}), 128))
|
|
4441
|
-
]),
|
|
4442
|
-
_: 3
|
|
4443
|
-
}, 8, ["modelValue"])) : createCommentVNode("", true);
|
|
4444
|
-
}
|
|
4445
|
-
const Sidebar = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["render", _sfc_render$1]]);
|
|
4475
|
+
const _hoisted_1$2 = {
|
|
4476
|
+
key: 0,
|
|
4477
|
+
class: "m-editor-breadcrumb"
|
|
4478
|
+
};
|
|
4479
|
+
const _hoisted_2$1 = { key: 0 };
|
|
4480
|
+
const __default__$7 = defineComponent({
|
|
4481
|
+
name: "MEditorBreadcrumb"
|
|
4482
|
+
});
|
|
4483
|
+
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
4484
|
+
...__default__$7,
|
|
4485
|
+
setup(__props) {
|
|
4486
|
+
const services = inject("services");
|
|
4487
|
+
const editorService = services?.editorService;
|
|
4488
|
+
const node = computed(() => editorService?.get("node"));
|
|
4489
|
+
const nodes = computed(() => editorService?.get("nodes") || []);
|
|
4490
|
+
const root = computed(() => editorService?.get("root"));
|
|
4491
|
+
const path = computed(() => getNodePath(node.value?.id || "", root.value?.items || []));
|
|
4492
|
+
const select = async (node2) => {
|
|
4493
|
+
await editorService?.select(node2);
|
|
4494
|
+
editorService?.get("stage")?.select(node2.id);
|
|
4495
|
+
};
|
|
4496
|
+
return (_ctx, _cache) => {
|
|
4497
|
+
return unref(nodes).length === 1 ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
4498
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(path), (item, index) => {
|
|
4499
|
+
return openBlock(), createElementBlock(Fragment, {
|
|
4500
|
+
key: item.id
|
|
4501
|
+
}, [
|
|
4502
|
+
createVNode(unref(TMagicButton), {
|
|
4503
|
+
text: "",
|
|
4504
|
+
disabled: item.id === unref(node)?.id,
|
|
4505
|
+
onClick: ($event) => select(item)
|
|
4506
|
+
}, {
|
|
4507
|
+
default: withCtx(() => [
|
|
4508
|
+
createTextVNode(toDisplayString(item.name), 1)
|
|
4509
|
+
]),
|
|
4510
|
+
_: 2
|
|
4511
|
+
}, 1032, ["disabled", "onClick"]),
|
|
4512
|
+
index < unref(path).length - 1 ? (openBlock(), createElementBlock("span", _hoisted_2$1, "/")) : createCommentVNode("", true)
|
|
4513
|
+
], 64);
|
|
4514
|
+
}), 128))
|
|
4515
|
+
])) : createCommentVNode("", true);
|
|
4516
|
+
};
|
|
4517
|
+
}
|
|
4518
|
+
});
|
|
4446
4519
|
|
|
4447
4520
|
const _hoisted_1$1 = {
|
|
4448
4521
|
key: 1,
|
|
4449
4522
|
style: { "width": "21px" }
|
|
4450
4523
|
};
|
|
4524
|
+
const __default__$6 = defineComponent({
|
|
4525
|
+
name: "MEditorPageBarScrollContainer"
|
|
4526
|
+
});
|
|
4451
4527
|
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
4452
|
-
|
|
4528
|
+
...__default__$6,
|
|
4453
4529
|
setup(__props) {
|
|
4454
4530
|
const services = inject("services");
|
|
4455
4531
|
const editorService = services?.editorService;
|
|
@@ -4530,14 +4606,14 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4530
4606
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4531
4607
|
onClick: addPage
|
|
4532
4608
|
}, [
|
|
4533
|
-
createVNode(_sfc_main$
|
|
4609
|
+
createVNode(_sfc_main$l, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
4534
4610
|
])) : (openBlock(), createElementBlock("div", _hoisted_1$1)),
|
|
4535
4611
|
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
4536
4612
|
key: 2,
|
|
4537
4613
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4538
4614
|
onClick: _cache[0] || (_cache[0] = ($event) => scroll("left"))
|
|
4539
4615
|
}, [
|
|
4540
|
-
createVNode(_sfc_main$
|
|
4616
|
+
createVNode(_sfc_main$l, { icon: unref(ArrowLeftBold) }, null, 8, ["icon"])
|
|
4541
4617
|
])) : createCommentVNode("", true),
|
|
4542
4618
|
unref(pageLength) ? (openBlock(), createElementBlock("div", {
|
|
4543
4619
|
key: 3,
|
|
@@ -4553,7 +4629,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4553
4629
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
4554
4630
|
onClick: _cache[1] || (_cache[1] = ($event) => scroll("right"))
|
|
4555
4631
|
}, [
|
|
4556
|
-
createVNode(_sfc_main$
|
|
4632
|
+
createVNode(_sfc_main$l, { icon: unref(ArrowRightBold) }, null, 8, ["icon"])
|
|
4557
4633
|
])) : createCommentVNode("", true)
|
|
4558
4634
|
], 512);
|
|
4559
4635
|
};
|
|
@@ -4562,8 +4638,11 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
4562
4638
|
|
|
4563
4639
|
const _hoisted_1 = ["onClick"];
|
|
4564
4640
|
const _hoisted_2 = { class: "m-editor-page-bar-title" };
|
|
4641
|
+
const __default__$5 = defineComponent({
|
|
4642
|
+
name: "MEditorPageBar"
|
|
4643
|
+
});
|
|
4565
4644
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
4566
|
-
|
|
4645
|
+
...__default__$5,
|
|
4567
4646
|
setup(__props) {
|
|
4568
4647
|
const services = inject("services");
|
|
4569
4648
|
const editorService = services?.editorService;
|
|
@@ -4583,9 +4662,6 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
4583
4662
|
editorService?.remove(node);
|
|
4584
4663
|
};
|
|
4585
4664
|
return (_ctx, _cache) => {
|
|
4586
|
-
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
4587
|
-
const _component_el_icon = resolveComponent("el-icon");
|
|
4588
|
-
const _component_el_popover = resolveComponent("el-popover");
|
|
4589
4665
|
return openBlock(), createBlock(_sfc_main$7, null, {
|
|
4590
4666
|
default: withCtx(() => [
|
|
4591
4667
|
(openBlock(true), createElementBlock(Fragment, null, renderList(unref(root) && unref(root).items || [], (item) => {
|
|
@@ -4596,7 +4672,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
4596
4672
|
}, [
|
|
4597
4673
|
createElementVNode("div", _hoisted_2, [
|
|
4598
4674
|
renderSlot(_ctx.$slots, "page-bar-title", { page: item }, () => [
|
|
4599
|
-
createVNode(
|
|
4675
|
+
createVNode(unref(TMagicTooltip), {
|
|
4600
4676
|
effect: "dark",
|
|
4601
4677
|
placement: "top-start",
|
|
4602
4678
|
content: item.name
|
|
@@ -4608,14 +4684,14 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
4608
4684
|
}, 1032, ["content"])
|
|
4609
4685
|
])
|
|
4610
4686
|
]),
|
|
4611
|
-
createVNode(
|
|
4687
|
+
createVNode(unref(TMagicPopover), {
|
|
4612
4688
|
"popper-class": "page-bar-popover",
|
|
4613
4689
|
placement: "top",
|
|
4614
4690
|
width: 160,
|
|
4615
4691
|
trigger: "hover"
|
|
4616
4692
|
}, {
|
|
4617
4693
|
reference: withCtx(() => [
|
|
4618
|
-
createVNode(
|
|
4694
|
+
createVNode(unref(TMagicIcon), { class: "m-editor-page-bar-menu-icon" }, {
|
|
4619
4695
|
default: withCtx(() => [
|
|
4620
4696
|
createVNode(unref(CaretBottom))
|
|
4621
4697
|
]),
|
|
@@ -4667,6 +4743,10 @@ class ScrollViewer extends EventEmitter {
|
|
|
4667
4743
|
height = 0;
|
|
4668
4744
|
translateXCorrectionValue = 0;
|
|
4669
4745
|
translateYCorrectionValue = 0;
|
|
4746
|
+
correctionScrollSize = {
|
|
4747
|
+
width: 0,
|
|
4748
|
+
height: 0
|
|
4749
|
+
};
|
|
4670
4750
|
resizeObserver = new ResizeObserver(() => {
|
|
4671
4751
|
this.setSize();
|
|
4672
4752
|
this.setScrollSize();
|
|
@@ -4676,6 +4756,12 @@ class ScrollViewer extends EventEmitter {
|
|
|
4676
4756
|
this.container = options.container;
|
|
4677
4757
|
this.target = options.target;
|
|
4678
4758
|
this.zoom = options.zoom;
|
|
4759
|
+
if (this.correctionScrollSize) {
|
|
4760
|
+
this.correctionScrollSize = {
|
|
4761
|
+
...this.correctionScrollSize,
|
|
4762
|
+
...options.correctionScrollSize
|
|
4763
|
+
};
|
|
4764
|
+
}
|
|
4679
4765
|
this.container.addEventListener("wheel", this.wheelHandler, false);
|
|
4680
4766
|
this.setSize();
|
|
4681
4767
|
this.setScrollSize();
|
|
@@ -4738,9 +4824,9 @@ class ScrollViewer extends EventEmitter {
|
|
|
4738
4824
|
}
|
|
4739
4825
|
setScrollSize = () => {
|
|
4740
4826
|
const targetRect = this.target.getBoundingClientRect();
|
|
4741
|
-
this.scrollWidth = targetRect.width * this.zoom +
|
|
4827
|
+
this.scrollWidth = targetRect.width * this.zoom + this.correctionScrollSize.width;
|
|
4742
4828
|
const targetMarginTop = Number(this.target.style.marginTop) || 0;
|
|
4743
|
-
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom +
|
|
4829
|
+
this.scrollHeight = (targetRect.height + targetMarginTop) * this.zoom + this.correctionScrollSize.height;
|
|
4744
4830
|
let left;
|
|
4745
4831
|
let top;
|
|
4746
4832
|
if (this.scrollWidth < this.width) {
|
|
@@ -4773,8 +4859,11 @@ class ScrollViewer extends EventEmitter {
|
|
|
4773
4859
|
};
|
|
4774
4860
|
}
|
|
4775
4861
|
|
|
4862
|
+
const __default__$4 = defineComponent({
|
|
4863
|
+
name: "MEditorScrollBar"
|
|
4864
|
+
});
|
|
4776
4865
|
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
4777
|
-
|
|
4866
|
+
...__default__$4,
|
|
4778
4867
|
props: {
|
|
4779
4868
|
size: null,
|
|
4780
4869
|
scrollSize: null,
|
|
@@ -4859,14 +4948,21 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
|
4859
4948
|
|
|
4860
4949
|
const ScrollBar_vue_vue_type_style_index_0_lang = '';
|
|
4861
4950
|
|
|
4951
|
+
const __default__$3 = defineComponent({
|
|
4952
|
+
name: "MEditorScrollViewer"
|
|
4953
|
+
});
|
|
4862
4954
|
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
4863
|
-
|
|
4955
|
+
...__default__$3,
|
|
4864
4956
|
props: {
|
|
4865
4957
|
width: { default: 0 },
|
|
4866
4958
|
height: { default: 0 },
|
|
4867
4959
|
wrapWidth: { default: 0 },
|
|
4868
4960
|
wrapHeight: { default: 0 },
|
|
4869
|
-
zoom: { default: 1 }
|
|
4961
|
+
zoom: { default: 1 },
|
|
4962
|
+
correctionScrollSize: { default: () => ({
|
|
4963
|
+
width: 0,
|
|
4964
|
+
height: 0
|
|
4965
|
+
}) }
|
|
4870
4966
|
},
|
|
4871
4967
|
setup(__props, { expose }) {
|
|
4872
4968
|
const props = __props;
|
|
@@ -4889,7 +4985,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
4889
4985
|
scrollViewer = new ScrollViewer({
|
|
4890
4986
|
container: container.value,
|
|
4891
4987
|
target: el.value,
|
|
4892
|
-
zoom: props.zoom
|
|
4988
|
+
zoom: props.zoom,
|
|
4989
|
+
correctionScrollSize: props.correctionScrollSize
|
|
4893
4990
|
});
|
|
4894
4991
|
scrollViewer.on("scroll", (data) => {
|
|
4895
4992
|
hOffset.value = data.scrollLeft;
|
|
@@ -4957,10 +5054,14 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
4957
5054
|
}
|
|
4958
5055
|
});
|
|
4959
5056
|
|
|
5057
|
+
const __default__$2 = defineComponent({
|
|
5058
|
+
name: "MEditorViewerMenu"
|
|
5059
|
+
});
|
|
4960
5060
|
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
4961
|
-
|
|
5061
|
+
...__default__$2,
|
|
4962
5062
|
props: {
|
|
4963
|
-
isMultiSelect: { type: Boolean, default: false }
|
|
5063
|
+
isMultiSelect: { type: Boolean, default: false },
|
|
5064
|
+
stageContentMenu: null
|
|
4964
5065
|
},
|
|
4965
5066
|
setup(__props, { expose }) {
|
|
4966
5067
|
const props = __props;
|
|
@@ -4973,8 +5074,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
4973
5074
|
const nodes = computed(() => editorService?.get("nodes"));
|
|
4974
5075
|
const parent = computed(() => editorService?.get("parent"));
|
|
4975
5076
|
const stage = computed(() => editorService?.get("stage"));
|
|
4976
|
-
const
|
|
4977
|
-
const menuData = reactive([
|
|
5077
|
+
const menuData = computed(() => [
|
|
4978
5078
|
{
|
|
4979
5079
|
type: "button",
|
|
4980
5080
|
text: "\u6C34\u5E73\u5C45\u4E2D",
|
|
@@ -5076,7 +5176,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5076
5176
|
editorService?.get("stage").clearGuides();
|
|
5077
5177
|
}
|
|
5078
5178
|
},
|
|
5079
|
-
...stageContentMenu
|
|
5179
|
+
...props.stageContentMenu
|
|
5080
5180
|
]);
|
|
5081
5181
|
watch(
|
|
5082
5182
|
parent,
|
|
@@ -5100,7 +5200,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5100
5200
|
expose({ show });
|
|
5101
5201
|
return (_ctx, _cache) => {
|
|
5102
5202
|
return openBlock(), createBlock(_sfc_main$c, {
|
|
5103
|
-
"menu-data": menuData,
|
|
5203
|
+
"menu-data": unref(menuData),
|
|
5104
5204
|
ref_key: "menu",
|
|
5105
5205
|
ref: menu
|
|
5106
5206
|
}, null, 8, ["menu-data"]);
|
|
@@ -5108,8 +5208,14 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
5108
5208
|
}
|
|
5109
5209
|
});
|
|
5110
5210
|
|
|
5211
|
+
const __default__$1 = defineComponent({
|
|
5212
|
+
name: "MEditorStage"
|
|
5213
|
+
});
|
|
5111
5214
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
5112
|
-
|
|
5215
|
+
...__default__$1,
|
|
5216
|
+
props: {
|
|
5217
|
+
stageContentMenu: null
|
|
5218
|
+
},
|
|
5113
5219
|
setup(__props) {
|
|
5114
5220
|
let stage = null;
|
|
5115
5221
|
let runtime = null;
|
|
@@ -5228,7 +5334,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
5228
5334
|
height: unref(stageRect)?.height,
|
|
5229
5335
|
"wrap-width": unref(stageContainerRect)?.width,
|
|
5230
5336
|
"wrap-height": unref(stageContainerRect)?.height,
|
|
5231
|
-
zoom: unref(zoom)
|
|
5337
|
+
zoom: unref(zoom),
|
|
5338
|
+
"correction-scroll-size": {
|
|
5339
|
+
width: 60,
|
|
5340
|
+
height: 50
|
|
5341
|
+
}
|
|
5232
5342
|
}, {
|
|
5233
5343
|
default: withCtx(() => [
|
|
5234
5344
|
createElementVNode("div", {
|
|
@@ -5244,8 +5354,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
5244
5354
|
createVNode(_sfc_main$3, {
|
|
5245
5355
|
ref_key: "menu",
|
|
5246
5356
|
ref: menu,
|
|
5247
|
-
"is-multi-select": unref(isMultiSelect)
|
|
5248
|
-
|
|
5357
|
+
"is-multi-select": unref(isMultiSelect),
|
|
5358
|
+
"stage-content-menu": __props.stageContentMenu
|
|
5359
|
+
}, null, 8, ["is-multi-select", "stage-content-menu"])
|
|
5249
5360
|
]))
|
|
5250
5361
|
]),
|
|
5251
5362
|
_: 1
|
|
@@ -5254,8 +5365,14 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
5254
5365
|
}
|
|
5255
5366
|
});
|
|
5256
5367
|
|
|
5368
|
+
const __default__ = defineComponent({
|
|
5369
|
+
name: "MEditorWorkspace"
|
|
5370
|
+
});
|
|
5257
5371
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
5258
|
-
|
|
5372
|
+
...__default__,
|
|
5373
|
+
props: {
|
|
5374
|
+
stageContentMenu: null
|
|
5375
|
+
},
|
|
5259
5376
|
setup(__props) {
|
|
5260
5377
|
const services = inject("services");
|
|
5261
5378
|
const workspace = ref();
|
|
@@ -5364,10 +5481,12 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
5364
5481
|
ref_key: "workspace",
|
|
5365
5482
|
ref: workspace
|
|
5366
5483
|
}, [
|
|
5484
|
+
createVNode(_sfc_main$8),
|
|
5367
5485
|
renderSlot(_ctx.$slots, "stage", {}, () => [
|
|
5368
5486
|
(openBlock(), createBlock(_sfc_main$2, {
|
|
5369
|
-
key: unref(page)?.id
|
|
5370
|
-
|
|
5487
|
+
key: unref(page)?.id,
|
|
5488
|
+
"stage-content-menu": __props.stageContentMenu
|
|
5489
|
+
}, null, 8, ["stage-content-menu"]))
|
|
5371
5490
|
]),
|
|
5372
5491
|
renderSlot(_ctx.$slots, "workspace-content"),
|
|
5373
5492
|
createVNode(_sfc_main$6, null, {
|
|
@@ -5408,10 +5527,10 @@ const _sfc_main = defineComponent({
|
|
|
5408
5527
|
name: "m-editor",
|
|
5409
5528
|
components: {
|
|
5410
5529
|
NavMenu: _sfc_main$h,
|
|
5411
|
-
Sidebar,
|
|
5530
|
+
Sidebar: _sfc_main$9,
|
|
5412
5531
|
Workspace: _sfc_main$1,
|
|
5413
5532
|
PropsPanel: _sfc_main$g,
|
|
5414
|
-
Framework: _sfc_main$
|
|
5533
|
+
Framework: _sfc_main$j
|
|
5415
5534
|
},
|
|
5416
5535
|
props: {
|
|
5417
5536
|
modelValue: {
|
|
@@ -5584,8 +5703,6 @@ const _sfc_main = defineComponent({
|
|
|
5584
5703
|
codeBlockService
|
|
5585
5704
|
};
|
|
5586
5705
|
provide("services", services);
|
|
5587
|
-
provide("layerContentMenu", props.layerContentMenu);
|
|
5588
|
-
provide("stageContentMenu", props.stageContentMenu);
|
|
5589
5706
|
provide(
|
|
5590
5707
|
"stageOptions",
|
|
5591
5708
|
reactive({
|
|
@@ -5605,21 +5722,32 @@ const _sfc_main = defineComponent({
|
|
|
5605
5722
|
}
|
|
5606
5723
|
});
|
|
5607
5724
|
|
|
5725
|
+
const _export_sfc = (sfc, props) => {
|
|
5726
|
+
const target = sfc.__vccOpts || sfc;
|
|
5727
|
+
for (const [key, val] of props) {
|
|
5728
|
+
target[key] = val;
|
|
5729
|
+
}
|
|
5730
|
+
return target;
|
|
5731
|
+
};
|
|
5732
|
+
|
|
5608
5733
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5609
|
-
const
|
|
5610
|
-
const
|
|
5611
|
-
const
|
|
5612
|
-
const
|
|
5613
|
-
const
|
|
5614
|
-
return openBlock(), createBlock(
|
|
5734
|
+
const _component_NavMenu = resolveComponent("NavMenu");
|
|
5735
|
+
const _component_Sidebar = resolveComponent("Sidebar");
|
|
5736
|
+
const _component_Workspace = resolveComponent("Workspace");
|
|
5737
|
+
const _component_PropsPanel = resolveComponent("PropsPanel");
|
|
5738
|
+
const _component_Framework = resolveComponent("Framework");
|
|
5739
|
+
return openBlock(), createBlock(_component_Framework, { "code-options": _ctx.codeOptions }, {
|
|
5615
5740
|
nav: withCtx(() => [
|
|
5616
5741
|
renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
|
|
5617
|
-
createVNode(
|
|
5742
|
+
createVNode(_component_NavMenu, { data: _ctx.menu }, null, 8, ["data"])
|
|
5618
5743
|
])
|
|
5619
5744
|
]),
|
|
5620
5745
|
sidebar: withCtx(() => [
|
|
5621
5746
|
renderSlot(_ctx.$slots, "sidebar", { editorService: _ctx.editorService }, () => [
|
|
5622
|
-
createVNode(
|
|
5747
|
+
createVNode(_component_Sidebar, {
|
|
5748
|
+
data: _ctx.sidebar,
|
|
5749
|
+
"layer-content-menu": _ctx.layerContentMenu
|
|
5750
|
+
}, {
|
|
5623
5751
|
"layer-panel-header": withCtx(() => [
|
|
5624
5752
|
renderSlot(_ctx.$slots, "layer-panel-header")
|
|
5625
5753
|
]),
|
|
@@ -5638,19 +5766,22 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
5638
5766
|
"code-block-panel-header": withCtx(() => [
|
|
5639
5767
|
renderSlot(_ctx.$slots, "code-block-panel-header")
|
|
5640
5768
|
]),
|
|
5641
|
-
"code-block-panel-tool": withCtx(({ id }) => [
|
|
5642
|
-
renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
5769
|
+
"code-block-panel-tool": withCtx(({ id, data }) => [
|
|
5770
|
+
renderSlot(_ctx.$slots, "code-block-panel-tool", {
|
|
5771
|
+
id,
|
|
5772
|
+
data
|
|
5773
|
+
})
|
|
5643
5774
|
]),
|
|
5644
5775
|
"code-block-edit-panel-header": withCtx(({ id }) => [
|
|
5645
5776
|
renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id })
|
|
5646
5777
|
]),
|
|
5647
5778
|
_: 3
|
|
5648
|
-
}, 8, ["data"])
|
|
5779
|
+
}, 8, ["data", "layer-content-menu"])
|
|
5649
5780
|
])
|
|
5650
5781
|
]),
|
|
5651
5782
|
workspace: withCtx(() => [
|
|
5652
5783
|
renderSlot(_ctx.$slots, "workspace", { editorService: _ctx.editorService }, () => [
|
|
5653
|
-
createVNode(
|
|
5784
|
+
createVNode(_component_Workspace, { "stage-content-menu": _ctx.stageContentMenu }, {
|
|
5654
5785
|
stage: withCtx(() => [
|
|
5655
5786
|
renderSlot(_ctx.$slots, "stage")
|
|
5656
5787
|
]),
|
|
@@ -5664,12 +5795,12 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
5664
5795
|
renderSlot(_ctx.$slots, "page-bar-popover", { page })
|
|
5665
5796
|
]),
|
|
5666
5797
|
_: 3
|
|
5667
|
-
})
|
|
5798
|
+
}, 8, ["stage-content-menu"])
|
|
5668
5799
|
])
|
|
5669
5800
|
]),
|
|
5670
5801
|
"props-panel": withCtx(() => [
|
|
5671
5802
|
renderSlot(_ctx.$slots, "props-panel", {}, () => [
|
|
5672
|
-
createVNode(
|
|
5803
|
+
createVNode(_component_PropsPanel, {
|
|
5673
5804
|
onMounted: _cache[0] || (_cache[0] = (instance) => _ctx.$emit("props-panel-mounted", instance))
|
|
5674
5805
|
}, {
|
|
5675
5806
|
"props-panel-header": withCtx(() => [
|
|
@@ -5699,10 +5830,10 @@ const index = {
|
|
|
5699
5830
|
app.component("m-fields-ui-select", _sfc_main$p);
|
|
5700
5831
|
app.component("m-fields-code-link", _sfc_main$r);
|
|
5701
5832
|
app.component("m-fields-vs-code", _sfc_main$s);
|
|
5702
|
-
app.component(
|
|
5833
|
+
app.component("magic-code-editor", _sfc_main$o);
|
|
5703
5834
|
app.component("m-fields-code-select", _sfc_main$q);
|
|
5704
5835
|
}
|
|
5705
5836
|
};
|
|
5706
5837
|
|
|
5707
|
-
export { COPY_STORAGE_KEY, _sfc_main$e as CodeBlockList, CodeDeleteErrorType, CodeEditorMode, CodeSelectOp, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$
|
|
5838
|
+
export { COPY_STORAGE_KEY, _sfc_main$e as CodeBlockList, CodeDeleteErrorType, CodeEditorMode, _sfc_main$q as CodeSelect, CodeSelectOp, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$l as Icon, Keys, LayerOffset, _sfc_main$a as LayerPanel, Layout, _sfc_main$m as LayoutContainer, _sfc_main$g as PropsPanel, _sfc_main$o as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$i as ToolButton, V_GUIDE_LINE_STORAGE_KEY, change2Fixed, codeBlockService, debug, index as default, editorService, error, eventsService, fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getRelativeStyle, historyService, info, isFixed, log, propsService, setConfig, setLayout, storageService, uiService, useStage, warn };
|
|
5708
5839
|
//# sourceMappingURL=tmagic-editor.mjs.map
|