@tmagic/editor 1.3.0-alpha.4 → 1.3.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/style.css +20 -5
- package/dist/tmagic-editor.js +291 -182
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +291 -181
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +10 -10
- package/src/Editor.vue +21 -1
- package/src/{layouts → components}/Resizer.vue +15 -6
- package/src/components/{Layout.vue → SplitView.vue} +1 -1
- package/src/index.ts +2 -1
- package/src/layouts/CodeEditor.vue +2 -2
- package/src/layouts/Framework.vue +16 -20
- package/src/layouts/sidebar/LayerPanel.vue +32 -15
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +3 -3
- package/src/layouts/workspace/Workspace.vue +3 -132
- package/src/services/keybinding.ts +240 -0
- package/src/theme/resizer.scss +25 -10
- package/src/type.ts +3 -1
- package/types/components/FunctionEditor.vue.d.ts +7 -7
- package/types/index.d.ts +2 -1
- package/types/layouts/CodeEditor.vue.d.ts +6 -6
- package/types/layouts/Framework.vue.d.ts +7 -31
- package/types/services/keybinding.d.ts +12 -0
- package/types/type.d.ts +3 -1
- /package/types/{layouts → components}/Resizer.vue.d.ts +0 -0
- /package/types/components/{Layout.vue.d.ts → SplitView.vue.d.ts} +0 -0
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
}
|
|
195
195
|
});
|
|
196
196
|
|
|
197
|
-
const _hoisted_1$
|
|
197
|
+
const _hoisted_1$n = ["src"];
|
|
198
198
|
const _sfc_main$B = /* @__PURE__ */ vue.defineComponent({
|
|
199
199
|
...{
|
|
200
200
|
name: "MEditorIcon"
|
|
@@ -218,7 +218,7 @@
|
|
|
218
218
|
class: "magic-editor-icon"
|
|
219
219
|
}, {
|
|
220
220
|
default: vue.withCtx(() => [
|
|
221
|
-
vue.createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$
|
|
221
|
+
vue.createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$n)
|
|
222
222
|
]),
|
|
223
223
|
_: 1
|
|
224
224
|
})) : typeof _ctx.icon === "string" ? (vue.openBlock(), vue.createElementBlock("i", {
|
|
@@ -237,7 +237,7 @@
|
|
|
237
237
|
}
|
|
238
238
|
});
|
|
239
239
|
|
|
240
|
-
const _hoisted_1$
|
|
240
|
+
const _hoisted_1$m = { class: "m-fields-code-select-col" };
|
|
241
241
|
const _hoisted_2$e = { class: "code-select-container" };
|
|
242
242
|
const _sfc_main$A = /* @__PURE__ */ vue.defineComponent({
|
|
243
243
|
...{
|
|
@@ -331,7 +331,7 @@
|
|
|
331
331
|
};
|
|
332
332
|
return (_ctx, _cache) => {
|
|
333
333
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
334
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
334
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$m, [
|
|
335
335
|
vue.createElementVNode("div", _hoisted_2$e, [
|
|
336
336
|
vue.createVNode(_component_m_form_container, {
|
|
337
337
|
class: "select",
|
|
@@ -355,7 +355,7 @@
|
|
|
355
355
|
}
|
|
356
356
|
});
|
|
357
357
|
|
|
358
|
-
const _hoisted_1$
|
|
358
|
+
const _hoisted_1$l = { class: "m-editor-data-source-fields" };
|
|
359
359
|
const _hoisted_2$d = { class: "m-editor-data-source-fields-footer" };
|
|
360
360
|
const _sfc_main$z = /* @__PURE__ */ vue.defineComponent({
|
|
361
361
|
...{
|
|
@@ -503,7 +503,7 @@
|
|
|
503
503
|
}
|
|
504
504
|
];
|
|
505
505
|
return (_ctx, _cache) => {
|
|
506
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
506
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$l, [
|
|
507
507
|
vue.createVNode(vue.unref(table.MagicTable), {
|
|
508
508
|
data: _ctx.model[_ctx.name],
|
|
509
509
|
columns: filedColumns
|
|
@@ -536,7 +536,7 @@
|
|
|
536
536
|
}
|
|
537
537
|
});
|
|
538
538
|
|
|
539
|
-
const _hoisted_1$
|
|
539
|
+
const _hoisted_1$k = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
540
540
|
const _hoisted_2$c = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
541
541
|
const _hoisted_3$5 = { class: "el-input__inner" };
|
|
542
542
|
const _sfc_main$y = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -762,7 +762,7 @@
|
|
|
762
762
|
vue.createVNode(_sfc_main$B, { icon: vue.unref(iconsVue.Coin) }, null, 8, ["icon"])
|
|
763
763
|
]),
|
|
764
764
|
default: vue.withCtx(({ item }) => [
|
|
765
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
765
|
+
vue.createElementVNode("div", _hoisted_1$k, [
|
|
766
766
|
vue.createElementVNode("div", null, vue.toDisplayString(item.text), 1),
|
|
767
767
|
vue.createElementVNode("span", _hoisted_2$c, vue.toDisplayString(item.value), 1)
|
|
768
768
|
])
|
|
@@ -801,7 +801,7 @@
|
|
|
801
801
|
}
|
|
802
802
|
});
|
|
803
803
|
|
|
804
|
-
const _hoisted_1$
|
|
804
|
+
const _hoisted_1$j = { class: "m-fields-event-select" };
|
|
805
805
|
const _hoisted_2$b = {
|
|
806
806
|
key: 1,
|
|
807
807
|
class: "fullWidth"
|
|
@@ -968,7 +968,7 @@
|
|
|
968
968
|
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
969
969
|
const _component_m_form_container = vue.resolveComponent("m-form-container");
|
|
970
970
|
const _component_m_form_panel = vue.resolveComponent("m-form-panel");
|
|
971
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
971
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$j, [
|
|
972
972
|
isOldVersion.value ? (vue.openBlock(), vue.createBlock(_component_m_form_table, {
|
|
973
973
|
key: 0,
|
|
974
974
|
ref: "eventForm",
|
|
@@ -1019,7 +1019,7 @@
|
|
|
1019
1019
|
}
|
|
1020
1020
|
});
|
|
1021
1021
|
|
|
1022
|
-
const _hoisted_1$
|
|
1022
|
+
const _hoisted_1$i = { class: "m-fields-key-value" };
|
|
1023
1023
|
const _hoisted_2$a = /* @__PURE__ */ vue.createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
1024
1024
|
const _sfc_main$w = /* @__PURE__ */ vue.defineComponent({
|
|
1025
1025
|
...{
|
|
@@ -1064,7 +1064,7 @@
|
|
|
1064
1064
|
records.value.splice(index, 1);
|
|
1065
1065
|
};
|
|
1066
1066
|
return (_ctx, _cache) => {
|
|
1067
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
1067
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$i, [
|
|
1068
1068
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(records.value, (item, index) => {
|
|
1069
1069
|
return vue.openBlock(), vue.createElementBlock("div", {
|
|
1070
1070
|
class: "m-fields-key-value-item",
|
|
@@ -1370,6 +1370,7 @@
|
|
|
1370
1370
|
emits: ["change"],
|
|
1371
1371
|
setup(__props, { emit }) {
|
|
1372
1372
|
const target = vue.ref();
|
|
1373
|
+
const isDraging = vue.ref(false);
|
|
1373
1374
|
let getso;
|
|
1374
1375
|
vue.onMounted(() => {
|
|
1375
1376
|
if (!target.value)
|
|
@@ -1381,19 +1382,24 @@
|
|
|
1381
1382
|
if (!target.value)
|
|
1382
1383
|
return;
|
|
1383
1384
|
emit("change", e.deltaX);
|
|
1385
|
+
}).on("dragStart", () => {
|
|
1386
|
+
isDraging.value = true;
|
|
1387
|
+
}).on("dragEnd", () => {
|
|
1388
|
+
isDraging.value = false;
|
|
1384
1389
|
});
|
|
1385
1390
|
});
|
|
1386
1391
|
vue.onUnmounted(() => {
|
|
1387
1392
|
getso?.unset();
|
|
1393
|
+
isDraging.value = false;
|
|
1388
1394
|
});
|
|
1389
1395
|
return (_ctx, _cache) => {
|
|
1390
1396
|
return vue.openBlock(), vue.createElementBlock("span", {
|
|
1391
1397
|
ref_key: "target",
|
|
1392
1398
|
ref: target,
|
|
1393
|
-
class: "m-editor-resizer"
|
|
1399
|
+
class: vue.normalizeClass(["m-editor-resizer", { "m-editor-resizer-draging": isDraging.value }])
|
|
1394
1400
|
}, [
|
|
1395
1401
|
vue.renderSlot(_ctx.$slots, "default")
|
|
1396
|
-
],
|
|
1402
|
+
], 2);
|
|
1397
1403
|
};
|
|
1398
1404
|
}
|
|
1399
1405
|
});
|
|
@@ -1402,7 +1408,7 @@
|
|
|
1402
1408
|
...{
|
|
1403
1409
|
name: "MEditorLayout"
|
|
1404
1410
|
},
|
|
1405
|
-
__name: "
|
|
1411
|
+
__name: "SplitView",
|
|
1406
1412
|
props: {
|
|
1407
1413
|
left: {},
|
|
1408
1414
|
right: {},
|
|
@@ -3386,7 +3392,7 @@
|
|
|
3386
3392
|
return stage;
|
|
3387
3393
|
};
|
|
3388
3394
|
|
|
3389
|
-
const _hoisted_1$
|
|
3395
|
+
const _hoisted_1$h = { class: "m-editor-empty-panel" };
|
|
3390
3396
|
const _hoisted_2$9 = { class: "m-editor-empty-content" };
|
|
3391
3397
|
const _hoisted_3$4 = /* @__PURE__ */ vue.createElementVNode("p", null, "新增页面", -1);
|
|
3392
3398
|
const _sfc_main$r = /* @__PURE__ */ vue.defineComponent({
|
|
@@ -3409,7 +3415,7 @@
|
|
|
3409
3415
|
});
|
|
3410
3416
|
};
|
|
3411
3417
|
return (_ctx, _cache) => {
|
|
3412
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3418
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$h, [
|
|
3413
3419
|
vue.createElementVNode("div", _hoisted_2$9, [
|
|
3414
3420
|
vue.createElementVNode("div", {
|
|
3415
3421
|
class: "m-editor-empty-button",
|
|
@@ -3426,7 +3432,7 @@
|
|
|
3426
3432
|
}
|
|
3427
3433
|
});
|
|
3428
3434
|
|
|
3429
|
-
const _hoisted_1$
|
|
3435
|
+
const _hoisted_1$g = { class: "m-editor" };
|
|
3430
3436
|
const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
3431
3437
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
3432
3438
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
@@ -3436,10 +3442,8 @@
|
|
|
3436
3442
|
name: "MEditorFramework"
|
|
3437
3443
|
},
|
|
3438
3444
|
__name: "Framework",
|
|
3439
|
-
props: {
|
|
3440
|
-
codeOptions: { default: () => ({}) }
|
|
3441
|
-
},
|
|
3442
3445
|
setup(__props) {
|
|
3446
|
+
const codeOptions = vue.inject("codeOptions", {});
|
|
3443
3447
|
const { editorService, uiService } = vue.inject("services") || {};
|
|
3444
3448
|
const root = vue.computed(() => editorService?.get("root"));
|
|
3445
3449
|
const nodes = vue.computed(() => editorService?.get("nodes") || []);
|
|
@@ -3499,16 +3503,18 @@
|
|
|
3499
3503
|
}
|
|
3500
3504
|
};
|
|
3501
3505
|
return (_ctx, _cache) => {
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
vue.renderSlot(_ctx.$slots, "nav"
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3506
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$g, [
|
|
3507
|
+
vue.renderSlot(_ctx.$slots, "header"),
|
|
3508
|
+
vue.renderSlot(_ctx.$slots, "nav"),
|
|
3509
|
+
vue.renderSlot(_ctx.$slots, "content-before"),
|
|
3510
|
+
showSrc.value ? vue.renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
|
|
3511
|
+
vue.createVNode(_sfc_main$u, {
|
|
3512
|
+
class: "m-editor-content",
|
|
3513
|
+
"init-values": root.value,
|
|
3514
|
+
options: vue.unref(codeOptions),
|
|
3515
|
+
onSave: saveCode
|
|
3516
|
+
}, null, 8, ["init-values", "options"])
|
|
3517
|
+
]) : (vue.openBlock(), vue.createBlock(_sfc_main$s, {
|
|
3512
3518
|
key: 1,
|
|
3513
3519
|
class: "m-editor-content",
|
|
3514
3520
|
"left-class": "m-editor-framework-left",
|
|
@@ -3544,13 +3550,15 @@
|
|
|
3544
3550
|
]),
|
|
3545
3551
|
key: "0"
|
|
3546
3552
|
} : void 0
|
|
3547
|
-
]), 1032, ["left", "right"]))
|
|
3553
|
+
]), 1032, ["left", "right"])),
|
|
3554
|
+
vue.renderSlot(_ctx.$slots, "content-after"),
|
|
3555
|
+
vue.renderSlot(_ctx.$slots, "footer")
|
|
3548
3556
|
]);
|
|
3549
3557
|
};
|
|
3550
3558
|
}
|
|
3551
3559
|
});
|
|
3552
3560
|
|
|
3553
|
-
const _hoisted_1$
|
|
3561
|
+
const _hoisted_1$f = {
|
|
3554
3562
|
key: 1,
|
|
3555
3563
|
class: "menu-item-text"
|
|
3556
3564
|
};
|
|
@@ -3634,7 +3642,7 @@
|
|
|
3634
3642
|
_ctx.data.type === "divider" ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicDivider), {
|
|
3635
3643
|
key: 0,
|
|
3636
3644
|
direction: _ctx.data.direction || "vertical"
|
|
3637
|
-
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3645
|
+
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$f, vue.toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, { key: 2 }, [
|
|
3638
3646
|
_ctx.data.tooltip ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicTooltip), {
|
|
3639
3647
|
key: 0,
|
|
3640
3648
|
effect: "dark",
|
|
@@ -3889,7 +3897,7 @@
|
|
|
3889
3897
|
}
|
|
3890
3898
|
});
|
|
3891
3899
|
|
|
3892
|
-
const _hoisted_1$
|
|
3900
|
+
const _hoisted_1$e = { class: "m-editor-props-panel" };
|
|
3893
3901
|
const _sfc_main$n = /* @__PURE__ */ vue.defineComponent({
|
|
3894
3902
|
...{
|
|
3895
3903
|
name: "MEditorPropsPanel"
|
|
@@ -3939,7 +3947,7 @@
|
|
|
3939
3947
|
};
|
|
3940
3948
|
__expose({ submit });
|
|
3941
3949
|
return (_ctx, _cache) => {
|
|
3942
|
-
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
3950
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$e, [
|
|
3943
3951
|
vue.renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3944
3952
|
vue.createVNode(vue.unref(form.MForm), {
|
|
3945
3953
|
ref_key: "configForm",
|
|
@@ -3991,7 +3999,7 @@
|
|
|
3991
3999
|
}
|
|
3992
4000
|
});
|
|
3993
4001
|
|
|
3994
|
-
const _hoisted_1$
|
|
4002
|
+
const _hoisted_1$d = { xmlns: "http://www.w3.org/2000/svg" };
|
|
3995
4003
|
const _hoisted_2$7 = /* @__PURE__ */ vue.createElementVNode("g", {
|
|
3996
4004
|
fill: "#7C878E",
|
|
3997
4005
|
"fill-rule": "evenodd"
|
|
@@ -4012,12 +4020,12 @@
|
|
|
4012
4020
|
__name: "AppManageIcon",
|
|
4013
4021
|
setup(__props) {
|
|
4014
4022
|
return (_ctx, _cache) => {
|
|
4015
|
-
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$
|
|
4023
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$d, _hoisted_3$3);
|
|
4016
4024
|
};
|
|
4017
4025
|
}
|
|
4018
4026
|
});
|
|
4019
4027
|
|
|
4020
|
-
const _hoisted_1$
|
|
4028
|
+
const _hoisted_1$c = {
|
|
4021
4029
|
viewBox: "0 0 32 32",
|
|
4022
4030
|
version: "1.1",
|
|
4023
4031
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4034,12 +4042,12 @@
|
|
|
4034
4042
|
__name: "CodeIcon",
|
|
4035
4043
|
setup(__props) {
|
|
4036
4044
|
return (_ctx, _cache) => {
|
|
4037
|
-
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$
|
|
4045
|
+
return vue.openBlock(), vue.createElementBlock("svg", _hoisted_1$c, _hoisted_4$3);
|
|
4038
4046
|
};
|
|
4039
4047
|
}
|
|
4040
4048
|
});
|
|
4041
4049
|
|
|
4042
|
-
const _hoisted_1$
|
|
4050
|
+
const _hoisted_1$b = {
|
|
4043
4051
|
key: 0,
|
|
4044
4052
|
class: "m-editor-content-bottom"
|
|
4045
4053
|
};
|
|
@@ -4143,7 +4151,7 @@
|
|
|
4143
4151
|
language: _ctx.language,
|
|
4144
4152
|
options: codeOptions.value
|
|
4145
4153
|
}, null, 8, ["init-values", "language", "options"]),
|
|
4146
|
-
_ctx.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4154
|
+
_ctx.editable ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$b, [
|
|
4147
4155
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4148
4156
|
type: "primary",
|
|
4149
4157
|
class: "button",
|
|
@@ -4199,7 +4207,7 @@
|
|
|
4199
4207
|
}
|
|
4200
4208
|
});
|
|
4201
4209
|
|
|
4202
|
-
const _hoisted_1$
|
|
4210
|
+
const _hoisted_1$a = { class: "code-name-wrapper" };
|
|
4203
4211
|
const _hoisted_2$4 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
|
|
4204
4212
|
const _hoisted_3$2 = { class: "code-name-wrapper" };
|
|
4205
4213
|
const _hoisted_4$2 = /* @__PURE__ */ vue.createElementVNode("div", { class: "code-name-label" }, "参数", -1);
|
|
@@ -4325,7 +4333,7 @@
|
|
|
4325
4333
|
const _component_m_form_table = vue.resolveComponent("m-form-table");
|
|
4326
4334
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicCard), { shadow: "never" }, {
|
|
4327
4335
|
header: vue.withCtx(() => [
|
|
4328
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
4336
|
+
vue.createElementVNode("div", _hoisted_1$a, [
|
|
4329
4337
|
_hoisted_2$4,
|
|
4330
4338
|
vue.createVNode(vue.unref(design.TMagicInput), {
|
|
4331
4339
|
class: "code-name-input",
|
|
@@ -4367,7 +4375,7 @@
|
|
|
4367
4375
|
}
|
|
4368
4376
|
});
|
|
4369
4377
|
|
|
4370
|
-
const _hoisted_1$
|
|
4378
|
+
const _hoisted_1$9 = {
|
|
4371
4379
|
key: 0,
|
|
4372
4380
|
class: "m-editor-code-block-editor-panel"
|
|
4373
4381
|
};
|
|
@@ -4435,7 +4443,7 @@
|
|
|
4435
4443
|
class: "code-editor-layout"
|
|
4436
4444
|
}, {
|
|
4437
4445
|
center: vue.withCtx(() => [
|
|
4438
|
-
!vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
4446
|
+
!vue.unref(lodashEs.isEmpty)(codeConfig.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [
|
|
4439
4447
|
vue.renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: id.value }),
|
|
4440
4448
|
codeConfig.value ? (vue.openBlock(), vue.createBlock(_sfc_main$i, {
|
|
4441
4449
|
key: 0,
|
|
@@ -4460,7 +4468,7 @@
|
|
|
4460
4468
|
}
|
|
4461
4469
|
});
|
|
4462
4470
|
|
|
4463
|
-
const _hoisted_1$
|
|
4471
|
+
const _hoisted_1$8 = { class: "search-wrapper" };
|
|
4464
4472
|
const _hoisted_2$3 = ["id"];
|
|
4465
4473
|
const _hoisted_3$1 = { class: "list-item" };
|
|
4466
4474
|
const _hoisted_4$1 = {
|
|
@@ -4563,7 +4571,7 @@
|
|
|
4563
4571
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
|
|
4564
4572
|
default: vue.withCtx(() => [
|
|
4565
4573
|
vue.renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
4566
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
4574
|
+
vue.createElementVNode("div", _hoisted_1$8, [
|
|
4567
4575
|
vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
|
|
4568
4576
|
editable.value ? (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
4569
4577
|
key: 0,
|
|
@@ -4758,7 +4766,7 @@
|
|
|
4758
4766
|
}
|
|
4759
4767
|
});
|
|
4760
4768
|
|
|
4761
|
-
const _hoisted_1$
|
|
4769
|
+
const _hoisted_1$7 = { class: "search-wrapper" };
|
|
4762
4770
|
const _hoisted_2$2 = ["id"];
|
|
4763
4771
|
const _hoisted_3 = { class: "list-item" };
|
|
4764
4772
|
const _hoisted_4 = {
|
|
@@ -4827,7 +4835,7 @@
|
|
|
4827
4835
|
return (_ctx, _cache) => {
|
|
4828
4836
|
return vue.openBlock(), vue.createBlock(vue.unref(design.TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
|
|
4829
4837
|
default: vue.withCtx(() => [
|
|
4830
|
-
vue.createElementVNode("div", _hoisted_1$
|
|
4838
|
+
vue.createElementVNode("div", _hoisted_1$7, [
|
|
4831
4839
|
vue.createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
|
|
4832
4840
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4833
4841
|
type: "primary",
|
|
@@ -4923,7 +4931,7 @@
|
|
|
4923
4931
|
}
|
|
4924
4932
|
});
|
|
4925
4933
|
|
|
4926
|
-
const _hoisted_1$
|
|
4934
|
+
const _hoisted_1$6 = ["onClick", "onDragstart"];
|
|
4927
4935
|
const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
|
|
4928
4936
|
...{
|
|
4929
4937
|
name: "MEditorComponentListPanel"
|
|
@@ -5041,7 +5049,7 @@
|
|
|
5041
5049
|
_: 2
|
|
5042
5050
|
}, 1032, ["content"])
|
|
5043
5051
|
])
|
|
5044
|
-
], 40, _hoisted_1$
|
|
5052
|
+
], 40, _hoisted_1$6);
|
|
5045
5053
|
}), 128))
|
|
5046
5054
|
]),
|
|
5047
5055
|
_: 2
|
|
@@ -5280,7 +5288,7 @@
|
|
|
5280
5288
|
}
|
|
5281
5289
|
});
|
|
5282
5290
|
|
|
5283
|
-
const _hoisted_1$
|
|
5291
|
+
const _hoisted_1$5 = ["id", "onMouseenter"];
|
|
5284
5292
|
const throttleTime = 150;
|
|
5285
5293
|
const _sfc_main$a = /* @__PURE__ */ vue.defineComponent({
|
|
5286
5294
|
...{
|
|
@@ -5293,6 +5301,7 @@
|
|
|
5293
5301
|
setup(__props) {
|
|
5294
5302
|
const services = vue.inject("services");
|
|
5295
5303
|
const editorService = services?.editorService;
|
|
5304
|
+
const keybindingService = services?.keybindingService;
|
|
5296
5305
|
const tree = vue.ref();
|
|
5297
5306
|
const menu = vue.ref();
|
|
5298
5307
|
const checkedKeys = vue.ref([]);
|
|
@@ -5426,27 +5435,38 @@
|
|
|
5426
5435
|
const windowBlurHandler = () => {
|
|
5427
5436
|
isCtrlKeyDown.value = false;
|
|
5428
5437
|
};
|
|
5438
|
+
const globalKeyupHandler = () => {
|
|
5439
|
+
if (document.activeElement !== tree.value?.$el) {
|
|
5440
|
+
isCtrlKeyDown.value = false;
|
|
5441
|
+
}
|
|
5442
|
+
};
|
|
5429
5443
|
let keycon;
|
|
5430
5444
|
vue.onMounted(() => {
|
|
5431
5445
|
editorService?.on("remove", editorServiceRemoveHandler);
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5446
|
+
if (tree.value?.$el) {
|
|
5447
|
+
keybindingService?.on("keyup", globalKeyupHandler);
|
|
5448
|
+
keycon = new KeyController(tree.value.$el);
|
|
5449
|
+
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
5450
|
+
const ctrl = isMac ? "meta" : "ctrl";
|
|
5451
|
+
keycon.keydown((e) => {
|
|
5452
|
+
if (e.key !== ctrl) {
|
|
5453
|
+
isCtrlKeyDown.value = false;
|
|
5454
|
+
}
|
|
5455
|
+
}).keydown(ctrl, () => {
|
|
5456
|
+
isCtrlKeyDown.value = true;
|
|
5457
|
+
}).keyup(ctrl, () => {
|
|
5437
5458
|
isCtrlKeyDown.value = false;
|
|
5438
|
-
}
|
|
5439
|
-
|
|
5440
|
-
|
|
5441
|
-
}).keyup(ctrl, () => {
|
|
5442
|
-
isCtrlKeyDown.value = false;
|
|
5443
|
-
});
|
|
5459
|
+
});
|
|
5460
|
+
tree.value.$el.addEventListener("blur", windowBlurHandler);
|
|
5461
|
+
}
|
|
5444
5462
|
globalThis.addEventListener("blur", windowBlurHandler);
|
|
5445
5463
|
});
|
|
5446
5464
|
vue.onUnmounted(() => {
|
|
5447
5465
|
keycon.destroy();
|
|
5448
5466
|
editorService?.off("remove", editorServiceRemoveHandler);
|
|
5467
|
+
keybindingService?.off("keyup", globalKeyupHandler);
|
|
5449
5468
|
globalThis.removeEventListener("blur", windowBlurHandler);
|
|
5469
|
+
tree.value?.$el.removeEventListener("blur", windowBlurHandler);
|
|
5450
5470
|
});
|
|
5451
5471
|
const highlightHandler = lodashEs.throttle((data) => {
|
|
5452
5472
|
highlight(data);
|
|
@@ -5491,6 +5511,7 @@
|
|
|
5491
5511
|
ref: tree,
|
|
5492
5512
|
"node-key": "id",
|
|
5493
5513
|
"empty-text": "页面空荡荡的",
|
|
5514
|
+
tabindex: "-1",
|
|
5494
5515
|
draggable: "",
|
|
5495
5516
|
"default-expanded-keys": expandedKeys.value,
|
|
5496
5517
|
"default-checked-keys": checkedKeys.value,
|
|
@@ -5524,7 +5545,7 @@
|
|
|
5524
5545
|
}, () => [
|
|
5525
5546
|
vue.createElementVNode("span", null, vue.toDisplayString(`${data.name} (${data.id})`), 1)
|
|
5526
5547
|
])
|
|
5527
|
-
], 40, _hoisted_1$
|
|
5548
|
+
], 40, _hoisted_1$5)
|
|
5528
5549
|
]),
|
|
5529
5550
|
_: 3
|
|
5530
5551
|
}, 8, ["default-expanded-keys", "default-checked-keys", "current-node-key", "data", "highlight-current", "show-checkbox"])) : vue.createCommentVNode("", true),
|
|
@@ -5542,7 +5563,7 @@
|
|
|
5542
5563
|
}
|
|
5543
5564
|
});
|
|
5544
5565
|
|
|
5545
|
-
const _hoisted_1$
|
|
5566
|
+
const _hoisted_1$4 = {
|
|
5546
5567
|
key: 1,
|
|
5547
5568
|
class: "magic-editor-tab-panel-title"
|
|
5548
5569
|
};
|
|
@@ -5630,7 +5651,7 @@
|
|
|
5630
5651
|
key: 0,
|
|
5631
5652
|
icon: config.icon
|
|
5632
5653
|
}, null, 8, ["icon"])) : vue.createCommentVNode("", true),
|
|
5633
|
-
config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5654
|
+
config.text ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$4, vue.toDisplayString(config.text), 1)) : vue.createCommentVNode("", true)
|
|
5634
5655
|
]))
|
|
5635
5656
|
]),
|
|
5636
5657
|
default: vue.withCtx(() => [
|
|
@@ -5717,7 +5738,7 @@
|
|
|
5717
5738
|
}
|
|
5718
5739
|
});
|
|
5719
5740
|
|
|
5720
|
-
const _hoisted_1$
|
|
5741
|
+
const _hoisted_1$3 = {
|
|
5721
5742
|
key: 0,
|
|
5722
5743
|
class: "m-editor-breadcrumb"
|
|
5723
5744
|
};
|
|
@@ -5739,7 +5760,7 @@
|
|
|
5739
5760
|
editorService?.get("stage")?.select(node2.id);
|
|
5740
5761
|
};
|
|
5741
5762
|
return (_ctx, _cache) => {
|
|
5742
|
-
return nodes.value.length === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5763
|
+
return nodes.value.length === 1 ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [
|
|
5743
5764
|
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(path.value, (item, index) => {
|
|
5744
5765
|
return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
|
|
5745
5766
|
key: item.id
|
|
@@ -5762,7 +5783,7 @@
|
|
|
5762
5783
|
}
|
|
5763
5784
|
});
|
|
5764
5785
|
|
|
5765
|
-
const _hoisted_1$
|
|
5786
|
+
const _hoisted_1$2 = {
|
|
5766
5787
|
key: 1,
|
|
5767
5788
|
style: { "width": "21px" }
|
|
5768
5789
|
};
|
|
@@ -5855,7 +5876,7 @@
|
|
|
5855
5876
|
onClick: addPage
|
|
5856
5877
|
}, [
|
|
5857
5878
|
vue.createVNode(_sfc_main$B, { icon: vue.unref(iconsVue.Plus) }, null, 8, ["icon"])
|
|
5858
|
-
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$
|
|
5879
|
+
])) : (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2)),
|
|
5859
5880
|
canScroll.value ? (vue.openBlock(), vue.createElementBlock("div", {
|
|
5860
5881
|
key: 2,
|
|
5861
5882
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
@@ -5884,7 +5905,7 @@
|
|
|
5884
5905
|
}
|
|
5885
5906
|
});
|
|
5886
5907
|
|
|
5887
|
-
const _hoisted_1 = ["onClick"];
|
|
5908
|
+
const _hoisted_1$1 = ["onClick"];
|
|
5888
5909
|
const _hoisted_2 = { class: "m-editor-page-bar-title" };
|
|
5889
5910
|
const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
|
|
5890
5911
|
...{
|
|
@@ -5970,7 +5991,7 @@
|
|
|
5970
5991
|
]),
|
|
5971
5992
|
_: 2
|
|
5972
5993
|
}, 1024)
|
|
5973
|
-
], 10, _hoisted_1);
|
|
5994
|
+
], 10, _hoisted_1$1);
|
|
5974
5995
|
}), 128))
|
|
5975
5996
|
]),
|
|
5976
5997
|
_: 3
|
|
@@ -6623,6 +6644,10 @@
|
|
|
6623
6644
|
}
|
|
6624
6645
|
});
|
|
6625
6646
|
|
|
6647
|
+
const _hoisted_1 = {
|
|
6648
|
+
class: "m-editor-workspace",
|
|
6649
|
+
tabindex: "-1"
|
|
6650
|
+
};
|
|
6626
6651
|
const _sfc_main$1 = /* @__PURE__ */ vue.defineComponent({
|
|
6627
6652
|
...{
|
|
6628
6653
|
name: "MEditorWorkspace"
|
|
@@ -6633,112 +6658,9 @@
|
|
|
6633
6658
|
},
|
|
6634
6659
|
setup(__props) {
|
|
6635
6660
|
const services = vue.inject("services");
|
|
6636
|
-
const workspace = vue.ref();
|
|
6637
|
-
const nodes = vue.computed(() => services?.editorService.get("nodes"));
|
|
6638
6661
|
const page = vue.computed(() => services?.editorService.get("page"));
|
|
6639
|
-
const mouseenterHandler = () => {
|
|
6640
|
-
workspace.value?.focus();
|
|
6641
|
-
};
|
|
6642
|
-
const mouseleaveHandler = () => {
|
|
6643
|
-
workspace.value?.blur();
|
|
6644
|
-
};
|
|
6645
|
-
let keycon;
|
|
6646
|
-
vue.onMounted(() => {
|
|
6647
|
-
workspace.value?.addEventListener("mouseenter", mouseenterHandler);
|
|
6648
|
-
workspace.value?.addEventListener("mouseleave", mouseleaveHandler);
|
|
6649
|
-
keycon = new KeyController(workspace.value);
|
|
6650
|
-
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
6651
|
-
const ctrl = isMac ? "meta" : "ctrl";
|
|
6652
|
-
keycon.keyup("delete", (e) => {
|
|
6653
|
-
e.inputEvent.preventDefault();
|
|
6654
|
-
if (!nodes.value || utils.isPage(nodes.value[0]))
|
|
6655
|
-
return;
|
|
6656
|
-
services?.editorService.remove(nodes.value);
|
|
6657
|
-
}).keyup("backspace", (e) => {
|
|
6658
|
-
e.inputEvent.preventDefault();
|
|
6659
|
-
if (!nodes.value || utils.isPage(nodes.value[0]))
|
|
6660
|
-
return;
|
|
6661
|
-
services?.editorService.remove(nodes.value);
|
|
6662
|
-
}).keydown([ctrl, "c"], (e) => {
|
|
6663
|
-
e.inputEvent.preventDefault();
|
|
6664
|
-
nodes.value && services?.editorService.copy(nodes.value);
|
|
6665
|
-
}).keydown([ctrl, "v"], (e) => {
|
|
6666
|
-
e.inputEvent.preventDefault();
|
|
6667
|
-
nodes.value && services?.editorService.paste({ offsetX: 10, offsetY: 10 });
|
|
6668
|
-
}).keydown([ctrl, "x"], (e) => {
|
|
6669
|
-
e.inputEvent.preventDefault();
|
|
6670
|
-
if (!nodes.value || utils.isPage(nodes.value[0]))
|
|
6671
|
-
return;
|
|
6672
|
-
services?.editorService.copy(nodes.value);
|
|
6673
|
-
services?.editorService.remove(nodes.value);
|
|
6674
|
-
}).keydown([ctrl, "z"], (e) => {
|
|
6675
|
-
e.inputEvent.preventDefault();
|
|
6676
|
-
services?.editorService.undo();
|
|
6677
|
-
}).keydown([ctrl, "shift", "z"], (e) => {
|
|
6678
|
-
e.inputEvent.preventDefault();
|
|
6679
|
-
services?.editorService.redo();
|
|
6680
|
-
}).keydown("up", (e) => {
|
|
6681
|
-
e.inputEvent.preventDefault();
|
|
6682
|
-
services?.editorService.move(0, -1);
|
|
6683
|
-
}).keydown("down", (e) => {
|
|
6684
|
-
e.inputEvent.preventDefault();
|
|
6685
|
-
services?.editorService.move(0, 1);
|
|
6686
|
-
}).keydown("left", (e) => {
|
|
6687
|
-
e.inputEvent.preventDefault();
|
|
6688
|
-
services?.editorService.move(-1, 0);
|
|
6689
|
-
}).keydown("right", (e) => {
|
|
6690
|
-
e.inputEvent.preventDefault();
|
|
6691
|
-
services?.editorService.move(1, 0);
|
|
6692
|
-
}).keydown([ctrl, "up"], (e) => {
|
|
6693
|
-
e.inputEvent.preventDefault();
|
|
6694
|
-
services?.editorService.move(0, -10);
|
|
6695
|
-
}).keydown([ctrl, "down"], (e) => {
|
|
6696
|
-
e.inputEvent.preventDefault();
|
|
6697
|
-
services?.editorService.move(0, 10);
|
|
6698
|
-
}).keydown([ctrl, "left"], (e) => {
|
|
6699
|
-
e.inputEvent.preventDefault();
|
|
6700
|
-
services?.editorService.move(-10, 0);
|
|
6701
|
-
}).keydown([ctrl, "right"], (e) => {
|
|
6702
|
-
e.inputEvent.preventDefault();
|
|
6703
|
-
services?.editorService.move(10, 0);
|
|
6704
|
-
}).keydown("tab", (e) => {
|
|
6705
|
-
e.inputEvent.preventDefault();
|
|
6706
|
-
services?.editorService.selectNextNode();
|
|
6707
|
-
}).keydown([ctrl, "tab"], (e) => {
|
|
6708
|
-
e.inputEvent.preventDefault();
|
|
6709
|
-
services?.editorService.selectNextPage();
|
|
6710
|
-
}).keydown([ctrl, "="], (e) => {
|
|
6711
|
-
e.inputEvent.preventDefault();
|
|
6712
|
-
services?.uiService.zoom(0.1);
|
|
6713
|
-
}).keydown([ctrl, "numpadplus"], (e) => {
|
|
6714
|
-
e.inputEvent.preventDefault();
|
|
6715
|
-
services?.uiService.zoom(0.1);
|
|
6716
|
-
}).keydown([ctrl, "-"], (e) => {
|
|
6717
|
-
e.inputEvent.preventDefault();
|
|
6718
|
-
services?.uiService.zoom(-0.1);
|
|
6719
|
-
}).keydown([ctrl, "numpad-"], (e) => {
|
|
6720
|
-
e.inputEvent.preventDefault();
|
|
6721
|
-
services?.uiService.zoom(-0.1);
|
|
6722
|
-
}).keydown([ctrl, "0"], async (e) => {
|
|
6723
|
-
e.inputEvent.preventDefault();
|
|
6724
|
-
services?.uiService.set("zoom", await services.uiService.calcZoom());
|
|
6725
|
-
}).keydown([ctrl, "1"], (e) => {
|
|
6726
|
-
e.inputEvent.preventDefault();
|
|
6727
|
-
services?.uiService.set("zoom", 1);
|
|
6728
|
-
});
|
|
6729
|
-
});
|
|
6730
|
-
vue.onUnmounted(() => {
|
|
6731
|
-
workspace.value?.removeEventListener("mouseenter", mouseenterHandler);
|
|
6732
|
-
workspace.value?.removeEventListener("mouseleave", mouseleaveHandler);
|
|
6733
|
-
keycon.destroy();
|
|
6734
|
-
});
|
|
6735
6662
|
return (_ctx, _cache) => {
|
|
6736
|
-
return vue.openBlock(), vue.createElementBlock("div",
|
|
6737
|
-
class: "m-editor-workspace",
|
|
6738
|
-
tabindex: "-1",
|
|
6739
|
-
ref_key: "workspace",
|
|
6740
|
-
ref: workspace
|
|
6741
|
-
}, [
|
|
6663
|
+
return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
|
|
6742
6664
|
vue.createVNode(_sfc_main$8),
|
|
6743
6665
|
vue.renderSlot(_ctx.$slots, "stage", {}, () => [
|
|
6744
6666
|
page.value ? (vue.openBlock(), vue.createBlock(_sfc_main$2, {
|
|
@@ -6756,7 +6678,7 @@
|
|
|
6756
6678
|
]),
|
|
6757
6679
|
_: 3
|
|
6758
6680
|
})
|
|
6759
|
-
]
|
|
6681
|
+
]);
|
|
6760
6682
|
};
|
|
6761
6683
|
}
|
|
6762
6684
|
});
|
|
@@ -7480,6 +7402,177 @@
|
|
|
7480
7402
|
}
|
|
7481
7403
|
const eventsService = new Events();
|
|
7482
7404
|
|
|
7405
|
+
class Keybinding extends BaseService {
|
|
7406
|
+
keycon = new KeyController();
|
|
7407
|
+
ctrlKey = /mac os x/.test(navigator.userAgent.toLowerCase()) ? "meta" : "ctrl";
|
|
7408
|
+
constructor() {
|
|
7409
|
+
super();
|
|
7410
|
+
this.keycon.keyup((e) => {
|
|
7411
|
+
this.emit("keyup", e.inputEvent);
|
|
7412
|
+
}).keyup("delete", (e) => {
|
|
7413
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7414
|
+
return;
|
|
7415
|
+
}
|
|
7416
|
+
e.inputEvent.preventDefault();
|
|
7417
|
+
this.removeNode();
|
|
7418
|
+
}).keyup("backspace", (e) => {
|
|
7419
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7420
|
+
return;
|
|
7421
|
+
}
|
|
7422
|
+
e.inputEvent.preventDefault();
|
|
7423
|
+
this.removeNode();
|
|
7424
|
+
}).keydown([this.ctrlKey, "c"], (e) => {
|
|
7425
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7426
|
+
return;
|
|
7427
|
+
}
|
|
7428
|
+
e.inputEvent.preventDefault();
|
|
7429
|
+
const nodes = editorService.get("nodes");
|
|
7430
|
+
nodes && editorService.copy(nodes);
|
|
7431
|
+
}).keydown([this.ctrlKey, "v"], (e) => {
|
|
7432
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7433
|
+
return;
|
|
7434
|
+
}
|
|
7435
|
+
e.inputEvent.preventDefault();
|
|
7436
|
+
const nodes = editorService.get("nodes");
|
|
7437
|
+
nodes && editorService.paste({ offsetX: 10, offsetY: 10 });
|
|
7438
|
+
}).keydown([this.ctrlKey, "x"], (e) => {
|
|
7439
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7440
|
+
return;
|
|
7441
|
+
}
|
|
7442
|
+
e.inputEvent.preventDefault();
|
|
7443
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7444
|
+
return;
|
|
7445
|
+
}
|
|
7446
|
+
const nodes = editorService.get("nodes");
|
|
7447
|
+
if (!nodes || utils.isPage(nodes[0]))
|
|
7448
|
+
return;
|
|
7449
|
+
editorService.copy(nodes);
|
|
7450
|
+
editorService.remove(nodes);
|
|
7451
|
+
}).keydown([this.ctrlKey, "z"], (e) => {
|
|
7452
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7453
|
+
return;
|
|
7454
|
+
}
|
|
7455
|
+
e.inputEvent.preventDefault();
|
|
7456
|
+
editorService.undo();
|
|
7457
|
+
}).keydown([this.ctrlKey, "shift", "z"], (e) => {
|
|
7458
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7459
|
+
return;
|
|
7460
|
+
}
|
|
7461
|
+
e.inputEvent.preventDefault();
|
|
7462
|
+
editorService.redo();
|
|
7463
|
+
}).keydown("up", (e) => {
|
|
7464
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7465
|
+
return;
|
|
7466
|
+
}
|
|
7467
|
+
e.inputEvent.preventDefault();
|
|
7468
|
+
editorService.move(0, -1);
|
|
7469
|
+
}).keydown("down", (e) => {
|
|
7470
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7471
|
+
return;
|
|
7472
|
+
}
|
|
7473
|
+
e.inputEvent.preventDefault();
|
|
7474
|
+
editorService.move(0, 1);
|
|
7475
|
+
}).keydown("left", (e) => {
|
|
7476
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7477
|
+
return;
|
|
7478
|
+
}
|
|
7479
|
+
e.inputEvent.preventDefault();
|
|
7480
|
+
editorService.move(-1, 0);
|
|
7481
|
+
}).keydown("right", (e) => {
|
|
7482
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7483
|
+
return;
|
|
7484
|
+
}
|
|
7485
|
+
e.inputEvent.preventDefault();
|
|
7486
|
+
editorService.move(1, 0);
|
|
7487
|
+
}).keydown([this.ctrlKey, "up"], (e) => {
|
|
7488
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7489
|
+
return;
|
|
7490
|
+
}
|
|
7491
|
+
e.inputEvent.preventDefault();
|
|
7492
|
+
editorService.move(0, -10);
|
|
7493
|
+
}).keydown([this.ctrlKey, "down"], (e) => {
|
|
7494
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7495
|
+
return;
|
|
7496
|
+
}
|
|
7497
|
+
e.inputEvent.preventDefault();
|
|
7498
|
+
editorService.move(0, 10);
|
|
7499
|
+
}).keydown([this.ctrlKey, "left"], (e) => {
|
|
7500
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7501
|
+
return;
|
|
7502
|
+
}
|
|
7503
|
+
e.inputEvent.preventDefault();
|
|
7504
|
+
editorService.move(-10, 0);
|
|
7505
|
+
}).keydown([this.ctrlKey, "right"], (e) => {
|
|
7506
|
+
e.inputEvent.preventDefault();
|
|
7507
|
+
editorService.move(10, 0);
|
|
7508
|
+
}).keydown("tab", (e) => {
|
|
7509
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7510
|
+
return;
|
|
7511
|
+
}
|
|
7512
|
+
e.inputEvent.preventDefault();
|
|
7513
|
+
editorService.selectNextNode();
|
|
7514
|
+
}).keydown([this.ctrlKey, "tab"], (e) => {
|
|
7515
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7516
|
+
return;
|
|
7517
|
+
}
|
|
7518
|
+
e.inputEvent.preventDefault();
|
|
7519
|
+
editorService.selectNextPage();
|
|
7520
|
+
}).keydown([this.ctrlKey, "="], (e) => {
|
|
7521
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7522
|
+
return;
|
|
7523
|
+
}
|
|
7524
|
+
e.inputEvent.preventDefault();
|
|
7525
|
+
uiService.zoom(0.1);
|
|
7526
|
+
}).keydown([this.ctrlKey, "numpadplus"], (e) => {
|
|
7527
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7528
|
+
return;
|
|
7529
|
+
}
|
|
7530
|
+
e.inputEvent.preventDefault();
|
|
7531
|
+
uiService.zoom(0.1);
|
|
7532
|
+
}).keydown([this.ctrlKey, "-"], (e) => {
|
|
7533
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7534
|
+
return;
|
|
7535
|
+
}
|
|
7536
|
+
e.inputEvent.preventDefault();
|
|
7537
|
+
uiService.zoom(-0.1);
|
|
7538
|
+
}).keydown([this.ctrlKey, "numpad-"], (e) => {
|
|
7539
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7540
|
+
return;
|
|
7541
|
+
}
|
|
7542
|
+
e.inputEvent.preventDefault();
|
|
7543
|
+
uiService.zoom(-0.1);
|
|
7544
|
+
}).keydown([this.ctrlKey, "0"], async (e) => {
|
|
7545
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7546
|
+
return;
|
|
7547
|
+
}
|
|
7548
|
+
e.inputEvent.preventDefault();
|
|
7549
|
+
uiService.set("zoom", await uiService.calcZoom());
|
|
7550
|
+
}).keydown([this.ctrlKey, "1"], (e) => {
|
|
7551
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7552
|
+
return;
|
|
7553
|
+
}
|
|
7554
|
+
e.inputEvent.preventDefault();
|
|
7555
|
+
uiService.set("zoom", 1);
|
|
7556
|
+
});
|
|
7557
|
+
}
|
|
7558
|
+
destroy() {
|
|
7559
|
+
this.keycon.destroy();
|
|
7560
|
+
}
|
|
7561
|
+
isDisabledKeyEvent(node) {
|
|
7562
|
+
const el = node;
|
|
7563
|
+
if (!el)
|
|
7564
|
+
return false;
|
|
7565
|
+
return el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.isContentEditable;
|
|
7566
|
+
}
|
|
7567
|
+
removeNode() {
|
|
7568
|
+
const nodes = editorService.get("nodes");
|
|
7569
|
+
if (!nodes || utils.isPage(nodes[0]))
|
|
7570
|
+
return;
|
|
7571
|
+
editorService.remove(nodes);
|
|
7572
|
+
}
|
|
7573
|
+
}
|
|
7574
|
+
const keybindingService = new Keybinding();
|
|
7575
|
+
|
|
7483
7576
|
const editorProps = {
|
|
7484
7577
|
/** 页面初始值 */
|
|
7485
7578
|
modelValue: {
|
|
@@ -7867,7 +7960,8 @@
|
|
|
7867
7960
|
storageService,
|
|
7868
7961
|
codeBlockService,
|
|
7869
7962
|
depService,
|
|
7870
|
-
dataSourceService
|
|
7963
|
+
dataSourceService,
|
|
7964
|
+
keybindingService
|
|
7871
7965
|
};
|
|
7872
7966
|
initServiceEvents(props, emit, services);
|
|
7873
7967
|
initServiceState(props, services);
|
|
@@ -7907,12 +8001,21 @@
|
|
|
7907
8001
|
const _component_Workspace = vue.resolveComponent("Workspace");
|
|
7908
8002
|
const _component_PropsPanel = vue.resolveComponent("PropsPanel");
|
|
7909
8003
|
const _component_Framework = vue.resolveComponent("Framework");
|
|
7910
|
-
return vue.openBlock(), vue.createBlock(_component_Framework,
|
|
8004
|
+
return vue.openBlock(), vue.createBlock(_component_Framework, null, {
|
|
8005
|
+
header: vue.withCtx(() => [
|
|
8006
|
+
vue.renderSlot(_ctx.$slots, "header")
|
|
8007
|
+
]),
|
|
7911
8008
|
nav: vue.withCtx(() => [
|
|
7912
8009
|
vue.renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
|
|
7913
8010
|
vue.createVNode(_component_TMagicNavMenu, { data: _ctx.menu }, null, 8, ["data"])
|
|
7914
8011
|
])
|
|
7915
8012
|
]),
|
|
8013
|
+
"content-before": vue.withCtx(() => [
|
|
8014
|
+
vue.renderSlot(_ctx.$slots, "content-before")
|
|
8015
|
+
]),
|
|
8016
|
+
"src-code": vue.withCtx(() => [
|
|
8017
|
+
vue.renderSlot(_ctx.$slots, "src-code", { editorService: _ctx.editorService })
|
|
8018
|
+
]),
|
|
7916
8019
|
sidebar: vue.withCtx(() => [
|
|
7917
8020
|
vue.renderSlot(_ctx.$slots, "sidebar", { editorService: _ctx.editorService }, () => [
|
|
7918
8021
|
vue.createVNode(_component_Sidebar, {
|
|
@@ -7984,8 +8087,14 @@
|
|
|
7984
8087
|
empty: vue.withCtx(() => [
|
|
7985
8088
|
vue.renderSlot(_ctx.$slots, "empty", { editorService: _ctx.editorService })
|
|
7986
8089
|
]),
|
|
8090
|
+
"content-after": vue.withCtx(() => [
|
|
8091
|
+
vue.renderSlot(_ctx.$slots, "content-after")
|
|
8092
|
+
]),
|
|
8093
|
+
footer: vue.withCtx(() => [
|
|
8094
|
+
vue.renderSlot(_ctx.$slots, "footer")
|
|
8095
|
+
]),
|
|
7987
8096
|
_: 3
|
|
7988
|
-
}
|
|
8097
|
+
});
|
|
7989
8098
|
}
|
|
7990
8099
|
const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
7991
8100
|
|
|
@@ -8035,6 +8144,7 @@
|
|
|
8035
8144
|
exports.Layout = Layout;
|
|
8036
8145
|
exports.LayoutContainer = _sfc_main$s;
|
|
8037
8146
|
exports.PropsPanel = _sfc_main$n;
|
|
8147
|
+
exports.SplitView = _sfc_main$s;
|
|
8038
8148
|
exports.TMagicCodeEditor = _sfc_main$u;
|
|
8039
8149
|
exports.TMagicEditor = Editor;
|
|
8040
8150
|
exports.ToolButton = _sfc_main$p;
|