@tmagic/editor 1.3.8 → 1.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tmagic-editor.js +31 -21
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +31 -22
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +12 -11
- package/src/components/CodeBlockEditor.vue +1 -1
- package/src/components/FloatingBox.vue +1 -1
- package/src/components/ToolButton.vue +2 -2
- package/src/fields/EventSelect.vue +1 -1
- package/src/fields/KeyValue.vue +1 -1
- package/src/fields/UISelect.vue +4 -4
- package/src/layouts/CodeEditor.vue +1 -1
- package/src/layouts/page-bar/SwitchTypeButton.vue +1 -1
- package/src/layouts/workspace/Breadcrumb.vue +1 -1
- package/src/services/editor.ts +13 -5
- package/src/services/props.ts +9 -4
- package/src/utils/monaco-editor.ts +8 -0
- package/types/layouts/CodeEditor.vue.d.ts +1 -1
- package/types/utils/monaco-editor.d.ts +2 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', 'lodash-es', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.iconsVue, global.lodashEs, global.
|
|
5
|
-
})(this, (function (exports, vue, iconsVue, lodashEs,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue'), require('@element-plus/icons-vue'), require('lodash-es'), require('serialize-javascript'), require('@tmagic/design'), require('emmet-monaco-es'), require('monaco-editor'), require('@tmagic/schema'), require('@tmagic/form'), require('@tmagic/table'), require('@tmagic/utils'), require('gesto'), require('moveable'), require('@tmagic/dep'), require('@tmagic/stage'), require('events'), require('@tmagic/core'), require('keycon')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'vue', '@element-plus/icons-vue', 'lodash-es', 'serialize-javascript', '@tmagic/design', 'emmet-monaco-es', 'monaco-editor', '@tmagic/schema', '@tmagic/form', '@tmagic/table', '@tmagic/utils', 'gesto', 'moveable', '@tmagic/dep', '@tmagic/stage', 'events', '@tmagic/core', 'keycon'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.TMagicEditor = {}, global.Vue, global.iconsVue, global.lodashEs, global.serialize, global.design, global.emmetMonacoEs, global.monaco, global.schema, global.form, global.table, global.utils, global.Gesto, global.Moveable, global.dep, global.StageCore, global.events, global.core, global.KeyController));
|
|
5
|
+
})(this, (function (exports, vue, iconsVue, lodashEs, serialize, design, emmetMonacoEs, monaco, schema, form, table, utils, Gesto, Moveable, dep, StageCore, events, core, KeyController) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
};
|
|
30
30
|
const getConfig = (key) => $TMAGIC_EDITOR[key];
|
|
31
31
|
|
|
32
|
+
emmetMonacoEs.emmetHTML(monaco__namespace);
|
|
33
|
+
emmetMonacoEs.emmetCSS(monaco__namespace, ["css", "scss"]);
|
|
34
|
+
|
|
32
35
|
const _hoisted_1$t = {
|
|
33
36
|
class: /* @__PURE__ */ vue.normalizeClass(`magic-code-editor`)
|
|
34
37
|
};
|
|
@@ -618,7 +621,7 @@
|
|
|
618
621
|
left: vue.withCtx(() => [
|
|
619
622
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
620
623
|
type: "primary",
|
|
621
|
-
|
|
624
|
+
link: "",
|
|
622
625
|
onClick: _cache[0] || (_cache[0] = ($event) => difVisible.value = true)
|
|
623
626
|
}, {
|
|
624
627
|
default: vue.withCtx(() => [
|
|
@@ -2259,11 +2262,11 @@
|
|
|
2259
2262
|
if (!targetConfig)
|
|
2260
2263
|
return;
|
|
2261
2264
|
target.deps[config.id]?.keys?.forEach((fullKey) => {
|
|
2262
|
-
const relateOriginId =
|
|
2265
|
+
const relateOriginId = utils.getValueByKeyPath(fullKey, config);
|
|
2263
2266
|
const relateTargetId = relateIdMap[relateOriginId];
|
|
2264
2267
|
if (!relateTargetId)
|
|
2265
2268
|
return;
|
|
2266
|
-
|
|
2269
|
+
utils.setValueByKeyPath(fullKey, relateTargetId, targetConfig);
|
|
2267
2270
|
});
|
|
2268
2271
|
});
|
|
2269
2272
|
}
|
|
@@ -2903,14 +2906,19 @@
|
|
|
2903
2906
|
const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
|
|
2904
2907
|
const layout = await this.getLayout(parent, node);
|
|
2905
2908
|
const isRelative = layout === Layout.RELATIVE;
|
|
2906
|
-
|
|
2909
|
+
let offsetIndex;
|
|
2907
2910
|
if (offset === LayerOffset.TOP) {
|
|
2908
|
-
|
|
2911
|
+
offsetIndex = isRelative ? 0 : brothers.length;
|
|
2909
2912
|
} else if (offset === LayerOffset.BOTTOM) {
|
|
2910
|
-
|
|
2913
|
+
offsetIndex = isRelative ? brothers.length : 0;
|
|
2911
2914
|
} else {
|
|
2912
|
-
|
|
2915
|
+
offsetIndex = index + (isRelative ? -offset : offset);
|
|
2913
2916
|
}
|
|
2917
|
+
if (offsetIndex > 0 && offsetIndex > brothers.length || offsetIndex < 0) {
|
|
2918
|
+
return;
|
|
2919
|
+
}
|
|
2920
|
+
brothers.splice(index, 1);
|
|
2921
|
+
brothers.splice(offsetIndex, 0, node);
|
|
2914
2922
|
const grandparent = this.getParentById(parent.id);
|
|
2915
2923
|
this.get("stage")?.update({
|
|
2916
2924
|
config: lodashEs.cloneDeep(vue.toRaw(parent)),
|
|
@@ -2919,6 +2927,7 @@
|
|
|
2919
2927
|
});
|
|
2920
2928
|
this.addModifiedNodeId(parent.id);
|
|
2921
2929
|
this.pushHistoryState();
|
|
2930
|
+
this.emit("move-layer", offset);
|
|
2922
2931
|
}
|
|
2923
2932
|
/**
|
|
2924
2933
|
* 移动到指定容器中
|
|
@@ -4905,7 +4914,7 @@
|
|
|
4905
4914
|
}, null, 8, ["config", "model", "disabled", "size"]),
|
|
4906
4915
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
4907
4916
|
style: { "color": "#f56c6c" },
|
|
4908
|
-
|
|
4917
|
+
link: "",
|
|
4909
4918
|
icon: vue.unref(iconsVue.Delete),
|
|
4910
4919
|
disabled: _ctx.disabled,
|
|
4911
4920
|
size: _ctx.size,
|
|
@@ -5069,7 +5078,7 @@
|
|
|
5069
5078
|
key: 2,
|
|
5070
5079
|
size: "default",
|
|
5071
5080
|
disabled: _ctx.disabled,
|
|
5072
|
-
|
|
5081
|
+
link: "",
|
|
5073
5082
|
icon: _sfc_main$D,
|
|
5074
5083
|
onClick: _cache[0] || (_cache[0] = ($event) => showCode.value = !showCode.value)
|
|
5075
5084
|
}, null, 8, ["disabled"])) : vue.createCommentVNode("", true)
|
|
@@ -5234,7 +5243,7 @@
|
|
|
5234
5243
|
icon: vue.unref(iconsVue.Delete),
|
|
5235
5244
|
disabled: _ctx.disabled,
|
|
5236
5245
|
size: _ctx.size,
|
|
5237
|
-
|
|
5246
|
+
link: "",
|
|
5238
5247
|
style: { "padding": "0" }
|
|
5239
5248
|
}, {
|
|
5240
5249
|
default: vue.withCtx(() => [
|
|
@@ -5255,7 +5264,7 @@
|
|
|
5255
5264
|
icon: vue.unref(iconsVue.Close),
|
|
5256
5265
|
disabled: _ctx.disabled,
|
|
5257
5266
|
size: _ctx.size,
|
|
5258
|
-
|
|
5267
|
+
link: "",
|
|
5259
5268
|
onClick: vue.withModifiers(deleteHandler, ["stop"])
|
|
5260
5269
|
}, null, 8, ["icon", "disabled", "size", "onClick"])
|
|
5261
5270
|
]),
|
|
@@ -5267,7 +5276,7 @@
|
|
|
5267
5276
|
}, {
|
|
5268
5277
|
default: vue.withCtx(() => [
|
|
5269
5278
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
5270
|
-
|
|
5279
|
+
link: "",
|
|
5271
5280
|
style: { "padding": "0", "margin": "0" },
|
|
5272
5281
|
disabled: _ctx.disabled,
|
|
5273
5282
|
size: _ctx.size,
|
|
@@ -5290,7 +5299,7 @@
|
|
|
5290
5299
|
}, {
|
|
5291
5300
|
default: vue.withCtx(() => [
|
|
5292
5301
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
5293
|
-
|
|
5302
|
+
link: "",
|
|
5294
5303
|
style: { "padding": "0", "margin": "0" },
|
|
5295
5304
|
disabled: _ctx.disabled,
|
|
5296
5305
|
size: _ctx.size,
|
|
@@ -5602,7 +5611,7 @@
|
|
|
5602
5611
|
default: vue.withCtx(() => [
|
|
5603
5612
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
5604
5613
|
size: "small",
|
|
5605
|
-
|
|
5614
|
+
link: "",
|
|
5606
5615
|
disabled: disabled.value
|
|
5607
5616
|
}, {
|
|
5608
5617
|
default: vue.withCtx(() => [
|
|
@@ -5619,7 +5628,7 @@
|
|
|
5619
5628
|
}, 8, ["content"])) : (vue.openBlock(), vue.createBlock(vue.unref(design.TMagicButton), {
|
|
5620
5629
|
key: 1,
|
|
5621
5630
|
size: "small",
|
|
5622
|
-
|
|
5631
|
+
link: "",
|
|
5623
5632
|
disabled: disabled.value,
|
|
5624
5633
|
title: _ctx.data.text
|
|
5625
5634
|
}, {
|
|
@@ -5877,7 +5886,7 @@
|
|
|
5877
5886
|
class: vue.normalizeClass(["m-editor-page-bar-switch-type-button", { active: _ctx.modelValue === item.type }]),
|
|
5878
5887
|
size: "small",
|
|
5879
5888
|
key: item.type,
|
|
5880
|
-
|
|
5889
|
+
link: "",
|
|
5881
5890
|
type: _ctx.modelValue === item.type ? "primary" : "",
|
|
5882
5891
|
onClick: ($event) => clickHandler(item.type)
|
|
5883
5892
|
}, {
|
|
@@ -9445,7 +9454,7 @@
|
|
|
9445
9454
|
]),
|
|
9446
9455
|
vue.createElementVNode("div", null, [
|
|
9447
9456
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
9448
|
-
|
|
9457
|
+
link: "",
|
|
9449
9458
|
size: "small",
|
|
9450
9459
|
icon: vue.unref(iconsVue.Close),
|
|
9451
9460
|
onClick: closeHandler
|
|
@@ -9962,7 +9971,7 @@
|
|
|
9962
9971
|
key: item.id
|
|
9963
9972
|
}, [
|
|
9964
9973
|
vue.createVNode(vue.unref(design.TMagicButton), {
|
|
9965
|
-
|
|
9974
|
+
link: "",
|
|
9966
9975
|
disabled: item.id === node.value?.id,
|
|
9967
9976
|
onClick: ($event) => select(item)
|
|
9968
9977
|
}, {
|