@tmagic/editor 1.5.0 → 1.5.2
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 +153 -6
- package/dist/tmagic-editor.js +907 -528
- package/dist/tmagic-editor.umd.cjs +932 -552
- package/package.json +10 -10
- package/src/Editor.vue +18 -5
- package/src/components/CodeBlockEditor.vue +3 -3
- package/src/components/CodeParams.vue +2 -2
- package/src/components/ContentMenu.vue +18 -18
- package/src/components/FloatingBox.vue +3 -3
- package/src/components/Resizer.vue +4 -4
- package/src/components/ScrollBar.vue +3 -3
- package/src/components/ScrollViewer.vue +3 -3
- package/src/components/SplitView.vue +2 -2
- package/src/components/ToolButton.vue +2 -1
- package/src/editorProps.ts +3 -1
- package/src/fields/DataSourceFieldSelect/Index.vue +6 -6
- package/src/fields/DataSourceInput.vue +2 -2
- package/src/fields/DataSourceMethods.vue +2 -2
- package/src/fields/DataSourceMocks.vue +0 -1
- package/src/fields/EventSelect.vue +0 -1
- package/src/fields/KeyValue.vue +2 -2
- package/src/hooks/use-code-block-edit.ts +2 -2
- package/src/hooks/use-getso.ts +7 -7
- package/src/index.ts +2 -1
- package/src/layouts/CodeEditor.vue +2 -2
- package/src/layouts/Framework.vue +5 -8
- package/src/layouts/NavMenu.vue +2 -2
- package/src/layouts/page-bar/PageBar.vue +3 -3
- package/src/layouts/page-bar/PageBarScrollContainer.vue +3 -3
- package/src/layouts/props-panel/FormPanel.vue +123 -0
- package/src/layouts/props-panel/PropsPanel.vue +146 -0
- package/src/layouts/props-panel/use-style-panel.ts +29 -0
- package/src/layouts/sidebar/Sidebar.vue +4 -1
- package/src/layouts/sidebar/code-block/CodeBlockList.vue +12 -1
- package/src/layouts/sidebar/code-block/CodeBlockListPanel.vue +35 -4
- package/src/layouts/sidebar/code-block/useContentMenu.ts +83 -0
- package/src/layouts/sidebar/data-source/DataSourceList.vue +8 -8
- package/src/layouts/sidebar/data-source/DataSourceListPanel.vue +40 -4
- package/src/layouts/sidebar/data-source/useContentMenu.ts +81 -0
- package/src/layouts/sidebar/layer/LayerMenu.vue +7 -13
- package/src/layouts/sidebar/layer/LayerPanel.vue +11 -4
- package/src/layouts/sidebar/layer/use-click.ts +2 -2
- package/src/layouts/sidebar/layer/use-keybinding.ts +2 -2
- package/src/layouts/workspace/Workspace.vue +9 -2
- package/src/layouts/workspace/viewer/NodeListMenu.vue +3 -3
- package/src/layouts/workspace/viewer/Stage.vue +18 -6
- package/src/layouts/workspace/viewer/StageOverlay.vue +2 -2
- package/src/layouts/workspace/viewer/ViewerMenu.vue +4 -6
- package/src/services/storage.ts +2 -1
- package/src/services/ui.ts +1 -0
- package/src/theme/common/var.scss +12 -10
- package/src/theme/component-list-panel.scss +9 -7
- package/src/theme/content-menu.scss +7 -5
- package/src/theme/data-source.scss +3 -1
- package/src/theme/floating-box.scss +4 -2
- package/src/theme/framework.scss +7 -5
- package/src/theme/index.scss +4 -5
- package/src/theme/key-value.scss +2 -2
- package/src/theme/layer-panel.scss +3 -1
- package/src/theme/layout.scss +1 -1
- package/src/theme/nav-menu.scss +7 -5
- package/src/theme/page-bar.scss +17 -15
- package/src/theme/props-panel.scss +81 -1
- package/src/theme/resizer.scss +1 -1
- package/src/theme/sidebar.scss +4 -2
- package/src/theme/stage.scss +3 -1
- package/src/theme/theme.scss +28 -28
- package/src/theme/tree.scss +14 -12
- package/src/type.ts +8 -0
- package/src/utils/content-menu.ts +2 -2
- package/src/utils/props.ts +45 -3
- package/types/index.d.ts +1796 -1230
- package/src/layouts/PropsPanel.vue +0 -131
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
:next-level-indent-increment="nextLevelIndentIncrement"
|
|
36
36
|
@edit="editHandler"
|
|
37
37
|
@remove="removeHandler"
|
|
38
|
+
@node-contextmenu="nodeContentMenuHandler"
|
|
38
39
|
></DataSourceList>
|
|
39
40
|
</TMagicScrollbar>
|
|
40
41
|
|
|
@@ -45,21 +46,40 @@
|
|
|
45
46
|
:title="dialogTitle"
|
|
46
47
|
@submit="submitDataSourceHandler"
|
|
47
48
|
></DataSourceConfigPanel>
|
|
49
|
+
|
|
50
|
+
<Teleport to="body">
|
|
51
|
+
<ContentMenu
|
|
52
|
+
v-if="menuData.length"
|
|
53
|
+
:menu-data="menuData"
|
|
54
|
+
ref="menu"
|
|
55
|
+
style="overflow: initial"
|
|
56
|
+
@hide="contentMenuHideHandler"
|
|
57
|
+
></ContentMenu>
|
|
58
|
+
</Teleport>
|
|
48
59
|
</template>
|
|
49
60
|
|
|
50
61
|
<script setup lang="ts">
|
|
51
62
|
import { computed, inject, ref } from 'vue';
|
|
52
63
|
import { mergeWith } from 'lodash-es';
|
|
53
64
|
|
|
54
|
-
import { TMagicButton, TMagicPopover, TMagicScrollbar } from '@tmagic/design';
|
|
65
|
+
import { TMagicButton, tMagicMessageBox, TMagicPopover, TMagicScrollbar } from '@tmagic/design';
|
|
55
66
|
|
|
67
|
+
import ContentMenu from '@editor/components/ContentMenu.vue';
|
|
56
68
|
import SearchInput from '@editor/components/SearchInput.vue';
|
|
57
69
|
import ToolButton from '@editor/components/ToolButton.vue';
|
|
58
70
|
import { useDataSourceEdit } from '@editor/hooks/use-data-source-edit';
|
|
59
|
-
import type {
|
|
71
|
+
import type {
|
|
72
|
+
CustomContentMenuFunction,
|
|
73
|
+
DataSourceListSlots,
|
|
74
|
+
EventBus,
|
|
75
|
+
MenuButton,
|
|
76
|
+
MenuComponent,
|
|
77
|
+
Services,
|
|
78
|
+
} from '@editor/type';
|
|
60
79
|
|
|
61
80
|
import DataSourceConfigPanel from './DataSourceConfigPanel.vue';
|
|
62
81
|
import DataSourceList from './DataSourceList.vue';
|
|
82
|
+
import { useContentMenu } from './useContentMenu';
|
|
63
83
|
|
|
64
84
|
defineSlots<DataSourceListSlots>();
|
|
65
85
|
|
|
@@ -67,9 +87,10 @@ defineOptions({
|
|
|
67
87
|
name: 'MEditorDataSourceListPanel',
|
|
68
88
|
});
|
|
69
89
|
|
|
70
|
-
defineProps<{
|
|
90
|
+
const props = defineProps<{
|
|
71
91
|
indent?: number;
|
|
72
92
|
nextLevelIndentIncrement?: number;
|
|
93
|
+
customContentMenu: CustomContentMenuFunction;
|
|
73
94
|
}>();
|
|
74
95
|
|
|
75
96
|
const eventBus = inject<EventBus>('eventBus');
|
|
@@ -105,7 +126,13 @@ const addHandler = (type: string) => {
|
|
|
105
126
|
editDialog.value.show();
|
|
106
127
|
};
|
|
107
128
|
|
|
108
|
-
const removeHandler = (id: string) => {
|
|
129
|
+
const removeHandler = async (id: string) => {
|
|
130
|
+
await tMagicMessageBox.confirm('确定删除?', '提示', {
|
|
131
|
+
confirmButtonText: '确定',
|
|
132
|
+
cancelButtonText: '取消',
|
|
133
|
+
type: 'warning',
|
|
134
|
+
});
|
|
135
|
+
|
|
109
136
|
dataSourceService?.remove(id);
|
|
110
137
|
};
|
|
111
138
|
|
|
@@ -118,4 +145,13 @@ const filterTextChangeHandler = (val: string) => {
|
|
|
118
145
|
eventBus?.on('edit-data-source', (id: string) => {
|
|
119
146
|
editHandler(id);
|
|
120
147
|
});
|
|
148
|
+
|
|
149
|
+
eventBus?.on('remove-data-source', (id: string) => {
|
|
150
|
+
removeHandler(id);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
const { nodeContentMenuHandler, menuData: contentMenuData, contentMenuHideHandler } = useContentMenu();
|
|
154
|
+
const menuData = computed<(MenuButton | MenuComponent)[]>(() =>
|
|
155
|
+
props.customContentMenu(contentMenuData, 'data-source'),
|
|
156
|
+
);
|
|
121
157
|
</script>
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { inject, markRaw, useTemplateRef } from 'vue';
|
|
2
|
+
import { CopyDocument, Delete, Edit } from '@element-plus/icons-vue';
|
|
3
|
+
import { cloneDeep } from 'lodash-es';
|
|
4
|
+
|
|
5
|
+
import ContentMenu from '@editor/components/ContentMenu.vue';
|
|
6
|
+
import type { EventBus, MenuButton, MenuComponent, Services, TreeNodeData } from '@editor/type';
|
|
7
|
+
|
|
8
|
+
export const useContentMenu = () => {
|
|
9
|
+
const eventBus = inject<EventBus>('eventBus');
|
|
10
|
+
const menuRef = useTemplateRef<InstanceType<typeof ContentMenu>>('menu');
|
|
11
|
+
|
|
12
|
+
let selectId = '';
|
|
13
|
+
|
|
14
|
+
const menuData: (MenuButton | MenuComponent)[] = [
|
|
15
|
+
{
|
|
16
|
+
type: 'button',
|
|
17
|
+
text: '编辑',
|
|
18
|
+
icon: Edit,
|
|
19
|
+
display: (services) => services?.dataSourceService?.get('editable') ?? true,
|
|
20
|
+
handler: () => {
|
|
21
|
+
if (!selectId) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
eventBus?.emit('edit-data-source', selectId);
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
type: 'button',
|
|
30
|
+
text: '复制并粘贴至当前',
|
|
31
|
+
icon: markRaw(CopyDocument),
|
|
32
|
+
handler: ({ dataSourceService }: Services) => {
|
|
33
|
+
if (!selectId) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const ds = dataSourceService.getDataSourceById(selectId);
|
|
38
|
+
if (!ds) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
dataSourceService.add(cloneDeep(ds));
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
type: 'button',
|
|
47
|
+
text: '删除',
|
|
48
|
+
icon: Delete,
|
|
49
|
+
handler: () => {
|
|
50
|
+
if (!selectId) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
eventBus?.emit('remove-data-source', selectId);
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
const nodeContentMenuHandler = (event: MouseEvent, data: TreeNodeData) => {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
|
|
62
|
+
if (data.type === 'ds') {
|
|
63
|
+
menuRef.value?.show(event);
|
|
64
|
+
if (data.id) {
|
|
65
|
+
selectId = `${data.id}`;
|
|
66
|
+
} else {
|
|
67
|
+
selectId = '';
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const contentMenuHideHandler = () => {
|
|
73
|
+
selectId = '';
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
menuData,
|
|
78
|
+
nodeContentMenuHandler,
|
|
79
|
+
contentMenuHideHandler,
|
|
80
|
+
};
|
|
81
|
+
};
|
|
@@ -3,37 +3,31 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script lang="ts" setup>
|
|
6
|
-
import { computed, inject, markRaw,
|
|
6
|
+
import { computed, inject, markRaw, useTemplateRef } from 'vue';
|
|
7
7
|
import { Files, Plus } from '@element-plus/icons-vue';
|
|
8
8
|
|
|
9
9
|
import { isPage, isPageFragment } from '@tmagic/utils';
|
|
10
10
|
|
|
11
11
|
import ContentMenu from '@editor/components/ContentMenu.vue';
|
|
12
12
|
import FolderMinusIcon from '@editor/icons/FolderMinusIcon.vue';
|
|
13
|
-
import type { ComponentGroup, MenuButton, MenuComponent, Services } from '@editor/type';
|
|
13
|
+
import type { ComponentGroup, CustomContentMenuFunction, MenuButton, MenuComponent, Services } from '@editor/type';
|
|
14
14
|
import { useCopyMenu, useDeleteMenu, useMoveToMenu, usePasteMenu } from '@editor/utils/content-menu';
|
|
15
15
|
|
|
16
16
|
defineOptions({
|
|
17
17
|
name: 'MEditorLayerMenu',
|
|
18
18
|
});
|
|
19
19
|
|
|
20
|
-
const props =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}>(),
|
|
25
|
-
{
|
|
26
|
-
layerContentMenu: () => [],
|
|
27
|
-
customContentMenu: (menus: (MenuButton | MenuComponent)[]) => menus,
|
|
28
|
-
},
|
|
29
|
-
);
|
|
20
|
+
const props = defineProps<{
|
|
21
|
+
layerContentMenu: (MenuButton | MenuComponent)[];
|
|
22
|
+
customContentMenu: CustomContentMenuFunction;
|
|
23
|
+
}>();
|
|
30
24
|
|
|
31
25
|
const emit = defineEmits<{
|
|
32
26
|
'collapse-all': [];
|
|
33
27
|
}>();
|
|
34
28
|
|
|
35
29
|
const services = inject<Services>('services');
|
|
36
|
-
const menu =
|
|
30
|
+
const menu = useTemplateRef<InstanceType<typeof ContentMenu>>('menu');
|
|
37
31
|
const node = computed(() => services?.editorService.get('node'));
|
|
38
32
|
const nodes = computed(() => services?.editorService.get('nodes'));
|
|
39
33
|
const componentList = computed(() => services?.componentListService.getList() || []);
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
</template>
|
|
48
48
|
|
|
49
49
|
<script setup lang="ts">
|
|
50
|
-
import { computed, inject,
|
|
50
|
+
import { computed, inject, useTemplateRef } from 'vue';
|
|
51
51
|
|
|
52
52
|
import type { MNode } from '@tmagic/core';
|
|
53
53
|
import { TMagicScrollbar } from '@tmagic/design';
|
|
@@ -55,7 +55,14 @@ import { TMagicScrollbar } from '@tmagic/design';
|
|
|
55
55
|
import SearchInput from '@editor/components/SearchInput.vue';
|
|
56
56
|
import Tree from '@editor/components/Tree.vue';
|
|
57
57
|
import { useFilter } from '@editor/hooks/use-filter';
|
|
58
|
-
import type {
|
|
58
|
+
import type {
|
|
59
|
+
CustomContentMenuFunction,
|
|
60
|
+
LayerPanelSlots,
|
|
61
|
+
MenuButton,
|
|
62
|
+
MenuComponent,
|
|
63
|
+
Services,
|
|
64
|
+
TreeNodeData,
|
|
65
|
+
} from '@editor/type';
|
|
59
66
|
|
|
60
67
|
import LayerMenu from './LayerMenu.vue';
|
|
61
68
|
import LayerNodeTool from './LayerNodeTool.vue';
|
|
@@ -74,13 +81,13 @@ defineProps<{
|
|
|
74
81
|
layerContentMenu: (MenuButton | MenuComponent)[];
|
|
75
82
|
indent?: number;
|
|
76
83
|
nextLevelIndentIncrement?: number;
|
|
77
|
-
customContentMenu
|
|
84
|
+
customContentMenu: CustomContentMenuFunction;
|
|
78
85
|
}>();
|
|
79
86
|
|
|
80
87
|
const services = inject<Services>('services');
|
|
81
88
|
const editorService = services?.editorService;
|
|
82
89
|
|
|
83
|
-
const tree =
|
|
90
|
+
const tree = useTemplateRef<InstanceType<typeof Tree>>('tree');
|
|
84
91
|
|
|
85
92
|
const page = computed(() => editorService?.get('page'));
|
|
86
93
|
const nodeData = computed<TreeNodeData[]>(() => (!page.value ? [] : [page.value]));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, type ComputedRef, nextTick, type Ref,
|
|
1
|
+
import { computed, type ComputedRef, nextTick, type Ref, useTemplateRef } from 'vue';
|
|
2
2
|
import { throttle } from 'lodash-es';
|
|
3
3
|
|
|
4
4
|
import { Id, MNode } from '@tmagic/core';
|
|
@@ -99,7 +99,7 @@ export const useClick = (
|
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
// 右键菜单
|
|
102
|
-
const menu =
|
|
102
|
+
const menu = useTemplateRef<InstanceType<typeof LayerMenu>>('menu');
|
|
103
103
|
|
|
104
104
|
return {
|
|
105
105
|
menu,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { ref, type ShallowRef, watchEffect } from 'vue';
|
|
2
2
|
|
|
3
3
|
import Tree from '@editor/components/Tree.vue';
|
|
4
4
|
import type { Services } from '@editor/type';
|
|
@@ -6,7 +6,7 @@ import { KeyBindingContainerKey } from '@editor/utils/keybinding-config';
|
|
|
6
6
|
|
|
7
7
|
export const useKeybinding = (
|
|
8
8
|
services: Services | undefined,
|
|
9
|
-
container:
|
|
9
|
+
container: ShallowRef<InstanceType<typeof Tree> | null>,
|
|
10
10
|
) => {
|
|
11
11
|
const keybindingService = services?.keybindingService;
|
|
12
12
|
|
|
@@ -19,7 +19,14 @@
|
|
|
19
19
|
<script lang="ts" setup>
|
|
20
20
|
import { computed, inject } from 'vue';
|
|
21
21
|
|
|
22
|
-
import type {
|
|
22
|
+
import type {
|
|
23
|
+
CustomContentMenuFunction,
|
|
24
|
+
MenuButton,
|
|
25
|
+
MenuComponent,
|
|
26
|
+
Services,
|
|
27
|
+
StageOptions,
|
|
28
|
+
WorkspaceSlots,
|
|
29
|
+
} from '@editor/type';
|
|
23
30
|
|
|
24
31
|
import MagicStage from './viewer/Stage.vue';
|
|
25
32
|
import Breadcrumb from './Breadcrumb.vue';
|
|
@@ -34,7 +41,7 @@ withDefaults(
|
|
|
34
41
|
defineProps<{
|
|
35
42
|
stageContentMenu: (MenuButton | MenuComponent)[];
|
|
36
43
|
disabledStageOverlay?: boolean;
|
|
37
|
-
customContentMenu
|
|
44
|
+
customContentMenu: CustomContentMenuFunction;
|
|
38
45
|
}>(),
|
|
39
46
|
{
|
|
40
47
|
disabledStageOverlay: false,
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
</template>
|
|
23
23
|
|
|
24
24
|
<script lang="ts" setup>
|
|
25
|
-
import { computed, inject, nextTick, ref, watch } from 'vue';
|
|
25
|
+
import { computed, inject, nextTick, ref, useTemplateRef, watch } from 'vue';
|
|
26
26
|
|
|
27
27
|
import type { MNode } from '@tmagic/core';
|
|
28
28
|
import { TMagicTooltip } from '@tmagic/design';
|
|
@@ -39,8 +39,8 @@ const editorService = services?.editorService;
|
|
|
39
39
|
|
|
40
40
|
const visible = ref(false);
|
|
41
41
|
const buttonVisible = ref(false);
|
|
42
|
-
const button =
|
|
43
|
-
const box =
|
|
42
|
+
const button = useTemplateRef<HTMLDivElement>('button');
|
|
43
|
+
const box = useTemplateRef<InstanceType<typeof FloatingBox>>('box');
|
|
44
44
|
|
|
45
45
|
const stage = computed(() => editorService?.get('stage'));
|
|
46
46
|
const page = computed(() => editorService?.get('page'));
|
|
@@ -43,7 +43,18 @@
|
|
|
43
43
|
</template>
|
|
44
44
|
|
|
45
45
|
<script lang="ts" setup>
|
|
46
|
-
import {
|
|
46
|
+
import {
|
|
47
|
+
computed,
|
|
48
|
+
inject,
|
|
49
|
+
markRaw,
|
|
50
|
+
nextTick,
|
|
51
|
+
onBeforeUnmount,
|
|
52
|
+
onMounted,
|
|
53
|
+
toRaw,
|
|
54
|
+
useTemplateRef,
|
|
55
|
+
watch,
|
|
56
|
+
watchEffect,
|
|
57
|
+
} from 'vue';
|
|
47
58
|
import { cloneDeep } from 'lodash-es';
|
|
48
59
|
|
|
49
60
|
import type { MApp, MContainer } from '@tmagic/core';
|
|
@@ -52,7 +63,8 @@ import { calcValueByFontsize, getIdFromEl } from '@tmagic/utils';
|
|
|
52
63
|
|
|
53
64
|
import ScrollViewer from '@editor/components/ScrollViewer.vue';
|
|
54
65
|
import { useStage } from '@editor/hooks/use-stage';
|
|
55
|
-
import {
|
|
66
|
+
import type { CustomContentMenuFunction, MenuButton, MenuComponent, Services, StageOptions } from '@editor/type';
|
|
67
|
+
import { DragType, Layout } from '@editor/type';
|
|
56
68
|
import { getEditorConfig } from '@editor/utils/config';
|
|
57
69
|
import { KeyBindingContainerKey } from '@editor/utils/keybinding-config';
|
|
58
70
|
|
|
@@ -69,7 +81,7 @@ const props = withDefaults(
|
|
|
69
81
|
stageOptions: StageOptions;
|
|
70
82
|
stageContentMenu: (MenuButton | MenuComponent)[];
|
|
71
83
|
disabledStageOverlay?: boolean;
|
|
72
|
-
customContentMenu
|
|
84
|
+
customContentMenu: CustomContentMenuFunction;
|
|
73
85
|
}>(),
|
|
74
86
|
{
|
|
75
87
|
disabledStageOverlay: false,
|
|
@@ -83,9 +95,9 @@ const services = inject<Services>('services');
|
|
|
83
95
|
|
|
84
96
|
const stageLoading = computed(() => services?.editorService.get('stageLoading') || false);
|
|
85
97
|
|
|
86
|
-
const stageWrap =
|
|
87
|
-
const stageContainer =
|
|
88
|
-
const menu =
|
|
98
|
+
const stageWrap = useTemplateRef<InstanceType<typeof ScrollViewer>>('stageWrap');
|
|
99
|
+
const stageContainer = useTemplateRef<HTMLDivElement>('stageContainer');
|
|
100
|
+
const menu = useTemplateRef<InstanceType<typeof ViewerMenu>>('menu');
|
|
89
101
|
|
|
90
102
|
const nodes = computed(() => services?.editorService.get('nodes') || []);
|
|
91
103
|
const isMultiSelect = computed(() => nodes.value.length > 1);
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script setup lang="ts">
|
|
11
|
-
import { computed, inject, onBeforeUnmount,
|
|
11
|
+
import { computed, inject, onBeforeUnmount, useTemplateRef, watch } from 'vue';
|
|
12
12
|
import { CloseBold } from '@element-plus/icons-vue';
|
|
13
13
|
|
|
14
14
|
import { TMagicIcon } from '@tmagic/design';
|
|
@@ -19,7 +19,7 @@ const services = inject<Services>('services');
|
|
|
19
19
|
|
|
20
20
|
const stageOptions = inject<StageOptions>('stageOptions');
|
|
21
21
|
|
|
22
|
-
const stageOverlay =
|
|
22
|
+
const stageOverlay = useTemplateRef<HTMLDivElement>('stageOverlay');
|
|
23
23
|
|
|
24
24
|
const stageOverlayVisible = computed(() => services?.stageOverlayService.get('stageOverlayVisible'));
|
|
25
25
|
const wrapWidth = computed(() => services?.stageOverlayService.get('wrapWidth') || 0);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
</template>
|
|
4
4
|
|
|
5
5
|
<script lang="ts" setup>
|
|
6
|
-
import { computed, inject, markRaw, ref, watch } from 'vue';
|
|
6
|
+
import { computed, inject, markRaw, ref, useTemplateRef, watch } from 'vue';
|
|
7
7
|
import { Bottom, Top } from '@element-plus/icons-vue';
|
|
8
8
|
|
|
9
9
|
import { NodeType } from '@tmagic/core';
|
|
@@ -11,7 +11,7 @@ import { isPage, isPageFragment } from '@tmagic/utils';
|
|
|
11
11
|
|
|
12
12
|
import ContentMenu from '@editor/components/ContentMenu.vue';
|
|
13
13
|
import CenterIcon from '@editor/icons/CenterIcon.vue';
|
|
14
|
-
import { LayerOffset, Layout, MenuButton, MenuComponent, Services } from '@editor/type';
|
|
14
|
+
import { CustomContentMenuFunction, LayerOffset, Layout, MenuButton, MenuComponent, Services } from '@editor/type';
|
|
15
15
|
import { useCopyMenu, useDeleteMenu, useMoveToMenu, usePasteMenu } from '@editor/utils/content-menu';
|
|
16
16
|
|
|
17
17
|
defineOptions({
|
|
@@ -22,18 +22,16 @@ const props = withDefaults(
|
|
|
22
22
|
defineProps<{
|
|
23
23
|
isMultiSelect?: boolean;
|
|
24
24
|
stageContentMenu: (MenuButton | MenuComponent)[];
|
|
25
|
-
customContentMenu
|
|
25
|
+
customContentMenu: CustomContentMenuFunction;
|
|
26
26
|
}>(),
|
|
27
27
|
{
|
|
28
28
|
isMultiSelect: false,
|
|
29
|
-
stageContentMenu: () => [],
|
|
30
|
-
customContentMenu: (menus: (MenuButton | MenuComponent)[]) => menus,
|
|
31
29
|
},
|
|
32
30
|
);
|
|
33
31
|
|
|
34
32
|
const services = inject<Services>('services');
|
|
35
33
|
const editorService = services?.editorService;
|
|
36
|
-
const menu =
|
|
34
|
+
const menu = useTemplateRef<InstanceType<typeof ContentMenu>>('menu');
|
|
37
35
|
const canCenter = ref(false);
|
|
38
36
|
|
|
39
37
|
const node = computed(() => editorService?.get('node'));
|
package/src/services/storage.ts
CHANGED
package/src/services/ui.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
$theme-color: #2882e0;
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
$font-color: #313a40;
|
|
4
|
+
$border-color: #d9dbdd;
|
|
5
|
+
$hover-color: #f3f5f9;
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
$nav-height: 35px;
|
|
8
|
+
$nav-color: #313a40;
|
|
9
|
+
$nav--background-color: #ffffff;
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
$sidebar-heder-background-color: $theme-color;
|
|
12
|
+
$sidebar-content-background-color: #ffffff;
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
$page-bar-height: 32px;
|
|
15
|
+
|
|
16
|
+
$props-style-panel-width: 300px;
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
@use "common/var" as *;
|
|
2
|
+
|
|
1
3
|
.ui-component-panel {
|
|
2
4
|
&.tmagic-design-collapse {
|
|
3
5
|
border-top: 0 !important;
|
|
4
6
|
margin-top: 48px;
|
|
5
|
-
background-color:
|
|
7
|
+
background-color: $sidebar-content-background-color;
|
|
6
8
|
|
|
7
9
|
.tmagic-design-collapse-item {
|
|
8
10
|
> div:first-of-type {
|
|
9
|
-
border-bottom: 1px solid
|
|
11
|
+
border-bottom: 1px solid $border-color;
|
|
10
12
|
margin-bottom: 10px;
|
|
11
13
|
}
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
.el-collapse-item__header,
|
|
15
17
|
.t-collapse-panel__header {
|
|
16
|
-
background:
|
|
17
|
-
color:
|
|
18
|
+
background: $sidebar-content-background-color;
|
|
19
|
+
color: $font-color;
|
|
18
20
|
height: 25px;
|
|
19
21
|
line-height: 25px;
|
|
20
22
|
padding-left: 10px;
|
|
@@ -28,7 +30,7 @@
|
|
|
28
30
|
|
|
29
31
|
.el-collapse-item__wrap,
|
|
30
32
|
.t-collapse-panel__body {
|
|
31
|
-
background:
|
|
33
|
+
background: $sidebar-content-background-color;
|
|
32
34
|
border-bottom: 0;
|
|
33
35
|
|
|
34
36
|
.el-collapse-item__content,
|
|
@@ -44,7 +46,7 @@
|
|
|
44
46
|
text-overflow: ellipsis;
|
|
45
47
|
margin: 5px 10px;
|
|
46
48
|
box-sizing: border-box;
|
|
47
|
-
color:
|
|
49
|
+
color: $font-color;
|
|
48
50
|
flex-direction: column;
|
|
49
51
|
width: 42px;
|
|
50
52
|
cursor: pointer;
|
|
@@ -57,7 +59,7 @@
|
|
|
57
59
|
line-height: 40px;
|
|
58
60
|
border-radius: 5px;
|
|
59
61
|
color: #909090;
|
|
60
|
-
border: 1px solid
|
|
62
|
+
border: 1px solid $border-color;
|
|
61
63
|
display: flex;
|
|
62
64
|
justify-content: space-evenly;
|
|
63
65
|
align-items: center;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use "common/var" as *;
|
|
2
|
+
|
|
1
3
|
.magic-editor-content-menu {
|
|
2
4
|
position: fixed;
|
|
3
5
|
font-size: 12px;
|
|
@@ -29,7 +31,7 @@
|
|
|
29
31
|
|
|
30
32
|
.el-button--text,
|
|
31
33
|
i {
|
|
32
|
-
color:
|
|
34
|
+
color: $font-color;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
.magic-editor-icon {
|
|
@@ -46,20 +48,20 @@
|
|
|
46
48
|
|
|
47
49
|
&.button {
|
|
48
50
|
&:hover {
|
|
49
|
-
background-color:
|
|
51
|
+
background-color: $hover-color;
|
|
50
52
|
.tmagic-design-button,
|
|
51
53
|
.tmagic-design-button:active,
|
|
52
54
|
.tmagic-design-button:focus {
|
|
53
|
-
color:
|
|
55
|
+
color: $font-color;
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
&.menu-item i {
|
|
57
|
-
color:
|
|
59
|
+
color: $font-color;
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
&.active {
|
|
62
|
-
background-color:
|
|
64
|
+
background-color: $theme-color;
|
|
63
65
|
.tmagic-design-button,
|
|
64
66
|
.tmagic-design-button:active,
|
|
65
67
|
.tmagic-design-button:focus {
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
@use "common/var" as *;
|
|
2
|
+
|
|
1
3
|
.m-editor-float-box {
|
|
2
4
|
position: absolute;
|
|
3
5
|
background-color: #fff;
|
|
4
6
|
z-index: 100;
|
|
5
|
-
border: 1px solid
|
|
7
|
+
border: 1px solid $border-color;
|
|
6
8
|
display: flex;
|
|
7
9
|
flex-direction: column;
|
|
8
10
|
max-height: 100%;
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
display: flex;
|
|
18
20
|
justify-content: space-between;
|
|
19
21
|
align-items: center;
|
|
20
|
-
border-bottom: 1px solid
|
|
22
|
+
border-bottom: 1px solid $border-color;
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
.m-editor-float-box-body {
|
package/src/theme/framework.scss
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
@use "common/var" as *;
|
|
2
|
+
|
|
1
3
|
.m-editor {
|
|
2
4
|
display: flex;
|
|
3
5
|
flex-direction: column;
|
|
4
6
|
width: 100%;
|
|
5
7
|
|
|
6
8
|
&-content {
|
|
7
|
-
height: calc(100% - #{
|
|
9
|
+
height: calc(100% - #{$nav-height});
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
&-framework-center {
|
|
@@ -14,7 +16,7 @@
|
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
&-framework-left {
|
|
17
|
-
background-color:
|
|
19
|
+
background-color: $sidebar-content-background-color;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
&-framework-center .el-scrollbar__view {
|
|
@@ -32,7 +34,7 @@
|
|
|
32
34
|
justify-content: center;
|
|
33
35
|
align-items: center;
|
|
34
36
|
flex-direction: column;
|
|
35
|
-
height: calc(100% - #{
|
|
37
|
+
height: calc(100% - #{$page-bar-height});
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
&-content {
|
|
@@ -61,8 +63,8 @@
|
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
&:hover {
|
|
64
|
-
border-color:
|
|
65
|
-
color:
|
|
66
|
+
border-color: $theme-color;
|
|
67
|
+
color: $theme-color;
|
|
66
68
|
}
|
|
67
69
|
}
|
|
68
70
|
}
|