@tmagic/editor 1.2.0-beta.25 → 1.2.0-beta.27
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 +32 -16
- package/dist/tmagic-editor.js +38 -14
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +38 -14
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +10 -10
- package/src/Editor.vue +13 -4
- package/src/layouts/NavMenu.vue +1 -1
- package/src/layouts/PropsPanel.vue +5 -1
- package/src/layouts/sidebar/LayerPanel.vue +10 -6
- package/src/services/BaseService.ts +6 -2
- package/src/services/editor.ts +12 -1
- package/src/theme/code-block.scss +11 -3
- package/src/theme/component-list-panel.scss +8 -5
- package/src/type.ts +1 -0
- package/src/utils/stage.ts +1 -0
- package/types/Editor.vue.d.ts +7 -0
- package/types/components/CodeDraftEditor.vue.d.ts +19 -111
- package/types/components/ContentMenu.vue.d.ts +11 -87
- package/types/components/FunctionEditor.vue.d.ts +13 -90
- package/types/components/Icon.vue.d.ts +4 -50
- package/types/components/ScrollBar.vue.d.ts +7 -65
- package/types/components/ToolButton.vue.d.ts +12 -78
- package/types/fields/Code.vue.d.ts +11 -77
- package/types/fields/CodeLink.vue.d.ts +12 -82
- package/types/fields/CodeSelect.vue.d.ts +10 -74
- package/types/fields/UISelect.vue.d.ts +7 -65
- package/types/layouts/AddPageBox.vue.d.ts +1 -43
- package/types/layouts/CodeEditor.vue.d.ts +21 -122
- package/types/layouts/NavMenu.vue.d.ts +9 -69
- package/types/layouts/sidebar/LayerMenu.vue.d.ts +5 -55
- package/types/layouts/workspace/Breadcrumb.vue.d.ts +1 -43
- package/types/layouts/workspace/Stage.vue.d.ts +4 -51
- package/types/layouts/workspace/ViewerMenu.vue.d.ts +9 -69
- package/types/type.d.ts +1 -0
|
@@ -875,8 +875,12 @@
|
|
|
875
875
|
});
|
|
876
876
|
}
|
|
877
877
|
removeAllPlugins() {
|
|
878
|
-
this.pluginOptionsList
|
|
879
|
-
|
|
878
|
+
Object.keys(this.pluginOptionsList).forEach((key) => {
|
|
879
|
+
this.pluginOptionsList[key] = [];
|
|
880
|
+
});
|
|
881
|
+
Object.keys(this.middleware).forEach((key) => {
|
|
882
|
+
this.middleware[key] = [];
|
|
883
|
+
});
|
|
880
884
|
}
|
|
881
885
|
async doTask() {
|
|
882
886
|
this.doingTask = true;
|
|
@@ -2026,8 +2030,16 @@
|
|
|
2026
2030
|
const config = await storageService.getItem(COPY_STORAGE_KEY);
|
|
2027
2031
|
if (!Array.isArray(config))
|
|
2028
2032
|
return;
|
|
2033
|
+
const node = this.get("node");
|
|
2034
|
+
let parent = void 0;
|
|
2035
|
+
if (config.length === 1 && config[0].id === node.id) {
|
|
2036
|
+
parent = this.get("parent");
|
|
2037
|
+
if (parent.type === schema.NodeType.ROOT) {
|
|
2038
|
+
parent = this.get("page");
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2029
2041
|
const pasteConfigs = await this.doPaste(config, position);
|
|
2030
|
-
return this.add(pasteConfigs,
|
|
2042
|
+
return this.add(pasteConfigs, parent);
|
|
2031
2043
|
}
|
|
2032
2044
|
async doPaste(config, position = {}) {
|
|
2033
2045
|
const pasteConfigs = await beforePaste(position, lodashEs.cloneDeep(config));
|
|
@@ -2615,6 +2627,7 @@
|
|
|
2615
2627
|
containerHighlightClassName: stageOptions.containerHighlightClassName,
|
|
2616
2628
|
containerHighlightDuration: stageOptions.containerHighlightDuration,
|
|
2617
2629
|
containerHighlightType: stageOptions.containerHighlightType,
|
|
2630
|
+
disabledDragStart: stageOptions.disabledDragStart,
|
|
2618
2631
|
canSelect: (el, event, stop) => {
|
|
2619
2632
|
const elCanSelect = stageOptions.canSelect(el);
|
|
2620
2633
|
if (uiSelectMode.value && elCanSelect && event.type === "mousedown") {
|
|
@@ -3199,6 +3212,9 @@
|
|
|
3199
3212
|
vue.onMounted(() => {
|
|
3200
3213
|
emit("mounted", internalInstance);
|
|
3201
3214
|
});
|
|
3215
|
+
vue.onUnmounted(() => {
|
|
3216
|
+
services?.propsService.off("props-configs-change", init);
|
|
3217
|
+
});
|
|
3202
3218
|
vue.watchEffect(() => {
|
|
3203
3219
|
if (configForm.value && stage.value) {
|
|
3204
3220
|
configForm.value.formState.stage = stage.value;
|
|
@@ -4296,11 +4312,6 @@
|
|
|
4296
4312
|
const spliceNodeKey = vue.ref();
|
|
4297
4313
|
const filterText = vue.ref("");
|
|
4298
4314
|
const defaultExpandedKeys = vue.computed(() => selectedIds.value.length > 0 ? selectedIds.value : []);
|
|
4299
|
-
editorService?.on("remove", () => {
|
|
4300
|
-
setTimeout(() => {
|
|
4301
|
-
tree.value?.getNode(editorService.get("node").id)?.updateChildren();
|
|
4302
|
-
}, 0);
|
|
4303
|
-
});
|
|
4304
4315
|
const select = async (data) => {
|
|
4305
4316
|
if (!data.id) {
|
|
4306
4317
|
throw new Error("\u6CA1\u6709id");
|
|
@@ -4437,8 +4448,14 @@
|
|
|
4437
4448
|
tree.value?.$el.blur();
|
|
4438
4449
|
isMultiSelectStatus.value = false;
|
|
4439
4450
|
};
|
|
4451
|
+
const editorServiceRemoveHandler = () => {
|
|
4452
|
+
setTimeout(() => {
|
|
4453
|
+
tree.value?.getNode(editorService?.get("node").id)?.updateChildren();
|
|
4454
|
+
}, 0);
|
|
4455
|
+
};
|
|
4440
4456
|
let keycon;
|
|
4441
4457
|
vue.onMounted(() => {
|
|
4458
|
+
editorService?.on("remove", editorServiceRemoveHandler);
|
|
4442
4459
|
keycon = new KeyController__default.default(tree.value?.$el);
|
|
4443
4460
|
const isMac = /mac os x/.test(navigator.userAgent.toLowerCase());
|
|
4444
4461
|
const ctrl = isMac ? "meta" : "ctrl";
|
|
@@ -4452,6 +4469,7 @@
|
|
|
4452
4469
|
});
|
|
4453
4470
|
vue.onUnmounted(() => {
|
|
4454
4471
|
keycon.destroy();
|
|
4472
|
+
editorService?.off("remove", editorServiceRemoveHandler);
|
|
4455
4473
|
});
|
|
4456
4474
|
const clicked = vue.ref(false);
|
|
4457
4475
|
const highlightNode = vue.computed(() => editorService?.get("highlightNode"));
|
|
@@ -5811,7 +5829,7 @@
|
|
|
5811
5829
|
const _sfc_main = vue.defineComponent({
|
|
5812
5830
|
name: "m-editor",
|
|
5813
5831
|
components: {
|
|
5814
|
-
|
|
5832
|
+
TMagicNavMenu: _sfc_main$j,
|
|
5815
5833
|
Sidebar: _sfc_main$9,
|
|
5816
5834
|
Workspace: _sfc_main$1,
|
|
5817
5835
|
PropsPanel: _sfc_main$i,
|
|
@@ -5894,11 +5912,14 @@
|
|
|
5894
5912
|
},
|
|
5895
5913
|
updateDragEl: {
|
|
5896
5914
|
type: Function
|
|
5915
|
+
},
|
|
5916
|
+
disabledDragStart: {
|
|
5917
|
+
type: Boolean
|
|
5897
5918
|
}
|
|
5898
5919
|
},
|
|
5899
5920
|
emits: ["props-panel-mounted", "update:modelValue"],
|
|
5900
5921
|
setup(props, { emit }) {
|
|
5901
|
-
|
|
5922
|
+
const rootChangeHandler = (value, preValue) => {
|
|
5902
5923
|
const nodeId = editorService.get("node")?.id || props.defaultSelected;
|
|
5903
5924
|
let node;
|
|
5904
5925
|
if (nodeId) {
|
|
@@ -5916,7 +5937,8 @@
|
|
|
5916
5937
|
if (vue.toRaw(value) !== vue.toRaw(preValue)) {
|
|
5917
5938
|
emit("update:modelValue", value);
|
|
5918
5939
|
}
|
|
5919
|
-
}
|
|
5940
|
+
};
|
|
5941
|
+
editorService.on("root-change", rootChangeHandler);
|
|
5920
5942
|
vue.watch(
|
|
5921
5943
|
() => props.modelValue,
|
|
5922
5944
|
(modelValue) => {
|
|
@@ -5984,6 +6006,7 @@
|
|
|
5984
6006
|
uiService.resetState();
|
|
5985
6007
|
componentListService.resetState();
|
|
5986
6008
|
codeBlockService.resetState();
|
|
6009
|
+
editorService.off("root-change", rootChangeHandler);
|
|
5987
6010
|
});
|
|
5988
6011
|
const services = {
|
|
5989
6012
|
componentListService,
|
|
@@ -6009,7 +6032,8 @@
|
|
|
6009
6032
|
isContainer: props.isContainer,
|
|
6010
6033
|
containerHighlightClassName: props.containerHighlightClassName,
|
|
6011
6034
|
containerHighlightDuration: props.containerHighlightDuration,
|
|
6012
|
-
containerHighlightType: props.containerHighlightType
|
|
6035
|
+
containerHighlightType: props.containerHighlightType,
|
|
6036
|
+
disabledDragStart: props.disabledDragStart
|
|
6013
6037
|
})
|
|
6014
6038
|
);
|
|
6015
6039
|
return services;
|
|
@@ -6025,7 +6049,7 @@
|
|
|
6025
6049
|
};
|
|
6026
6050
|
|
|
6027
6051
|
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
6028
|
-
const
|
|
6052
|
+
const _component_TMagicNavMenu = vue.resolveComponent("TMagicNavMenu");
|
|
6029
6053
|
const _component_Sidebar = vue.resolveComponent("Sidebar");
|
|
6030
6054
|
const _component_Workspace = vue.resolveComponent("Workspace");
|
|
6031
6055
|
const _component_PropsPanel = vue.resolveComponent("PropsPanel");
|
|
@@ -6033,7 +6057,7 @@
|
|
|
6033
6057
|
return vue.openBlock(), vue.createBlock(_component_Framework, { "code-options": _ctx.codeOptions }, {
|
|
6034
6058
|
nav: vue.withCtx(() => [
|
|
6035
6059
|
vue.renderSlot(_ctx.$slots, "nav", { editorService: _ctx.editorService }, () => [
|
|
6036
|
-
vue.createVNode(
|
|
6060
|
+
vue.createVNode(_component_TMagicNavMenu, { data: _ctx.menu }, null, 8, ["data"])
|
|
6037
6061
|
])
|
|
6038
6062
|
]),
|
|
6039
6063
|
sidebar: vue.withCtx(() => [
|