@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
package/dist/tmagic-editor.js
CHANGED
|
@@ -185,7 +185,7 @@ const _sfc_main$C = /* @__PURE__ */ defineComponent({
|
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
187
|
|
|
188
|
-
const _hoisted_1$
|
|
188
|
+
const _hoisted_1$n = ["src"];
|
|
189
189
|
const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
190
190
|
...{
|
|
191
191
|
name: "MEditorIcon"
|
|
@@ -209,7 +209,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
209
209
|
class: "magic-editor-icon"
|
|
210
210
|
}, {
|
|
211
211
|
default: withCtx(() => [
|
|
212
|
-
createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$
|
|
212
|
+
createElementVNode("img", { src: _ctx.icon }, null, 8, _hoisted_1$n)
|
|
213
213
|
]),
|
|
214
214
|
_: 1
|
|
215
215
|
})) : typeof _ctx.icon === "string" ? (openBlock(), createElementBlock("i", {
|
|
@@ -228,7 +228,7 @@ const _sfc_main$B = /* @__PURE__ */ defineComponent({
|
|
|
228
228
|
}
|
|
229
229
|
});
|
|
230
230
|
|
|
231
|
-
const _hoisted_1$
|
|
231
|
+
const _hoisted_1$m = { class: "m-fields-code-select-col" };
|
|
232
232
|
const _hoisted_2$e = { class: "code-select-container" };
|
|
233
233
|
const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
234
234
|
...{
|
|
@@ -322,7 +322,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
322
322
|
};
|
|
323
323
|
return (_ctx, _cache) => {
|
|
324
324
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
325
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
325
|
+
return openBlock(), createElementBlock("div", _hoisted_1$m, [
|
|
326
326
|
createElementVNode("div", _hoisted_2$e, [
|
|
327
327
|
createVNode(_component_m_form_container, {
|
|
328
328
|
class: "select",
|
|
@@ -346,7 +346,7 @@ const _sfc_main$A = /* @__PURE__ */ defineComponent({
|
|
|
346
346
|
}
|
|
347
347
|
});
|
|
348
348
|
|
|
349
|
-
const _hoisted_1$
|
|
349
|
+
const _hoisted_1$l = { class: "m-editor-data-source-fields" };
|
|
350
350
|
const _hoisted_2$d = { class: "m-editor-data-source-fields-footer" };
|
|
351
351
|
const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
352
352
|
...{
|
|
@@ -494,7 +494,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
494
494
|
}
|
|
495
495
|
];
|
|
496
496
|
return (_ctx, _cache) => {
|
|
497
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
497
|
+
return openBlock(), createElementBlock("div", _hoisted_1$l, [
|
|
498
498
|
createVNode(unref(MagicTable), {
|
|
499
499
|
data: _ctx.model[_ctx.name],
|
|
500
500
|
columns: filedColumns
|
|
@@ -527,7 +527,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
|
|
|
527
527
|
}
|
|
528
528
|
});
|
|
529
529
|
|
|
530
|
-
const _hoisted_1$
|
|
530
|
+
const _hoisted_1$k = { style: { "display": "flex", "flex-direction": "column", "line-height": "1.2em" } };
|
|
531
531
|
const _hoisted_2$c = { style: { "font-size": "10px", "color": "rgba(0, 0, 0, 0.6)" } };
|
|
532
532
|
const _hoisted_3$5 = { class: "el-input__inner" };
|
|
533
533
|
const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
@@ -753,7 +753,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
753
753
|
createVNode(_sfc_main$B, { icon: unref(Coin) }, null, 8, ["icon"])
|
|
754
754
|
]),
|
|
755
755
|
default: withCtx(({ item }) => [
|
|
756
|
-
createElementVNode("div", _hoisted_1$
|
|
756
|
+
createElementVNode("div", _hoisted_1$k, [
|
|
757
757
|
createElementVNode("div", null, toDisplayString(item.text), 1),
|
|
758
758
|
createElementVNode("span", _hoisted_2$c, toDisplayString(item.value), 1)
|
|
759
759
|
])
|
|
@@ -792,7 +792,7 @@ const _sfc_main$y = /* @__PURE__ */ defineComponent({
|
|
|
792
792
|
}
|
|
793
793
|
});
|
|
794
794
|
|
|
795
|
-
const _hoisted_1$
|
|
795
|
+
const _hoisted_1$j = { class: "m-fields-event-select" };
|
|
796
796
|
const _hoisted_2$b = {
|
|
797
797
|
key: 1,
|
|
798
798
|
class: "fullWidth"
|
|
@@ -959,7 +959,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
959
959
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
960
960
|
const _component_m_form_container = resolveComponent("m-form-container");
|
|
961
961
|
const _component_m_form_panel = resolveComponent("m-form-panel");
|
|
962
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
962
|
+
return openBlock(), createElementBlock("div", _hoisted_1$j, [
|
|
963
963
|
isOldVersion.value ? (openBlock(), createBlock(_component_m_form_table, {
|
|
964
964
|
key: 0,
|
|
965
965
|
ref: "eventForm",
|
|
@@ -1010,7 +1010,7 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
1010
1010
|
}
|
|
1011
1011
|
});
|
|
1012
1012
|
|
|
1013
|
-
const _hoisted_1$
|
|
1013
|
+
const _hoisted_1$i = { class: "m-fields-key-value" };
|
|
1014
1014
|
const _hoisted_2$a = /* @__PURE__ */ createElementVNode("span", { class: "m-fileds-key-value-delimiter" }, ":", -1);
|
|
1015
1015
|
const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
1016
1016
|
...{
|
|
@@ -1055,7 +1055,7 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
1055
1055
|
records.value.splice(index, 1);
|
|
1056
1056
|
};
|
|
1057
1057
|
return (_ctx, _cache) => {
|
|
1058
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
1058
|
+
return openBlock(), createElementBlock("div", _hoisted_1$i, [
|
|
1059
1059
|
(openBlock(true), createElementBlock(Fragment, null, renderList(records.value, (item, index) => {
|
|
1060
1060
|
return openBlock(), createElementBlock("div", {
|
|
1061
1061
|
class: "m-fields-key-value-item",
|
|
@@ -1361,6 +1361,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
1361
1361
|
emits: ["change"],
|
|
1362
1362
|
setup(__props, { emit }) {
|
|
1363
1363
|
const target = ref();
|
|
1364
|
+
const isDraging = ref(false);
|
|
1364
1365
|
let getso;
|
|
1365
1366
|
onMounted(() => {
|
|
1366
1367
|
if (!target.value)
|
|
@@ -1372,19 +1373,24 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
1372
1373
|
if (!target.value)
|
|
1373
1374
|
return;
|
|
1374
1375
|
emit("change", e.deltaX);
|
|
1376
|
+
}).on("dragStart", () => {
|
|
1377
|
+
isDraging.value = true;
|
|
1378
|
+
}).on("dragEnd", () => {
|
|
1379
|
+
isDraging.value = false;
|
|
1375
1380
|
});
|
|
1376
1381
|
});
|
|
1377
1382
|
onUnmounted(() => {
|
|
1378
1383
|
getso?.unset();
|
|
1384
|
+
isDraging.value = false;
|
|
1379
1385
|
});
|
|
1380
1386
|
return (_ctx, _cache) => {
|
|
1381
1387
|
return openBlock(), createElementBlock("span", {
|
|
1382
1388
|
ref_key: "target",
|
|
1383
1389
|
ref: target,
|
|
1384
|
-
class: "m-editor-resizer"
|
|
1390
|
+
class: normalizeClass(["m-editor-resizer", { "m-editor-resizer-draging": isDraging.value }])
|
|
1385
1391
|
}, [
|
|
1386
1392
|
renderSlot(_ctx.$slots, "default")
|
|
1387
|
-
],
|
|
1393
|
+
], 2);
|
|
1388
1394
|
};
|
|
1389
1395
|
}
|
|
1390
1396
|
});
|
|
@@ -1393,7 +1399,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
|
|
|
1393
1399
|
...{
|
|
1394
1400
|
name: "MEditorLayout"
|
|
1395
1401
|
},
|
|
1396
|
-
__name: "
|
|
1402
|
+
__name: "SplitView",
|
|
1397
1403
|
props: {
|
|
1398
1404
|
left: {},
|
|
1399
1405
|
right: {},
|
|
@@ -3377,7 +3383,7 @@ const useStage = (stageOptions) => {
|
|
|
3377
3383
|
return stage;
|
|
3378
3384
|
};
|
|
3379
3385
|
|
|
3380
|
-
const _hoisted_1$
|
|
3386
|
+
const _hoisted_1$h = { class: "m-editor-empty-panel" };
|
|
3381
3387
|
const _hoisted_2$9 = { class: "m-editor-empty-content" };
|
|
3382
3388
|
const _hoisted_3$4 = /* @__PURE__ */ createElementVNode("p", null, "新增页面", -1);
|
|
3383
3389
|
const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
@@ -3400,7 +3406,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
3400
3406
|
});
|
|
3401
3407
|
};
|
|
3402
3408
|
return (_ctx, _cache) => {
|
|
3403
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3409
|
+
return openBlock(), createElementBlock("div", _hoisted_1$h, [
|
|
3404
3410
|
createElementVNode("div", _hoisted_2$9, [
|
|
3405
3411
|
createElementVNode("div", {
|
|
3406
3412
|
class: "m-editor-empty-button",
|
|
@@ -3417,7 +3423,7 @@ const _sfc_main$r = /* @__PURE__ */ defineComponent({
|
|
|
3417
3423
|
}
|
|
3418
3424
|
});
|
|
3419
3425
|
|
|
3420
|
-
const _hoisted_1$
|
|
3426
|
+
const _hoisted_1$g = { class: "m-editor" };
|
|
3421
3427
|
const DEFAULT_LEFT_COLUMN_WIDTH = 310;
|
|
3422
3428
|
const DEFAULT_RIGHT_COLUMN_WIDTH = 480;
|
|
3423
3429
|
const LEFT_COLUMN_WIDTH_STORAGE_KEY = "$MagicEditorLeftColumnWidthData";
|
|
@@ -3427,10 +3433,8 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
3427
3433
|
name: "MEditorFramework"
|
|
3428
3434
|
},
|
|
3429
3435
|
__name: "Framework",
|
|
3430
|
-
props: {
|
|
3431
|
-
codeOptions: { default: () => ({}) }
|
|
3432
|
-
},
|
|
3433
3436
|
setup(__props) {
|
|
3437
|
+
const codeOptions = inject("codeOptions", {});
|
|
3434
3438
|
const { editorService, uiService } = inject("services") || {};
|
|
3435
3439
|
const root = computed(() => editorService?.get("root"));
|
|
3436
3440
|
const nodes = computed(() => editorService?.get("nodes") || []);
|
|
@@ -3490,16 +3494,18 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
3490
3494
|
}
|
|
3491
3495
|
};
|
|
3492
3496
|
return (_ctx, _cache) => {
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
renderSlot(_ctx.$slots, "nav"
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3497
|
+
return openBlock(), createElementBlock("div", _hoisted_1$g, [
|
|
3498
|
+
renderSlot(_ctx.$slots, "header"),
|
|
3499
|
+
renderSlot(_ctx.$slots, "nav"),
|
|
3500
|
+
renderSlot(_ctx.$slots, "content-before"),
|
|
3501
|
+
showSrc.value ? renderSlot(_ctx.$slots, "src-code", { key: 0 }, () => [
|
|
3502
|
+
createVNode(_sfc_main$u, {
|
|
3503
|
+
class: "m-editor-content",
|
|
3504
|
+
"init-values": root.value,
|
|
3505
|
+
options: unref(codeOptions),
|
|
3506
|
+
onSave: saveCode
|
|
3507
|
+
}, null, 8, ["init-values", "options"])
|
|
3508
|
+
]) : (openBlock(), createBlock(_sfc_main$s, {
|
|
3503
3509
|
key: 1,
|
|
3504
3510
|
class: "m-editor-content",
|
|
3505
3511
|
"left-class": "m-editor-framework-left",
|
|
@@ -3535,13 +3541,15 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
|
|
|
3535
3541
|
]),
|
|
3536
3542
|
key: "0"
|
|
3537
3543
|
} : void 0
|
|
3538
|
-
]), 1032, ["left", "right"]))
|
|
3544
|
+
]), 1032, ["left", "right"])),
|
|
3545
|
+
renderSlot(_ctx.$slots, "content-after"),
|
|
3546
|
+
renderSlot(_ctx.$slots, "footer")
|
|
3539
3547
|
]);
|
|
3540
3548
|
};
|
|
3541
3549
|
}
|
|
3542
3550
|
});
|
|
3543
3551
|
|
|
3544
|
-
const _hoisted_1$
|
|
3552
|
+
const _hoisted_1$f = {
|
|
3545
3553
|
key: 1,
|
|
3546
3554
|
class: "menu-item-text"
|
|
3547
3555
|
};
|
|
@@ -3625,7 +3633,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
|
|
|
3625
3633
|
_ctx.data.type === "divider" ? (openBlock(), createBlock(unref(TMagicDivider), {
|
|
3626
3634
|
key: 0,
|
|
3627
3635
|
direction: _ctx.data.direction || "vertical"
|
|
3628
|
-
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
3636
|
+
}, null, 8, ["direction"])) : _ctx.data.type === "text" ? (openBlock(), createElementBlock("div", _hoisted_1$f, toDisplayString(_ctx.data.text), 1)) : _ctx.data.type === "button" ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
3629
3637
|
_ctx.data.tooltip ? (openBlock(), createBlock(unref(TMagicTooltip), {
|
|
3630
3638
|
key: 0,
|
|
3631
3639
|
effect: "dark",
|
|
@@ -3880,7 +3888,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
3880
3888
|
}
|
|
3881
3889
|
});
|
|
3882
3890
|
|
|
3883
|
-
const _hoisted_1$
|
|
3891
|
+
const _hoisted_1$e = { class: "m-editor-props-panel" };
|
|
3884
3892
|
const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
3885
3893
|
...{
|
|
3886
3894
|
name: "MEditorPropsPanel"
|
|
@@ -3930,7 +3938,7 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
|
|
|
3930
3938
|
};
|
|
3931
3939
|
__expose({ submit });
|
|
3932
3940
|
return (_ctx, _cache) => {
|
|
3933
|
-
return openBlock(), createElementBlock("div", _hoisted_1$
|
|
3941
|
+
return openBlock(), createElementBlock("div", _hoisted_1$e, [
|
|
3934
3942
|
renderSlot(_ctx.$slots, "props-panel-header"),
|
|
3935
3943
|
createVNode(unref(MForm), {
|
|
3936
3944
|
ref_key: "configForm",
|
|
@@ -3982,7 +3990,7 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
|
|
|
3982
3990
|
}
|
|
3983
3991
|
});
|
|
3984
3992
|
|
|
3985
|
-
const _hoisted_1$
|
|
3993
|
+
const _hoisted_1$d = { xmlns: "http://www.w3.org/2000/svg" };
|
|
3986
3994
|
const _hoisted_2$7 = /* @__PURE__ */ createElementVNode("g", {
|
|
3987
3995
|
fill: "#7C878E",
|
|
3988
3996
|
"fill-rule": "evenodd"
|
|
@@ -4003,12 +4011,12 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
|
|
|
4003
4011
|
__name: "AppManageIcon",
|
|
4004
4012
|
setup(__props) {
|
|
4005
4013
|
return (_ctx, _cache) => {
|
|
4006
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
4014
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$d, _hoisted_3$3);
|
|
4007
4015
|
};
|
|
4008
4016
|
}
|
|
4009
4017
|
});
|
|
4010
4018
|
|
|
4011
|
-
const _hoisted_1$
|
|
4019
|
+
const _hoisted_1$c = {
|
|
4012
4020
|
viewBox: "0 0 32 32",
|
|
4013
4021
|
version: "1.1",
|
|
4014
4022
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4025,12 +4033,12 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
|
|
|
4025
4033
|
__name: "CodeIcon",
|
|
4026
4034
|
setup(__props) {
|
|
4027
4035
|
return (_ctx, _cache) => {
|
|
4028
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
4036
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$c, _hoisted_4$3);
|
|
4029
4037
|
};
|
|
4030
4038
|
}
|
|
4031
4039
|
});
|
|
4032
4040
|
|
|
4033
|
-
const _hoisted_1$
|
|
4041
|
+
const _hoisted_1$b = {
|
|
4034
4042
|
key: 0,
|
|
4035
4043
|
class: "m-editor-content-bottom"
|
|
4036
4044
|
};
|
|
@@ -4134,7 +4142,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
4134
4142
|
language: _ctx.language,
|
|
4135
4143
|
options: codeOptions.value
|
|
4136
4144
|
}, null, 8, ["init-values", "language", "options"]),
|
|
4137
|
-
_ctx.editable ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
4145
|
+
_ctx.editable ? (openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
4138
4146
|
createVNode(unref(TMagicButton), {
|
|
4139
4147
|
type: "primary",
|
|
4140
4148
|
class: "button",
|
|
@@ -4190,7 +4198,7 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
|
|
|
4190
4198
|
}
|
|
4191
4199
|
});
|
|
4192
4200
|
|
|
4193
|
-
const _hoisted_1$
|
|
4201
|
+
const _hoisted_1$a = { class: "code-name-wrapper" };
|
|
4194
4202
|
const _hoisted_2$4 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "代码块名称", -1);
|
|
4195
4203
|
const _hoisted_3$2 = { class: "code-name-wrapper" };
|
|
4196
4204
|
const _hoisted_4$2 = /* @__PURE__ */ createElementVNode("div", { class: "code-name-label" }, "参数", -1);
|
|
@@ -4316,7 +4324,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
4316
4324
|
const _component_m_form_table = resolveComponent("m-form-table");
|
|
4317
4325
|
return openBlock(), createBlock(unref(TMagicCard), { shadow: "never" }, {
|
|
4318
4326
|
header: withCtx(() => [
|
|
4319
|
-
createElementVNode("div", _hoisted_1$
|
|
4327
|
+
createElementVNode("div", _hoisted_1$a, [
|
|
4320
4328
|
_hoisted_2$4,
|
|
4321
4329
|
createVNode(unref(TMagicInput), {
|
|
4322
4330
|
class: "code-name-input",
|
|
@@ -4358,7 +4366,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
|
|
|
4358
4366
|
}
|
|
4359
4367
|
});
|
|
4360
4368
|
|
|
4361
|
-
const _hoisted_1$
|
|
4369
|
+
const _hoisted_1$9 = {
|
|
4362
4370
|
key: 0,
|
|
4363
4371
|
class: "m-editor-code-block-editor-panel"
|
|
4364
4372
|
};
|
|
@@ -4426,7 +4434,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
4426
4434
|
class: "code-editor-layout"
|
|
4427
4435
|
}, {
|
|
4428
4436
|
center: withCtx(() => [
|
|
4429
|
-
!unref(isEmpty)(codeConfig.value) ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
4437
|
+
!unref(isEmpty)(codeConfig.value) ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
4430
4438
|
renderSlot(_ctx.$slots, "code-block-edit-panel-header", { id: id.value }),
|
|
4431
4439
|
codeConfig.value ? (openBlock(), createBlock(_sfc_main$i, {
|
|
4432
4440
|
key: 0,
|
|
@@ -4451,7 +4459,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
|
|
|
4451
4459
|
}
|
|
4452
4460
|
});
|
|
4453
4461
|
|
|
4454
|
-
const _hoisted_1$
|
|
4462
|
+
const _hoisted_1$8 = { class: "search-wrapper" };
|
|
4455
4463
|
const _hoisted_2$3 = ["id"];
|
|
4456
4464
|
const _hoisted_3$1 = { class: "list-item" };
|
|
4457
4465
|
const _hoisted_4$1 = {
|
|
@@ -4554,7 +4562,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
|
|
|
4554
4562
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "m-editor-code-block-list m-editor-dep-list-panel" }, {
|
|
4555
4563
|
default: withCtx(() => [
|
|
4556
4564
|
renderSlot(_ctx.$slots, "code-block-panel-header", {}, () => [
|
|
4557
|
-
createElementVNode("div", _hoisted_1$
|
|
4565
|
+
createElementVNode("div", _hoisted_1$8, [
|
|
4558
4566
|
createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
|
|
4559
4567
|
editable.value ? (openBlock(), createBlock(unref(TMagicButton), {
|
|
4560
4568
|
key: 0,
|
|
@@ -4749,7 +4757,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
4749
4757
|
}
|
|
4750
4758
|
});
|
|
4751
4759
|
|
|
4752
|
-
const _hoisted_1$
|
|
4760
|
+
const _hoisted_1$7 = { class: "search-wrapper" };
|
|
4753
4761
|
const _hoisted_2$2 = ["id"];
|
|
4754
4762
|
const _hoisted_3 = { class: "list-item" };
|
|
4755
4763
|
const _hoisted_4 = {
|
|
@@ -4818,7 +4826,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4818
4826
|
return (_ctx, _cache) => {
|
|
4819
4827
|
return openBlock(), createBlock(unref(TMagicScrollbar), { class: "data-source-list-panel m-editor-dep-list-panel" }, {
|
|
4820
4828
|
default: withCtx(() => [
|
|
4821
|
-
createElementVNode("div", _hoisted_1$
|
|
4829
|
+
createElementVNode("div", _hoisted_1$7, [
|
|
4822
4830
|
createVNode(_sfc_main$m, { onSearch: filterTextChangeHandler }),
|
|
4823
4831
|
createVNode(unref(TMagicButton), {
|
|
4824
4832
|
type: "primary",
|
|
@@ -4914,7 +4922,7 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
|
4914
4922
|
}
|
|
4915
4923
|
});
|
|
4916
4924
|
|
|
4917
|
-
const _hoisted_1$
|
|
4925
|
+
const _hoisted_1$6 = ["onClick", "onDragstart"];
|
|
4918
4926
|
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
4919
4927
|
...{
|
|
4920
4928
|
name: "MEditorComponentListPanel"
|
|
@@ -5032,7 +5040,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
|
5032
5040
|
_: 2
|
|
5033
5041
|
}, 1032, ["content"])
|
|
5034
5042
|
])
|
|
5035
|
-
], 40, _hoisted_1$
|
|
5043
|
+
], 40, _hoisted_1$6);
|
|
5036
5044
|
}), 128))
|
|
5037
5045
|
]),
|
|
5038
5046
|
_: 2
|
|
@@ -5271,7 +5279,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
|
5271
5279
|
}
|
|
5272
5280
|
});
|
|
5273
5281
|
|
|
5274
|
-
const _hoisted_1$
|
|
5282
|
+
const _hoisted_1$5 = ["id", "onMouseenter"];
|
|
5275
5283
|
const throttleTime = 150;
|
|
5276
5284
|
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
5277
5285
|
...{
|
|
@@ -5284,6 +5292,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
5284
5292
|
setup(__props) {
|
|
5285
5293
|
const services = inject("services");
|
|
5286
5294
|
const editorService = services?.editorService;
|
|
5295
|
+
const keybindingService = services?.keybindingService;
|
|
5287
5296
|
const tree = ref();
|
|
5288
5297
|
const menu = ref();
|
|
5289
5298
|
const checkedKeys = ref([]);
|
|
@@ -5417,27 +5426,38 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
5417
5426
|
const windowBlurHandler = () => {
|
|
5418
5427
|
isCtrlKeyDown.value = false;
|
|
5419
5428
|
};
|
|
5429
|
+
const globalKeyupHandler = () => {
|
|
5430
|
+
if (document.activeElement !== tree.value?.$el) {
|
|
5431
|
+
isCtrlKeyDown.value = false;
|
|
5432
|
+
}
|
|
5433
|
+
};
|
|
5420
5434
|
let keycon;
|
|
5421
5435
|
onMounted(() => {
|
|
5422
5436
|
editorService?.on("remove", editorServiceRemoveHandler);
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5437
|
+
if (tree.value?.$el) {
|
|
5438
|
+
keybindingService?.on("keyup", globalKeyupHandler);
|
|
5439
|
+
keycon = new KeyController(tree.value.$el);
|
|
5440
|
+
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
5441
|
+
const ctrl = isMac ? "meta" : "ctrl";
|
|
5442
|
+
keycon.keydown((e) => {
|
|
5443
|
+
if (e.key !== ctrl) {
|
|
5444
|
+
isCtrlKeyDown.value = false;
|
|
5445
|
+
}
|
|
5446
|
+
}).keydown(ctrl, () => {
|
|
5447
|
+
isCtrlKeyDown.value = true;
|
|
5448
|
+
}).keyup(ctrl, () => {
|
|
5428
5449
|
isCtrlKeyDown.value = false;
|
|
5429
|
-
}
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
}).keyup(ctrl, () => {
|
|
5433
|
-
isCtrlKeyDown.value = false;
|
|
5434
|
-
});
|
|
5450
|
+
});
|
|
5451
|
+
tree.value.$el.addEventListener("blur", windowBlurHandler);
|
|
5452
|
+
}
|
|
5435
5453
|
globalThis.addEventListener("blur", windowBlurHandler);
|
|
5436
5454
|
});
|
|
5437
5455
|
onUnmounted(() => {
|
|
5438
5456
|
keycon.destroy();
|
|
5439
5457
|
editorService?.off("remove", editorServiceRemoveHandler);
|
|
5458
|
+
keybindingService?.off("keyup", globalKeyupHandler);
|
|
5440
5459
|
globalThis.removeEventListener("blur", windowBlurHandler);
|
|
5460
|
+
tree.value?.$el.removeEventListener("blur", windowBlurHandler);
|
|
5441
5461
|
});
|
|
5442
5462
|
const highlightHandler = throttle((data) => {
|
|
5443
5463
|
highlight(data);
|
|
@@ -5482,6 +5502,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
5482
5502
|
ref: tree,
|
|
5483
5503
|
"node-key": "id",
|
|
5484
5504
|
"empty-text": "页面空荡荡的",
|
|
5505
|
+
tabindex: "-1",
|
|
5485
5506
|
draggable: "",
|
|
5486
5507
|
"default-expanded-keys": expandedKeys.value,
|
|
5487
5508
|
"default-checked-keys": checkedKeys.value,
|
|
@@ -5515,7 +5536,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
5515
5536
|
}, () => [
|
|
5516
5537
|
createElementVNode("span", null, toDisplayString(`${data.name} (${data.id})`), 1)
|
|
5517
5538
|
])
|
|
5518
|
-
], 40, _hoisted_1$
|
|
5539
|
+
], 40, _hoisted_1$5)
|
|
5519
5540
|
]),
|
|
5520
5541
|
_: 3
|
|
5521
5542
|
}, 8, ["default-expanded-keys", "default-checked-keys", "current-node-key", "data", "highlight-current", "show-checkbox"])) : createCommentVNode("", true),
|
|
@@ -5533,7 +5554,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
5533
5554
|
}
|
|
5534
5555
|
});
|
|
5535
5556
|
|
|
5536
|
-
const _hoisted_1$
|
|
5557
|
+
const _hoisted_1$4 = {
|
|
5537
5558
|
key: 1,
|
|
5538
5559
|
class: "magic-editor-tab-panel-title"
|
|
5539
5560
|
};
|
|
@@ -5621,7 +5642,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5621
5642
|
key: 0,
|
|
5622
5643
|
icon: config.icon
|
|
5623
5644
|
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
5624
|
-
config.text ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5645
|
+
config.text ? (openBlock(), createElementBlock("div", _hoisted_1$4, toDisplayString(config.text), 1)) : createCommentVNode("", true)
|
|
5625
5646
|
]))
|
|
5626
5647
|
]),
|
|
5627
5648
|
default: withCtx(() => [
|
|
@@ -5708,7 +5729,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
|
5708
5729
|
}
|
|
5709
5730
|
});
|
|
5710
5731
|
|
|
5711
|
-
const _hoisted_1$
|
|
5732
|
+
const _hoisted_1$3 = {
|
|
5712
5733
|
key: 0,
|
|
5713
5734
|
class: "m-editor-breadcrumb"
|
|
5714
5735
|
};
|
|
@@ -5730,7 +5751,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
5730
5751
|
editorService?.get("stage")?.select(node2.id);
|
|
5731
5752
|
};
|
|
5732
5753
|
return (_ctx, _cache) => {
|
|
5733
|
-
return nodes.value.length === 1 ? (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5754
|
+
return nodes.value.length === 1 ? (openBlock(), createElementBlock("div", _hoisted_1$3, [
|
|
5734
5755
|
(openBlock(true), createElementBlock(Fragment, null, renderList(path.value, (item, index) => {
|
|
5735
5756
|
return openBlock(), createElementBlock(Fragment, {
|
|
5736
5757
|
key: item.id
|
|
@@ -5753,7 +5774,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
|
5753
5774
|
}
|
|
5754
5775
|
});
|
|
5755
5776
|
|
|
5756
|
-
const _hoisted_1$
|
|
5777
|
+
const _hoisted_1$2 = {
|
|
5757
5778
|
key: 1,
|
|
5758
5779
|
style: { "width": "21px" }
|
|
5759
5780
|
};
|
|
@@ -5846,7 +5867,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
5846
5867
|
onClick: addPage
|
|
5847
5868
|
}, [
|
|
5848
5869
|
createVNode(_sfc_main$B, { icon: unref(Plus) }, null, 8, ["icon"])
|
|
5849
|
-
])) : (openBlock(), createElementBlock("div", _hoisted_1$
|
|
5870
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_1$2)),
|
|
5850
5871
|
canScroll.value ? (openBlock(), createElementBlock("div", {
|
|
5851
5872
|
key: 2,
|
|
5852
5873
|
class: "m-editor-page-bar-item m-editor-page-bar-item-icon",
|
|
@@ -5875,7 +5896,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
|
5875
5896
|
}
|
|
5876
5897
|
});
|
|
5877
5898
|
|
|
5878
|
-
const _hoisted_1 = ["onClick"];
|
|
5899
|
+
const _hoisted_1$1 = ["onClick"];
|
|
5879
5900
|
const _hoisted_2 = { class: "m-editor-page-bar-title" };
|
|
5880
5901
|
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
5881
5902
|
...{
|
|
@@ -5961,7 +5982,7 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
|
5961
5982
|
]),
|
|
5962
5983
|
_: 2
|
|
5963
5984
|
}, 1024)
|
|
5964
|
-
], 10, _hoisted_1);
|
|
5985
|
+
], 10, _hoisted_1$1);
|
|
5965
5986
|
}), 128))
|
|
5966
5987
|
]),
|
|
5967
5988
|
_: 3
|
|
@@ -6614,6 +6635,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
6614
6635
|
}
|
|
6615
6636
|
});
|
|
6616
6637
|
|
|
6638
|
+
const _hoisted_1 = {
|
|
6639
|
+
class: "m-editor-workspace",
|
|
6640
|
+
tabindex: "-1"
|
|
6641
|
+
};
|
|
6617
6642
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
6618
6643
|
...{
|
|
6619
6644
|
name: "MEditorWorkspace"
|
|
@@ -6624,112 +6649,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
6624
6649
|
},
|
|
6625
6650
|
setup(__props) {
|
|
6626
6651
|
const services = inject("services");
|
|
6627
|
-
const workspace = ref();
|
|
6628
|
-
const nodes = computed(() => services?.editorService.get("nodes"));
|
|
6629
6652
|
const page = computed(() => services?.editorService.get("page"));
|
|
6630
|
-
const mouseenterHandler = () => {
|
|
6631
|
-
workspace.value?.focus();
|
|
6632
|
-
};
|
|
6633
|
-
const mouseleaveHandler = () => {
|
|
6634
|
-
workspace.value?.blur();
|
|
6635
|
-
};
|
|
6636
|
-
let keycon;
|
|
6637
|
-
onMounted(() => {
|
|
6638
|
-
workspace.value?.addEventListener("mouseenter", mouseenterHandler);
|
|
6639
|
-
workspace.value?.addEventListener("mouseleave", mouseleaveHandler);
|
|
6640
|
-
keycon = new KeyController(workspace.value);
|
|
6641
|
-
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
6642
|
-
const ctrl = isMac ? "meta" : "ctrl";
|
|
6643
|
-
keycon.keyup("delete", (e) => {
|
|
6644
|
-
e.inputEvent.preventDefault();
|
|
6645
|
-
if (!nodes.value || isPage(nodes.value[0]))
|
|
6646
|
-
return;
|
|
6647
|
-
services?.editorService.remove(nodes.value);
|
|
6648
|
-
}).keyup("backspace", (e) => {
|
|
6649
|
-
e.inputEvent.preventDefault();
|
|
6650
|
-
if (!nodes.value || isPage(nodes.value[0]))
|
|
6651
|
-
return;
|
|
6652
|
-
services?.editorService.remove(nodes.value);
|
|
6653
|
-
}).keydown([ctrl, "c"], (e) => {
|
|
6654
|
-
e.inputEvent.preventDefault();
|
|
6655
|
-
nodes.value && services?.editorService.copy(nodes.value);
|
|
6656
|
-
}).keydown([ctrl, "v"], (e) => {
|
|
6657
|
-
e.inputEvent.preventDefault();
|
|
6658
|
-
nodes.value && services?.editorService.paste({ offsetX: 10, offsetY: 10 });
|
|
6659
|
-
}).keydown([ctrl, "x"], (e) => {
|
|
6660
|
-
e.inputEvent.preventDefault();
|
|
6661
|
-
if (!nodes.value || isPage(nodes.value[0]))
|
|
6662
|
-
return;
|
|
6663
|
-
services?.editorService.copy(nodes.value);
|
|
6664
|
-
services?.editorService.remove(nodes.value);
|
|
6665
|
-
}).keydown([ctrl, "z"], (e) => {
|
|
6666
|
-
e.inputEvent.preventDefault();
|
|
6667
|
-
services?.editorService.undo();
|
|
6668
|
-
}).keydown([ctrl, "shift", "z"], (e) => {
|
|
6669
|
-
e.inputEvent.preventDefault();
|
|
6670
|
-
services?.editorService.redo();
|
|
6671
|
-
}).keydown("up", (e) => {
|
|
6672
|
-
e.inputEvent.preventDefault();
|
|
6673
|
-
services?.editorService.move(0, -1);
|
|
6674
|
-
}).keydown("down", (e) => {
|
|
6675
|
-
e.inputEvent.preventDefault();
|
|
6676
|
-
services?.editorService.move(0, 1);
|
|
6677
|
-
}).keydown("left", (e) => {
|
|
6678
|
-
e.inputEvent.preventDefault();
|
|
6679
|
-
services?.editorService.move(-1, 0);
|
|
6680
|
-
}).keydown("right", (e) => {
|
|
6681
|
-
e.inputEvent.preventDefault();
|
|
6682
|
-
services?.editorService.move(1, 0);
|
|
6683
|
-
}).keydown([ctrl, "up"], (e) => {
|
|
6684
|
-
e.inputEvent.preventDefault();
|
|
6685
|
-
services?.editorService.move(0, -10);
|
|
6686
|
-
}).keydown([ctrl, "down"], (e) => {
|
|
6687
|
-
e.inputEvent.preventDefault();
|
|
6688
|
-
services?.editorService.move(0, 10);
|
|
6689
|
-
}).keydown([ctrl, "left"], (e) => {
|
|
6690
|
-
e.inputEvent.preventDefault();
|
|
6691
|
-
services?.editorService.move(-10, 0);
|
|
6692
|
-
}).keydown([ctrl, "right"], (e) => {
|
|
6693
|
-
e.inputEvent.preventDefault();
|
|
6694
|
-
services?.editorService.move(10, 0);
|
|
6695
|
-
}).keydown("tab", (e) => {
|
|
6696
|
-
e.inputEvent.preventDefault();
|
|
6697
|
-
services?.editorService.selectNextNode();
|
|
6698
|
-
}).keydown([ctrl, "tab"], (e) => {
|
|
6699
|
-
e.inputEvent.preventDefault();
|
|
6700
|
-
services?.editorService.selectNextPage();
|
|
6701
|
-
}).keydown([ctrl, "="], (e) => {
|
|
6702
|
-
e.inputEvent.preventDefault();
|
|
6703
|
-
services?.uiService.zoom(0.1);
|
|
6704
|
-
}).keydown([ctrl, "numpadplus"], (e) => {
|
|
6705
|
-
e.inputEvent.preventDefault();
|
|
6706
|
-
services?.uiService.zoom(0.1);
|
|
6707
|
-
}).keydown([ctrl, "-"], (e) => {
|
|
6708
|
-
e.inputEvent.preventDefault();
|
|
6709
|
-
services?.uiService.zoom(-0.1);
|
|
6710
|
-
}).keydown([ctrl, "numpad-"], (e) => {
|
|
6711
|
-
e.inputEvent.preventDefault();
|
|
6712
|
-
services?.uiService.zoom(-0.1);
|
|
6713
|
-
}).keydown([ctrl, "0"], async (e) => {
|
|
6714
|
-
e.inputEvent.preventDefault();
|
|
6715
|
-
services?.uiService.set("zoom", await services.uiService.calcZoom());
|
|
6716
|
-
}).keydown([ctrl, "1"], (e) => {
|
|
6717
|
-
e.inputEvent.preventDefault();
|
|
6718
|
-
services?.uiService.set("zoom", 1);
|
|
6719
|
-
});
|
|
6720
|
-
});
|
|
6721
|
-
onUnmounted(() => {
|
|
6722
|
-
workspace.value?.removeEventListener("mouseenter", mouseenterHandler);
|
|
6723
|
-
workspace.value?.removeEventListener("mouseleave", mouseleaveHandler);
|
|
6724
|
-
keycon.destroy();
|
|
6725
|
-
});
|
|
6726
6653
|
return (_ctx, _cache) => {
|
|
6727
|
-
return openBlock(), createElementBlock("div",
|
|
6728
|
-
class: "m-editor-workspace",
|
|
6729
|
-
tabindex: "-1",
|
|
6730
|
-
ref_key: "workspace",
|
|
6731
|
-
ref: workspace
|
|
6732
|
-
}, [
|
|
6654
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
6733
6655
|
createVNode(_sfc_main$8),
|
|
6734
6656
|
renderSlot(_ctx.$slots, "stage", {}, () => [
|
|
6735
6657
|
page.value ? (openBlock(), createBlock(_sfc_main$2, {
|
|
@@ -6747,7 +6669,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
6747
6669
|
]),
|
|
6748
6670
|
_: 3
|
|
6749
6671
|
})
|
|
6750
|
-
]
|
|
6672
|
+
]);
|
|
6751
6673
|
};
|
|
6752
6674
|
}
|
|
6753
6675
|
});
|
|
@@ -7471,6 +7393,177 @@ class Events extends BaseService {
|
|
|
7471
7393
|
}
|
|
7472
7394
|
const eventsService = new Events();
|
|
7473
7395
|
|
|
7396
|
+
class Keybinding extends BaseService {
|
|
7397
|
+
keycon = new KeyController();
|
|
7398
|
+
ctrlKey = /mac os x/.test(navigator.userAgent.toLowerCase()) ? "meta" : "ctrl";
|
|
7399
|
+
constructor() {
|
|
7400
|
+
super();
|
|
7401
|
+
this.keycon.keyup((e) => {
|
|
7402
|
+
this.emit("keyup", e.inputEvent);
|
|
7403
|
+
}).keyup("delete", (e) => {
|
|
7404
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7405
|
+
return;
|
|
7406
|
+
}
|
|
7407
|
+
e.inputEvent.preventDefault();
|
|
7408
|
+
this.removeNode();
|
|
7409
|
+
}).keyup("backspace", (e) => {
|
|
7410
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7411
|
+
return;
|
|
7412
|
+
}
|
|
7413
|
+
e.inputEvent.preventDefault();
|
|
7414
|
+
this.removeNode();
|
|
7415
|
+
}).keydown([this.ctrlKey, "c"], (e) => {
|
|
7416
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7417
|
+
return;
|
|
7418
|
+
}
|
|
7419
|
+
e.inputEvent.preventDefault();
|
|
7420
|
+
const nodes = editorService.get("nodes");
|
|
7421
|
+
nodes && editorService.copy(nodes);
|
|
7422
|
+
}).keydown([this.ctrlKey, "v"], (e) => {
|
|
7423
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7424
|
+
return;
|
|
7425
|
+
}
|
|
7426
|
+
e.inputEvent.preventDefault();
|
|
7427
|
+
const nodes = editorService.get("nodes");
|
|
7428
|
+
nodes && editorService.paste({ offsetX: 10, offsetY: 10 });
|
|
7429
|
+
}).keydown([this.ctrlKey, "x"], (e) => {
|
|
7430
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7431
|
+
return;
|
|
7432
|
+
}
|
|
7433
|
+
e.inputEvent.preventDefault();
|
|
7434
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7435
|
+
return;
|
|
7436
|
+
}
|
|
7437
|
+
const nodes = editorService.get("nodes");
|
|
7438
|
+
if (!nodes || isPage(nodes[0]))
|
|
7439
|
+
return;
|
|
7440
|
+
editorService.copy(nodes);
|
|
7441
|
+
editorService.remove(nodes);
|
|
7442
|
+
}).keydown([this.ctrlKey, "z"], (e) => {
|
|
7443
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7444
|
+
return;
|
|
7445
|
+
}
|
|
7446
|
+
e.inputEvent.preventDefault();
|
|
7447
|
+
editorService.undo();
|
|
7448
|
+
}).keydown([this.ctrlKey, "shift", "z"], (e) => {
|
|
7449
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7450
|
+
return;
|
|
7451
|
+
}
|
|
7452
|
+
e.inputEvent.preventDefault();
|
|
7453
|
+
editorService.redo();
|
|
7454
|
+
}).keydown("up", (e) => {
|
|
7455
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7456
|
+
return;
|
|
7457
|
+
}
|
|
7458
|
+
e.inputEvent.preventDefault();
|
|
7459
|
+
editorService.move(0, -1);
|
|
7460
|
+
}).keydown("down", (e) => {
|
|
7461
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7462
|
+
return;
|
|
7463
|
+
}
|
|
7464
|
+
e.inputEvent.preventDefault();
|
|
7465
|
+
editorService.move(0, 1);
|
|
7466
|
+
}).keydown("left", (e) => {
|
|
7467
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7468
|
+
return;
|
|
7469
|
+
}
|
|
7470
|
+
e.inputEvent.preventDefault();
|
|
7471
|
+
editorService.move(-1, 0);
|
|
7472
|
+
}).keydown("right", (e) => {
|
|
7473
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7474
|
+
return;
|
|
7475
|
+
}
|
|
7476
|
+
e.inputEvent.preventDefault();
|
|
7477
|
+
editorService.move(1, 0);
|
|
7478
|
+
}).keydown([this.ctrlKey, "up"], (e) => {
|
|
7479
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7480
|
+
return;
|
|
7481
|
+
}
|
|
7482
|
+
e.inputEvent.preventDefault();
|
|
7483
|
+
editorService.move(0, -10);
|
|
7484
|
+
}).keydown([this.ctrlKey, "down"], (e) => {
|
|
7485
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7486
|
+
return;
|
|
7487
|
+
}
|
|
7488
|
+
e.inputEvent.preventDefault();
|
|
7489
|
+
editorService.move(0, 10);
|
|
7490
|
+
}).keydown([this.ctrlKey, "left"], (e) => {
|
|
7491
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7492
|
+
return;
|
|
7493
|
+
}
|
|
7494
|
+
e.inputEvent.preventDefault();
|
|
7495
|
+
editorService.move(-10, 0);
|
|
7496
|
+
}).keydown([this.ctrlKey, "right"], (e) => {
|
|
7497
|
+
e.inputEvent.preventDefault();
|
|
7498
|
+
editorService.move(10, 0);
|
|
7499
|
+
}).keydown("tab", (e) => {
|
|
7500
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7501
|
+
return;
|
|
7502
|
+
}
|
|
7503
|
+
e.inputEvent.preventDefault();
|
|
7504
|
+
editorService.selectNextNode();
|
|
7505
|
+
}).keydown([this.ctrlKey, "tab"], (e) => {
|
|
7506
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7507
|
+
return;
|
|
7508
|
+
}
|
|
7509
|
+
e.inputEvent.preventDefault();
|
|
7510
|
+
editorService.selectNextPage();
|
|
7511
|
+
}).keydown([this.ctrlKey, "="], (e) => {
|
|
7512
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7513
|
+
return;
|
|
7514
|
+
}
|
|
7515
|
+
e.inputEvent.preventDefault();
|
|
7516
|
+
uiService.zoom(0.1);
|
|
7517
|
+
}).keydown([this.ctrlKey, "numpadplus"], (e) => {
|
|
7518
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7519
|
+
return;
|
|
7520
|
+
}
|
|
7521
|
+
e.inputEvent.preventDefault();
|
|
7522
|
+
uiService.zoom(0.1);
|
|
7523
|
+
}).keydown([this.ctrlKey, "-"], (e) => {
|
|
7524
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7525
|
+
return;
|
|
7526
|
+
}
|
|
7527
|
+
e.inputEvent.preventDefault();
|
|
7528
|
+
uiService.zoom(-0.1);
|
|
7529
|
+
}).keydown([this.ctrlKey, "numpad-"], (e) => {
|
|
7530
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7531
|
+
return;
|
|
7532
|
+
}
|
|
7533
|
+
e.inputEvent.preventDefault();
|
|
7534
|
+
uiService.zoom(-0.1);
|
|
7535
|
+
}).keydown([this.ctrlKey, "0"], async (e) => {
|
|
7536
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7537
|
+
return;
|
|
7538
|
+
}
|
|
7539
|
+
e.inputEvent.preventDefault();
|
|
7540
|
+
uiService.set("zoom", await uiService.calcZoom());
|
|
7541
|
+
}).keydown([this.ctrlKey, "1"], (e) => {
|
|
7542
|
+
if (this.isDisabledKeyEvent(e.inputEvent.target)) {
|
|
7543
|
+
return;
|
|
7544
|
+
}
|
|
7545
|
+
e.inputEvent.preventDefault();
|
|
7546
|
+
uiService.set("zoom", 1);
|
|
7547
|
+
});
|
|
7548
|
+
}
|
|
7549
|
+
destroy() {
|
|
7550
|
+
this.keycon.destroy();
|
|
7551
|
+
}
|
|
7552
|
+
isDisabledKeyEvent(node) {
|
|
7553
|
+
const el = node;
|
|
7554
|
+
if (!el)
|
|
7555
|
+
return false;
|
|
7556
|
+
return el.tagName === "INPUT" || el.tagName === "TEXTAREA" || el.isContentEditable;
|
|
7557
|
+
}
|
|
7558
|
+
removeNode() {
|
|
7559
|
+
const nodes = editorService.get("nodes");
|
|
7560
|
+
if (!nodes || isPage(nodes[0]))
|
|
7561
|
+
return;
|
|
7562
|
+
editorService.remove(nodes);
|
|
7563
|
+
}
|
|
7564
|
+
}
|
|
7565
|
+
const keybindingService = new Keybinding();
|
|
7566
|
+
|
|
7474
7567
|
const editorProps = {
|
|
7475
7568
|
/** 页面初始值 */
|
|
7476
7569
|
modelValue: {
|
|
@@ -7858,7 +7951,8 @@ const _sfc_main = defineComponent({
|
|
|
7858
7951
|
storageService,
|
|
7859
7952
|
codeBlockService,
|
|
7860
7953
|
depService,
|
|
7861
|
-
dataSourceService
|
|
7954
|
+
dataSourceService,
|
|
7955
|
+
keybindingService
|
|
7862
7956
|
};
|
|
7863
7957
|
initServiceEvents(props, emit, services);
|
|
7864
7958
|
initServiceState(props, services);
|
|
@@ -7898,12 +7992,21 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
7898
7992
|
const _component_Workspace = resolveComponent("Workspace");
|
|
7899
7993
|
const _component_PropsPanel = resolveComponent("PropsPanel");
|
|
7900
7994
|
const _component_Framework = resolveComponent("Framework");
|
|
7901
|
-
return openBlock(), createBlock(_component_Framework,
|
|
7995
|
+
return openBlock(), createBlock(_component_Framework, null, {
|
|
7996
|
+
header: withCtx(() => [
|
|
7997
|
+
renderSlot(_ctx.$slots, "header")
|
|
7998
|
+
]),
|
|
7902
7999
|
nav: withCtx(() => [
|
|
7903
8000
|
renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
|
|
7904
8001
|
createVNode(_component_TMagicNavMenu, { data: _ctx.menu }, null, 8, ["data"])
|
|
7905
8002
|
])
|
|
7906
8003
|
]),
|
|
8004
|
+
"content-before": withCtx(() => [
|
|
8005
|
+
renderSlot(_ctx.$slots, "content-before")
|
|
8006
|
+
]),
|
|
8007
|
+
"src-code": withCtx(() => [
|
|
8008
|
+
renderSlot(_ctx.$slots, "src-code", { editorService: _ctx.editorService })
|
|
8009
|
+
]),
|
|
7907
8010
|
sidebar: withCtx(() => [
|
|
7908
8011
|
renderSlot(_ctx.$slots, "sidebar", { editorService: _ctx.editorService }, () => [
|
|
7909
8012
|
createVNode(_component_Sidebar, {
|
|
@@ -7975,8 +8078,14 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
7975
8078
|
empty: withCtx(() => [
|
|
7976
8079
|
renderSlot(_ctx.$slots, "empty", { editorService: _ctx.editorService })
|
|
7977
8080
|
]),
|
|
8081
|
+
"content-after": withCtx(() => [
|
|
8082
|
+
renderSlot(_ctx.$slots, "content-after")
|
|
8083
|
+
]),
|
|
8084
|
+
footer: withCtx(() => [
|
|
8085
|
+
renderSlot(_ctx.$slots, "footer")
|
|
8086
|
+
]),
|
|
7978
8087
|
_: 3
|
|
7979
|
-
}
|
|
8088
|
+
});
|
|
7980
8089
|
}
|
|
7981
8090
|
const Editor = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
7982
8091
|
|
|
@@ -8004,5 +8113,5 @@ const index = {
|
|
|
8004
8113
|
}
|
|
8005
8114
|
};
|
|
8006
8115
|
|
|
8007
|
-
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$g as CodeBlockList, CodeDeleteErrorType, _sfc_main$C as CodeSelect, _sfc_main$A as CodeSelectCol, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, _sfc_main$z as DataSourceFields, _sfc_main$y as DataSourceInput, _sfc_main$x as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$B as Icon, _sfc_main$w as KeyValue, Keys, LayerOffset, _sfc_main$a as LayerPanel, Layout, _sfc_main$s as LayoutContainer, _sfc_main$n as PropsPanel, _sfc_main$u as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$p as ToolButton, V_GUIDE_LINE_STORAGE_KEY, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, editorService, error, eventsService, fillConfig$1 as fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, uiService, useStage, warn };
|
|
8116
|
+
export { CODE_DRAFT_STORAGE_KEY, COPY_STORAGE_KEY, _sfc_main$g as CodeBlockList, CodeDeleteErrorType, _sfc_main$C as CodeSelect, _sfc_main$A as CodeSelectCol, ColumnLayout, _sfc_main$d as ComponentListPanel, _sfc_main$c as ContentMenu, _sfc_main$z as DataSourceFields, _sfc_main$y as DataSourceInput, _sfc_main$x as EventSelect, Fixed2Other, H_GUIDE_LINE_STORAGE_KEY, _sfc_main$B as Icon, _sfc_main$w as KeyValue, Keys, LayerOffset, _sfc_main$a as LayerPanel, Layout, _sfc_main$s as LayoutContainer, _sfc_main$n as PropsPanel, _sfc_main$s as SplitView, _sfc_main$u as TMagicCodeEditor, Editor as TMagicEditor, _sfc_main$p as ToolButton, V_GUIDE_LINE_STORAGE_KEY, beforePaste, change2Fixed, codeBlockService, dataSourceService, debug, index as default, depService, editorService, error, eventsService, fillConfig$1 as fillConfig, fixNodeLeft, fixNodePosition, generatePageName, generatePageNameByApp, getAddParent, getConfig, getDefaultConfig, getGuideLineFromCache, getInitPositionStyle, getNodeIndex, getPageList, getPageNameList, getPositionInContainer, getRelativeStyle, historyService, info, isFixed, log, propsService, serializeConfig, setConfig, setLayout, storageService, uiService, useStage, warn };
|
|
8008
8117
|
//# sourceMappingURL=tmagic-editor.js.map
|