@tmagic/editor 1.2.13 → 1.2.14
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 +37 -6
- package/dist/tmagic-editor.js +770 -394
- package/dist/tmagic-editor.js.map +1 -1
- package/dist/tmagic-editor.umd.cjs +789 -420
- package/dist/tmagic-editor.umd.cjs.map +1 -1
- package/package.json +14 -13
- package/src/components/CodeDraftEditor.vue +20 -17
- package/src/components/ContentMenu.vue +1 -1
- package/src/components/FunctionEditor.vue +10 -10
- package/src/components/Layout.vue +1 -1
- package/src/components/ScrollViewer.vue +2 -2
- package/src/fields/CodeSelect.vue +18 -101
- package/src/fields/CodeSelectCol.vue +21 -3
- package/src/fields/EventSelect.vue +5 -3
- package/src/fields/UISelect.vue +1 -1
- package/src/icons/AppManageIcon.vue +11 -0
- package/src/icons/CodeIcon.vue +35 -0
- package/src/layouts/AddPageBox.vue +3 -3
- package/src/layouts/Framework.vue +4 -4
- package/src/layouts/NavMenu.vue +2 -2
- package/src/layouts/PropsPanel.vue +1 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +3 -3
- package/src/layouts/sidebar/LayerMenu.vue +2 -2
- package/src/layouts/sidebar/LayerPanel.vue +4 -4
- package/src/layouts/sidebar/Sidebar.vue +3 -3
- package/src/layouts/sidebar/code-block/CodeBlockEditor.vue +15 -6
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +26 -13
- package/src/layouts/workspace/Breadcrumb.vue +1 -1
- package/src/layouts/workspace/PageBar.vue +2 -2
- package/src/layouts/workspace/PageBarScrollContainer.vue +3 -3
- package/src/layouts/workspace/Stage.vue +3 -3
- package/src/layouts/workspace/ViewerMenu.vue +4 -4
- package/src/layouts/workspace/Workspace.vue +1 -1
- package/src/services/BaseService.ts +1 -1
- package/src/services/codeBlock.ts +3 -3
- package/src/services/componentList.ts +1 -1
- package/src/services/editor.ts +6 -6
- package/src/services/events.ts +1 -1
- package/src/services/history.ts +2 -2
- package/src/services/props.ts +2 -2
- package/src/services/ui.ts +2 -2
- package/src/theme/code-block.scss +28 -4
- package/src/theme/event.scss +12 -0
- package/src/utils/config.ts +1 -1
- package/src/utils/dep.ts +2 -2
- package/src/utils/editor.ts +1 -1
- package/src/utils/operator.ts +4 -4
- package/src/utils/stage.ts +3 -3
- package/tsconfig.build.json +4 -1
- package/types/components/CodeDraftEditor.vue.d.ts +7 -4
- package/types/components/ContentMenu.vue.d.ts +3 -3
- package/types/components/FunctionEditor.vue.d.ts +140 -8
- package/types/components/Icon.vue.d.ts +2 -2
- package/types/components/Layout.vue.d.ts +28 -113
- package/types/components/ScrollBar.vue.d.ts +2 -2
- package/types/components/ScrollViewer.vue.d.ts +32 -135
- package/types/components/ToolButton.vue.d.ts +3 -3
- package/types/fields/Code.vue.d.ts +2 -2
- package/types/fields/CodeLink.vue.d.ts +2 -2
- package/types/fields/CodeSelect.vue.d.ts +8 -27
- package/types/fields/CodeSelectCol.vue.d.ts +3 -3
- package/types/fields/EventSelect.vue.d.ts +3 -3
- package/types/fields/UISelect.vue.d.ts +2 -2
- package/types/icons/AppManageIcon.vue.d.ts +2 -0
- package/types/icons/CodeIcon.vue.d.ts +2 -0
- package/types/layouts/CodeEditor.vue.d.ts +4 -4
- package/types/layouts/Framework.vue.d.ts +23 -74
- package/types/layouts/NavMenu.vue.d.ts +3 -3
- package/types/layouts/PropsPanel.vue.d.ts +11 -60
- package/types/layouts/Resizer.vue.d.ts +9 -54
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +11 -50
- package/types/layouts/sidebar/LayerMenu.vue.d.ts +2 -2
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +17 -60
- package/types/layouts/sidebar/Sidebar.vue.d.ts +39 -104
- package/types/layouts/sidebar/code-block/CodeBlockEditor.vue.d.ts +15 -58
- package/types/layouts/sidebar/code-block/CodeBlockList.vue.d.ts +21 -66
- package/types/layouts/workspace/PageBar.vue.d.ts +13 -52
- package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +8 -48
- package/types/layouts/workspace/Stage.vue.d.ts +2 -2
- package/types/layouts/workspace/ViewerMenu.vue.d.ts +3 -3
- package/types/layouts/workspace/Workspace.vue.d.ts +20 -63
- package/types/services/codeBlock.d.ts +1 -1
- package/types/services/componentList.d.ts +1 -1
- package/types/services/dep.d.ts +2 -2
- package/types/services/editor.d.ts +1 -1
- package/types/services/events.d.ts +1 -1
- package/types/services/history.d.ts +2 -2
- package/types/services/props.d.ts +78 -1
- package/types/services/storage.d.ts +1 -1
- package/types/services/ui.d.ts +2 -2
- package/types/type.d.ts +8 -8
- package/types/utils/operator.d.ts +1 -1
- package/types/utils/props.d.ts +78 -1
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
class="code-editor-dialog"
|
|
4
4
|
:model-value="true"
|
|
5
5
|
:title="currentTitle"
|
|
6
|
-
:close-on-press-escape="
|
|
6
|
+
:close-on-press-escape="true"
|
|
7
7
|
:append-to-body="true"
|
|
8
8
|
:show-close="false"
|
|
9
|
-
:close-on-click-modal="
|
|
9
|
+
:close-on-click-modal="true"
|
|
10
10
|
:size="size"
|
|
11
|
+
:before-close="handleClose"
|
|
11
12
|
>
|
|
12
13
|
<Layout v-model:left="left" :min-left="45" class="code-editor-layout">
|
|
13
14
|
<!-- 右侧区域 -->
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
<div v-if="!isEmpty(codeConfig)" class="m-editor-code-block-editor-panel">
|
|
16
17
|
<slot name="code-block-edit-panel-header" :id="id"></slot>
|
|
17
18
|
<FunctionEditor
|
|
19
|
+
ref="functionEditor"
|
|
18
20
|
v-if="codeConfig"
|
|
19
21
|
:id="id"
|
|
20
22
|
:name="codeConfig.name"
|
|
@@ -38,10 +40,10 @@ import { TMagicDrawer } from '@tmagic/design';
|
|
|
38
40
|
import { ColumnConfig } from '@tmagic/form';
|
|
39
41
|
import { CodeBlockContent } from '@tmagic/schema';
|
|
40
42
|
|
|
41
|
-
import FunctionEditor from '
|
|
42
|
-
import Layout from '
|
|
43
|
-
import type { ListState, Services } from '
|
|
44
|
-
import { serializeConfig } from '
|
|
43
|
+
import FunctionEditor from '@editor/components/FunctionEditor.vue';
|
|
44
|
+
import Layout from '@editor/components/Layout.vue';
|
|
45
|
+
import type { ListState, Services } from '@editor/type';
|
|
46
|
+
import { serializeConfig } from '@editor/utils/editor';
|
|
45
47
|
|
|
46
48
|
const services = inject<Services>('services');
|
|
47
49
|
const codeOptions = inject('codeOptions', {});
|
|
@@ -84,4 +86,11 @@ watchEffect(async () => {
|
|
|
84
86
|
});
|
|
85
87
|
currentTitle.value = state.codeList[0]?.name || '';
|
|
86
88
|
});
|
|
89
|
+
|
|
90
|
+
const functionEditor = ref<InstanceType<typeof FunctionEditor>>();
|
|
91
|
+
|
|
92
|
+
const handleClose = async () => {
|
|
93
|
+
// 触发codeDraftEditor组件关闭事件
|
|
94
|
+
await functionEditor.value?.codeDraftEditor?.close();
|
|
95
|
+
};
|
|
87
96
|
</script>
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
class="magic-editor-layer-tree"
|
|
16
16
|
node-key="id"
|
|
17
17
|
empty-text="暂无代码块"
|
|
18
|
-
default-
|
|
18
|
+
:default-expanded-keys="expandedKeys"
|
|
19
19
|
:expand-on-click-node="false"
|
|
20
20
|
:data="codeList"
|
|
21
21
|
:highlight-current="true"
|
|
@@ -25,7 +25,11 @@
|
|
|
25
25
|
<template #default="{ data }">
|
|
26
26
|
<div :id="data.id" class="list-container">
|
|
27
27
|
<div class="list-item">
|
|
28
|
-
<
|
|
28
|
+
<CodeIcon v-if="data.type === 'code'" class="codeIcon"></CodeIcon>
|
|
29
|
+
<AppManageIcon v-if="data.type === 'node'" class="compIcon"></AppManageIcon>
|
|
30
|
+
<span class="code-name" :class="{ code: data.type === 'code', hook: data.type === 'key' }"
|
|
31
|
+
>{{ data.name }}({{ data.id }})</span
|
|
32
|
+
>
|
|
29
33
|
<!-- 右侧工具栏 -->
|
|
30
34
|
<div class="right-tool" v-if="data.type === 'code'">
|
|
31
35
|
<TMagicTooltip effect="dark" :content="editable ? '编辑' : '查看'" placement="bottom">
|
|
@@ -58,9 +62,11 @@ import { TMagicButton, tMagicMessage, TMagicScrollbar, TMagicTooltip, TMagicTree
|
|
|
58
62
|
import { ColumnConfig } from '@tmagic/form';
|
|
59
63
|
import { CodeBlockContent, Id } from '@tmagic/schema';
|
|
60
64
|
|
|
61
|
-
import Icon from '
|
|
62
|
-
import SearchInput from '
|
|
63
|
-
import
|
|
65
|
+
import Icon from '@editor/components/Icon.vue';
|
|
66
|
+
import SearchInput from '@editor/components/SearchInput.vue';
|
|
67
|
+
import AppManageIcon from '@editor/icons/AppManageIcon.vue';
|
|
68
|
+
import CodeIcon from '@editor/icons/CodeIcon.vue';
|
|
69
|
+
import { CodeDeleteErrorType, CodeDslItem, Services } from '@editor/type';
|
|
64
70
|
|
|
65
71
|
import CodeBlockEditor from './CodeBlockEditor.vue';
|
|
66
72
|
|
|
@@ -73,20 +79,27 @@ const { codeBlockService, depService, editorService } = inject<Services>('servic
|
|
|
73
79
|
|
|
74
80
|
// 代码块列表
|
|
75
81
|
const codeList = computed(() =>
|
|
76
|
-
Object.values(depService?.targets['code-block'] || {}).map((target) =>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
type: 'code',
|
|
80
|
-
codeBlockContent: codeBlockService?.getCodeContentById(target.id),
|
|
81
|
-
children: Object.entries(target.deps).map(([id, dep]) => ({
|
|
82
|
+
Object.values(depService?.targets['code-block'] || {}).map((target) => {
|
|
83
|
+
// 组件节点
|
|
84
|
+
const compNodes = Object.entries(target.deps).map(([id, dep]) => ({
|
|
82
85
|
name: dep.name,
|
|
83
86
|
type: 'node',
|
|
84
87
|
id,
|
|
85
88
|
children: dep.keys.map((key) => ({ name: key, id: key, type: 'key' })),
|
|
86
|
-
}))
|
|
87
|
-
|
|
89
|
+
}));
|
|
90
|
+
return {
|
|
91
|
+
id: target.id,
|
|
92
|
+
name: target.name,
|
|
93
|
+
type: 'code',
|
|
94
|
+
codeBlockContent: codeBlockService?.getCodeContentById(target.id),
|
|
95
|
+
children: compNodes,
|
|
96
|
+
};
|
|
97
|
+
}),
|
|
88
98
|
);
|
|
89
99
|
|
|
100
|
+
// 默认展开组件层级的节点
|
|
101
|
+
const expandedKeys = computed(() => codeList.value.map((item) => item.id));
|
|
102
|
+
|
|
90
103
|
const editable = computed(() => codeBlockService?.getEditStatus());
|
|
91
104
|
|
|
92
105
|
// 是否展示代码编辑区
|
|
@@ -14,7 +14,7 @@ import { TMagicButton } from '@tmagic/design';
|
|
|
14
14
|
import type { MNode } from '@tmagic/schema';
|
|
15
15
|
import { getNodePath } from '@tmagic/utils';
|
|
16
16
|
|
|
17
|
-
import type { Services } from '
|
|
17
|
+
import type { Services } from '@editor/type';
|
|
18
18
|
|
|
19
19
|
const services = inject<Services>('services');
|
|
20
20
|
const editorService = services?.editorService;
|
|
@@ -53,8 +53,8 @@ import { CaretBottom, Delete, DocumentCopy } from '@element-plus/icons-vue';
|
|
|
53
53
|
import { TMagicIcon, TMagicPopover, TMagicTooltip } from '@tmagic/design';
|
|
54
54
|
import type { MPage } from '@tmagic/schema';
|
|
55
55
|
|
|
56
|
-
import ToolButton from '
|
|
57
|
-
import type { Services } from '
|
|
56
|
+
import ToolButton from '@editor/components/ToolButton.vue';
|
|
57
|
+
import type { Services } from '@editor/type';
|
|
58
58
|
|
|
59
59
|
import PageBarScrollContainer from './PageBarScrollContainer.vue';
|
|
60
60
|
|
|
@@ -32,9 +32,9 @@ import { ArrowLeftBold, ArrowRightBold, Plus } from '@element-plus/icons-vue';
|
|
|
32
32
|
|
|
33
33
|
import { NodeType } from '@tmagic/schema';
|
|
34
34
|
|
|
35
|
-
import Icon from '
|
|
36
|
-
import type { Services } from '
|
|
37
|
-
import { generatePageNameByApp } from '
|
|
35
|
+
import Icon from '@editor/components/Icon.vue';
|
|
36
|
+
import type { Services } from '@editor/type';
|
|
37
|
+
import { generatePageNameByApp } from '@editor/utils/editor';
|
|
38
38
|
|
|
39
39
|
const services = inject<Services>('services');
|
|
40
40
|
const editorService = services?.editorService;
|
|
@@ -33,9 +33,9 @@ import { cloneDeep } from 'lodash-es';
|
|
|
33
33
|
import type { MContainer } from '@tmagic/schema';
|
|
34
34
|
import StageCore, { calcValueByFontsize, getOffset, Runtime } from '@tmagic/stage';
|
|
35
35
|
|
|
36
|
-
import ScrollViewer from '
|
|
37
|
-
import { Layout, MenuButton, MenuComponent, Services, StageOptions } from '
|
|
38
|
-
import { useStage } from '
|
|
36
|
+
import ScrollViewer from '@editor/components/ScrollViewer.vue';
|
|
37
|
+
import { Layout, MenuButton, MenuComponent, Services, StageOptions } from '@editor/type';
|
|
38
|
+
import { useStage } from '@editor/utils/stage';
|
|
39
39
|
|
|
40
40
|
import ViewerMenu from './ViewerMenu.vue';
|
|
41
41
|
|
|
@@ -9,10 +9,10 @@ import { Bottom, CopyDocument, Delete, DocumentCopy, Top } from '@element-plus/i
|
|
|
9
9
|
import { NodeType } from '@tmagic/schema';
|
|
10
10
|
import { isPage } from '@tmagic/utils';
|
|
11
11
|
|
|
12
|
-
import ContentMenu from '
|
|
13
|
-
import storageService from '
|
|
14
|
-
import { LayerOffset, Layout, MenuButton, MenuComponent, Services } from '
|
|
15
|
-
import { COPY_STORAGE_KEY } from '
|
|
12
|
+
import ContentMenu from '@editor/components/ContentMenu.vue';
|
|
13
|
+
import storageService from '@editor/services/storage';
|
|
14
|
+
import { LayerOffset, Layout, MenuButton, MenuComponent, Services } from '@editor/type';
|
|
15
|
+
import { COPY_STORAGE_KEY } from '@editor/utils/editor';
|
|
16
16
|
|
|
17
17
|
const props = withDefaults(
|
|
18
18
|
defineProps<{ isMultiSelect?: boolean; stageContentMenu: (MenuButton | MenuComponent)[] }>(),
|
|
@@ -21,7 +21,7 @@ import KeyController from 'keycon';
|
|
|
21
21
|
|
|
22
22
|
import { isPage } from '@tmagic/utils';
|
|
23
23
|
|
|
24
|
-
import type { MenuButton, MenuComponent, Services } from '
|
|
24
|
+
import type { MenuButton, MenuComponent, Services } from '@editor/type';
|
|
25
25
|
|
|
26
26
|
import Breadcrumb from './Breadcrumb.vue';
|
|
27
27
|
import PageBar from './PageBar.vue';
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import { EventEmitter } from 'events';
|
|
20
20
|
|
|
21
|
-
import { compose } from '
|
|
21
|
+
import { compose } from '@editor/utils/compose';
|
|
22
22
|
|
|
23
23
|
const methodName = (prefix: string, name: string) => `${prefix}${name[0].toUpperCase()}${name.substring(1)}`;
|
|
24
24
|
|
|
@@ -21,9 +21,9 @@ import { keys, pick } from 'lodash-es';
|
|
|
21
21
|
|
|
22
22
|
import { CodeBlockContent, CodeBlockDSL, Id } from '@tmagic/schema';
|
|
23
23
|
|
|
24
|
-
import type { CodeState } from '
|
|
25
|
-
import { CODE_DRAFT_STORAGE_KEY } from '
|
|
26
|
-
import { info } from '
|
|
24
|
+
import type { CodeState } from '@editor/type';
|
|
25
|
+
import { CODE_DRAFT_STORAGE_KEY } from '@editor/type';
|
|
26
|
+
import { info } from '@editor/utils/logger';
|
|
27
27
|
|
|
28
28
|
import BaseService from './BaseService';
|
|
29
29
|
|
package/src/services/editor.ts
CHANGED
|
@@ -24,10 +24,10 @@ import { NodeType } from '@tmagic/schema';
|
|
|
24
24
|
import StageCore from '@tmagic/stage';
|
|
25
25
|
import { getNodePath, isNumber, isPage, isPop } from '@tmagic/utils';
|
|
26
26
|
|
|
27
|
-
import historyService from '
|
|
28
|
-
import storageService, { Protocol } from '
|
|
29
|
-
import type { AddMNode, EditorNodeInfo, PastePosition, StepValue, StoreState, StoreStateKey } from '
|
|
30
|
-
import { LayerOffset, Layout } from '
|
|
27
|
+
import historyService from '@editor/services/history';
|
|
28
|
+
import storageService, { Protocol } from '@editor/services/storage';
|
|
29
|
+
import type { AddMNode, EditorNodeInfo, PastePosition, StepValue, StoreState, StoreStateKey } from '@editor/type';
|
|
30
|
+
import { LayerOffset, Layout } from '@editor/type';
|
|
31
31
|
import {
|
|
32
32
|
change2Fixed,
|
|
33
33
|
COPY_STORAGE_KEY,
|
|
@@ -37,8 +37,8 @@ import {
|
|
|
37
37
|
getNodeIndex,
|
|
38
38
|
isFixed,
|
|
39
39
|
setLayout,
|
|
40
|
-
} from '
|
|
41
|
-
import { beforePaste, getAddParent } from '
|
|
40
|
+
} from '@editor/utils/editor';
|
|
41
|
+
import { beforePaste, getAddParent } from '@editor/utils/operator';
|
|
42
42
|
|
|
43
43
|
import BaseService from './BaseService';
|
|
44
44
|
import propsService from './props';
|
package/src/services/events.ts
CHANGED
|
@@ -22,7 +22,7 @@ import { cloneDeep } from 'lodash-es';
|
|
|
22
22
|
import { DEFAULT_EVENTS, DEFAULT_METHODS, EventOption } from '@tmagic/core';
|
|
23
23
|
import { toLine } from '@tmagic/utils';
|
|
24
24
|
|
|
25
|
-
import type { ComponentGroup } from '
|
|
25
|
+
import type { ComponentGroup } from '@editor/type';
|
|
26
26
|
|
|
27
27
|
import BaseService from './BaseService';
|
|
28
28
|
|
package/src/services/history.ts
CHANGED
|
@@ -20,8 +20,8 @@ import { reactive } from 'vue';
|
|
|
20
20
|
|
|
21
21
|
import type { MPage } from '@tmagic/schema';
|
|
22
22
|
|
|
23
|
-
import { HistoryState, StepValue } from '
|
|
24
|
-
import { UndoRedo } from '
|
|
23
|
+
import type { HistoryState, StepValue } from '@editor/type';
|
|
24
|
+
import { UndoRedo } from '@editor/utils/undo-redo';
|
|
25
25
|
|
|
26
26
|
import BaseService from './BaseService';
|
|
27
27
|
|
package/src/services/props.ts
CHANGED
|
@@ -23,8 +23,8 @@ import type { FormConfig } from '@tmagic/form';
|
|
|
23
23
|
import type { MComponent, MNode } from '@tmagic/schema';
|
|
24
24
|
import { toLine } from '@tmagic/utils';
|
|
25
25
|
|
|
26
|
-
import type { PropsState } from '
|
|
27
|
-
import { fillConfig } from '
|
|
26
|
+
import type { PropsState } from '@editor/type';
|
|
27
|
+
import { fillConfig } from '@editor/utils/props';
|
|
28
28
|
|
|
29
29
|
import BaseService from './BaseService';
|
|
30
30
|
|
package/src/services/ui.ts
CHANGED
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
import { reactive } from 'vue';
|
|
20
20
|
|
|
21
|
-
import editorService from '
|
|
22
|
-
import type { StageRect, UiState } from '
|
|
21
|
+
import editorService from '@editor/services/editor';
|
|
22
|
+
import type { StageRect, UiState } from '@editor/type';
|
|
23
23
|
|
|
24
24
|
import BaseService from './BaseService';
|
|
25
25
|
|
|
@@ -34,22 +34,47 @@
|
|
|
34
34
|
overflow: hidden;
|
|
35
35
|
.list-item {
|
|
36
36
|
display: flex;
|
|
37
|
+
align-items: center;
|
|
37
38
|
width: 100%;
|
|
39
|
+
align-items: center;
|
|
38
40
|
|
|
39
41
|
.right-tool {
|
|
40
42
|
display: flex;
|
|
41
43
|
width: fit-content !important;
|
|
44
|
+
align-items: center;
|
|
45
|
+
margin-right: 10px;
|
|
42
46
|
.edit-icon {
|
|
43
47
|
margin: 0 5px;
|
|
44
48
|
}
|
|
45
49
|
}
|
|
50
|
+
|
|
51
|
+
.codeIcon {
|
|
52
|
+
width: 20px;
|
|
53
|
+
height: 20px;
|
|
54
|
+
margin-right: 5px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.compIcon {
|
|
58
|
+
width: 15px;
|
|
59
|
+
height: 15px;
|
|
60
|
+
margin-right: 5px;
|
|
61
|
+
}
|
|
62
|
+
|
|
46
63
|
.code-name {
|
|
47
64
|
white-space: nowrap;
|
|
48
65
|
overflow: hidden;
|
|
49
66
|
text-overflow: ellipsis;
|
|
50
67
|
width: 0 !important;
|
|
51
68
|
flex: 1;
|
|
52
|
-
line-height:
|
|
69
|
+
line-height: 22px;
|
|
70
|
+
|
|
71
|
+
&.code {
|
|
72
|
+
color: #000;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&.hook {
|
|
76
|
+
color: #909399;
|
|
77
|
+
}
|
|
53
78
|
}
|
|
54
79
|
}
|
|
55
80
|
}
|
|
@@ -57,9 +82,8 @@
|
|
|
57
82
|
|
|
58
83
|
.m-fields-code-select {
|
|
59
84
|
width: 100%;
|
|
60
|
-
.
|
|
61
|
-
|
|
62
|
-
margin-right: 5px;
|
|
85
|
+
.el-card__header {
|
|
86
|
+
display: none;
|
|
63
87
|
}
|
|
64
88
|
}
|
|
65
89
|
|
package/src/theme/event.scss
CHANGED
|
@@ -21,4 +21,16 @@
|
|
|
21
21
|
}
|
|
22
22
|
.m-fields-code-select-col {
|
|
23
23
|
width: 100%;
|
|
24
|
+
.code-select-container {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
.select {
|
|
28
|
+
flex: 10 0 100px;
|
|
29
|
+
}
|
|
30
|
+
.icon {
|
|
31
|
+
flex: 1 0 20px;
|
|
32
|
+
cursor: pointer;
|
|
33
|
+
margin-right: 5px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
24
36
|
}
|
package/src/utils/config.ts
CHANGED
package/src/utils/dep.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { isEmpty } from 'lodash-es';
|
|
|
2
2
|
|
|
3
3
|
import { CodeBlockContent, HookType, Id } from '@tmagic/schema';
|
|
4
4
|
|
|
5
|
-
import { Target } from '
|
|
6
|
-
import { HookData } from '
|
|
5
|
+
import { Target } from '@editor/services/dep';
|
|
6
|
+
import type { HookData } from '@editor/type';
|
|
7
7
|
|
|
8
8
|
export const createCodeBlockTarget = (id: Id, codeBlock: CodeBlockContent) =>
|
|
9
9
|
new Target({
|
package/src/utils/editor.ts
CHANGED
|
@@ -23,7 +23,7 @@ import { NodeType } from '@tmagic/schema';
|
|
|
23
23
|
import type StageCore from '@tmagic/stage';
|
|
24
24
|
import { getNodePath, isNumber, isPage, isPop } from '@tmagic/utils';
|
|
25
25
|
|
|
26
|
-
import { Layout } from '
|
|
26
|
+
import { Layout } from '@editor/type';
|
|
27
27
|
export const COPY_STORAGE_KEY = '$MagicEditorCopyData';
|
|
28
28
|
|
|
29
29
|
/**
|
package/src/utils/operator.ts
CHANGED
|
@@ -4,10 +4,10 @@ import { isEmpty } from 'lodash-es';
|
|
|
4
4
|
import { Id, MContainer, MNode } from '@tmagic/schema';
|
|
5
5
|
import { isPage } from '@tmagic/utils';
|
|
6
6
|
|
|
7
|
-
import editorService from '
|
|
8
|
-
import propsService from '
|
|
9
|
-
import { AddMNode, PastePosition } from '
|
|
10
|
-
import { generatePageNameByApp, getInitPositionStyle } from '
|
|
7
|
+
import editorService from '@editor/services/editor';
|
|
8
|
+
import propsService from '@editor/services/props';
|
|
9
|
+
import type { AddMNode, PastePosition } from '@editor/type';
|
|
10
|
+
import { generatePageNameByApp, getInitPositionStyle } from '@editor/utils/editor';
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* 粘贴前置操作:返回分配了新id以及校准了坐标的配置
|
package/src/utils/stage.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { computed } from 'vue';
|
|
|
2
2
|
|
|
3
3
|
import StageCore, { GuidesType, RemoveEventData, SortEventData, UpdateEventData } from '@tmagic/stage';
|
|
4
4
|
|
|
5
|
-
import editorService from '
|
|
6
|
-
import uiService from '
|
|
7
|
-
import { H_GUIDE_LINE_STORAGE_KEY, StageOptions, V_GUIDE_LINE_STORAGE_KEY } from '
|
|
5
|
+
import editorService from '@editor/services/editor';
|
|
6
|
+
import uiService from '@editor/services/ui';
|
|
7
|
+
import { H_GUIDE_LINE_STORAGE_KEY, StageOptions, V_GUIDE_LINE_STORAGE_KEY } from '@editor/type';
|
|
8
8
|
|
|
9
9
|
import { getGuideLineFromCache } from './editor';
|
|
10
10
|
|
package/tsconfig.build.json
CHANGED
|
@@ -15,7 +15,10 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
15
15
|
}>, {
|
|
16
16
|
editable: boolean;
|
|
17
17
|
autoSaveDraft: boolean;
|
|
18
|
-
}>, {
|
|
18
|
+
}>, {
|
|
19
|
+
saveAndClose: () => void;
|
|
20
|
+
close: () => Promise<void>;
|
|
21
|
+
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("close" | "saveAndClose")[], "close" | "saveAndClose", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
|
|
19
22
|
/** 代码id */
|
|
20
23
|
id: Id;
|
|
21
24
|
/** 代码内容 */
|
|
@@ -39,8 +42,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
39
42
|
autoSaveDraft: boolean;
|
|
40
43
|
}>;
|
|
41
44
|
export default _default;
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
46
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
44
47
|
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
45
48
|
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
46
49
|
} : {
|
|
@@ -48,7 +51,7 @@ declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
|
48
51
|
required: true;
|
|
49
52
|
};
|
|
50
53
|
};
|
|
51
|
-
|
|
54
|
+
type __VLS_WithDefaults<P, D> = {
|
|
52
55
|
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
53
56
|
default: D[K];
|
|
54
57
|
} : P[K];
|
|
@@ -22,8 +22,8 @@ declare const _default: import("vue").DefineComponent<__VLS_WithDefaults<__VLS_T
|
|
|
22
22
|
isSubMenu: boolean;
|
|
23
23
|
}>;
|
|
24
24
|
export default _default;
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
26
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
27
27
|
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
28
28
|
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
29
29
|
} : {
|
|
@@ -31,7 +31,7 @@ declare type __VLS_TypePropsToRuntimeProps<T> = {
|
|
|
31
31
|
required: true;
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
type __VLS_WithDefaults<P, D> = {
|
|
35
35
|
[K in keyof Pick<P, keyof P>]: K extends keyof D ? P[K] & {
|
|
36
36
|
default: D[K];
|
|
37
37
|
} : P[K];
|