@tmagic/editor 1.0.6 → 1.1.0-beta.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/style.css +5 -1
- package/dist/{tmagic-editor.es.js → tmagic-editor.mjs} +1522 -1177
- package/dist/tmagic-editor.mjs.map +1 -0
- package/dist/tmagic-editor.umd.js +1606 -1259
- package/dist/tmagic-editor.umd.js.map +1 -1
- package/package.json +22 -20
- package/src/Editor.vue +41 -15
- package/src/components/ContentMenu.vue +87 -99
- package/src/components/Icon.vue +2 -2
- package/src/components/ScrollViewer.vue +2 -2
- package/src/components/ToolButton.vue +151 -168
- package/src/fields/UISelect.vue +49 -70
- package/src/index.ts +2 -1
- package/src/layouts/AddPageBox.vue +3 -3
- package/src/layouts/Framework.vue +1 -1
- package/src/layouts/NavMenu.vue +2 -2
- package/src/layouts/PropsPanel.vue +1 -1
- package/src/layouts/Resizer.vue +1 -1
- package/src/layouts/sidebar/ComponentListPanel.vue +43 -2
- package/src/layouts/sidebar/LayerMenu.vue +3 -3
- package/src/layouts/sidebar/LayerPanel.vue +13 -4
- package/src/layouts/sidebar/Sidebar.vue +1 -1
- package/src/layouts/sidebar/TabPane.vue +3 -3
- package/src/layouts/workspace/PageBar.vue +63 -192
- package/src/layouts/workspace/PageBarScrollContainer.vue +111 -0
- package/src/layouts/workspace/Stage.vue +208 -188
- package/src/layouts/workspace/ViewerMenu.vue +141 -148
- package/src/layouts/workspace/Workspace.vue +11 -11
- package/src/services/BaseService.ts +5 -10
- package/src/services/componentList.ts +3 -3
- package/src/services/editor.ts +247 -140
- package/src/services/events.ts +1 -1
- package/src/services/history.ts +1 -1
- package/src/services/props.ts +63 -11
- package/src/services/storage.ts +133 -0
- package/src/services/ui.ts +10 -4
- package/src/theme/component-list-panel.scss +5 -0
- package/src/theme/framework.scss +1 -1
- package/src/theme/stage.scss +2 -2
- package/src/type.ts +28 -7
- package/src/utils/config.ts +1 -1
- package/src/utils/editor.ts +53 -35
- package/src/utils/operator.ts +109 -0
- package/src/utils/props.ts +2 -24
- package/src/utils/scroll-viewer.ts +1 -1
- package/tsconfig.build.json +13 -0
- package/{dist/types/src → types}/Editor.vue.d.ts +44 -9
- package/types/components/ContentMenu.vue.d.ts +116 -0
- package/types/components/Icon.vue.d.ts +13 -0
- package/types/components/ScrollViewer.vue.d.ts +22 -0
- package/types/components/ToolButton.vue.d.ts +109 -0
- package/types/fields/Code.vue.d.ts +23 -0
- package/{dist/types/src → types}/fields/CodeLink.vue.d.ts +4 -6
- package/types/fields/UISelect.vue.d.ts +83 -0
- package/{dist/types/src → types}/index.d.ts +4 -1
- package/types/layouts/AddPageBox.vue.d.ts +4 -0
- package/{dist/types/src → types}/layouts/CodeEditor.vue.d.ts +11 -13
- package/types/layouts/Framework.vue.d.ts +22 -0
- package/types/layouts/NavMenu.vue.d.ts +25 -0
- package/types/layouts/PropsPanel.vue.d.ts +245 -0
- package/types/layouts/Resizer.vue.d.ts +12 -0
- package/types/layouts/sidebar/ComponentListPanel.vue.d.ts +14 -0
- package/types/layouts/sidebar/LayerMenu.vue.d.ts +100 -0
- package/types/layouts/sidebar/LayerPanel.vue.d.ts +1099 -0
- package/{dist/types/src → types}/layouts/sidebar/Sidebar.vue.d.ts +3 -5
- package/types/layouts/sidebar/TabPane.vue.d.ts +14 -0
- package/types/layouts/workspace/PageBar.vue.d.ts +54 -0
- package/types/layouts/workspace/PageBarScrollContainer.vue.d.ts +48 -0
- package/types/layouts/workspace/Stage.vue.d.ts +46 -0
- package/types/layouts/workspace/ViewerMenu.vue.d.ts +88 -0
- package/types/layouts/workspace/Workspace.vue.d.ts +6 -0
- package/{dist/types/src → types}/services/BaseService.d.ts +0 -0
- package/types/services/componentList.d.ts +14 -0
- package/{dist/types/src → types}/services/editor.d.ts +27 -14
- package/{dist/types/src → types}/services/events.d.ts +0 -0
- package/{dist/types/src → types}/services/history.d.ts +0 -0
- package/{dist/types/src → types}/services/props.d.ts +26 -2
- package/types/services/storage.d.ts +56 -0
- package/{dist/types/src → types}/services/ui.d.ts +1 -1
- package/{dist/types/src → types}/type.d.ts +21 -1
- package/{dist/types/src → types}/utils/compose.d.ts +1 -1
- package/{dist/types/src → types}/utils/config.d.ts +0 -0
- package/{dist/types/src → types}/utils/editor.d.ts +11 -4
- package/{dist/types/src → types}/utils/index.d.ts +0 -0
- package/{dist/types/src → types}/utils/logger.d.ts +0 -0
- package/types/utils/operator.d.ts +21 -0
- package/{dist/types/src → types}/utils/polyfills.d.ts +0 -0
- package/{dist/types/src → types}/utils/props.d.ts +2 -22
- package/{dist/types/src → types}/utils/scroll-viewer.d.ts +0 -0
- package/{dist/types/src → types}/utils/undo-redo.d.ts +0 -0
- package/dist/tmagic-editor.es.js.map +0 -1
- package/dist/types/src/components/Icon.vue.d.ts +0 -14
- package/dist/types/src/components/ScrollViewer.vue.d.ts +0 -24
- package/dist/types/src/fields/Code.vue.d.ts +0 -25
- package/dist/types/src/layouts/AddPageBox.vue.d.ts +0 -5
- package/dist/types/src/layouts/Framework.vue.d.ts +0 -24
- package/dist/types/src/layouts/NavMenu.vue.d.ts +0 -27
- package/dist/types/src/layouts/PropsPanel.vue.d.ts +0 -13
- package/dist/types/src/layouts/Resizer.vue.d.ts +0 -14
- package/dist/types/src/layouts/sidebar/ComponentListPanel.vue.d.ts +0 -14
- package/dist/types/src/layouts/sidebar/TabPane.vue.d.ts +0 -16
- package/dist/types/src/layouts/workspace/Workspace.vue.d.ts +0 -8
- package/dist/types/src/shims-vue.d.ts +0 -6
- package/dist/types/src/vite-env.d.ts +0 -1
- package/src/vite-env.d.ts +0 -1
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
|
|
28
28
|
<script lang="ts">
|
|
29
29
|
import { computed, defineComponent, PropType } from 'vue';
|
|
30
|
-
import { Coin, Files } from '@element-plus/icons';
|
|
30
|
+
import { Coin, Files } from '@element-plus/icons-vue';
|
|
31
31
|
|
|
32
|
-
import MIcon from '
|
|
33
|
-
import { SideComponent, SideItem } from '
|
|
32
|
+
import MIcon from '../../components/Icon.vue';
|
|
33
|
+
import { SideComponent, SideItem } from '../../type';
|
|
34
34
|
|
|
35
35
|
import ComponentListPanel from './ComponentListPanel.vue';
|
|
36
36
|
import LayerPanel from './LayerPanel.vue';
|
|
@@ -1,211 +1,82 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
<div
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<div
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
>
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
<PageBarScrollContainer>
|
|
3
|
+
<div
|
|
4
|
+
v-for="item in (root && root.items) || []"
|
|
5
|
+
class="m-editor-page-bar-item"
|
|
6
|
+
:key="item.key"
|
|
7
|
+
:class="{ active: page?.id === item.id }"
|
|
8
|
+
@click="switchPage(item)"
|
|
9
|
+
>
|
|
10
|
+
<div class="m-editor-page-bar-title">
|
|
11
|
+
<slot name="page-bar-title" :page="item">
|
|
12
|
+
<el-tooltip effect="dark" placement="top-start" :content="item.name">
|
|
13
|
+
<span>{{ item.name }}</span>
|
|
14
|
+
</el-tooltip>
|
|
15
|
+
</slot>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<el-popover popper-class="page-bar-popover" placement="top" :width="160" trigger="hover">
|
|
19
|
+
<div>
|
|
20
|
+
<slot name="page-bar-popover" :page="item">
|
|
21
|
+
<tool-button
|
|
22
|
+
:data="{
|
|
23
|
+
type: 'button',
|
|
24
|
+
text: '复制',
|
|
25
|
+
icon: DocumentCopy,
|
|
26
|
+
handler: () => copy(item),
|
|
27
|
+
}"
|
|
28
|
+
></tool-button>
|
|
29
|
+
<tool-button
|
|
30
|
+
:data="{
|
|
31
|
+
type: 'button',
|
|
32
|
+
text: '删除',
|
|
33
|
+
icon: Delete,
|
|
34
|
+
handler: () => remove(item),
|
|
35
|
+
}"
|
|
36
|
+
></tool-button>
|
|
22
37
|
</slot>
|
|
23
38
|
</div>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
type: 'button',
|
|
31
|
-
text: '复制',
|
|
32
|
-
icon: DocumentCopy,
|
|
33
|
-
handler: () => copy(item),
|
|
34
|
-
}"
|
|
35
|
-
></tool-button>
|
|
36
|
-
<tool-button
|
|
37
|
-
:data="{
|
|
38
|
-
type: 'button',
|
|
39
|
-
text: '删除',
|
|
40
|
-
icon: Delete,
|
|
41
|
-
handler: () => remove(item),
|
|
42
|
-
}"
|
|
43
|
-
></tool-button>
|
|
44
|
-
</slot>
|
|
45
|
-
</div>
|
|
46
|
-
<template #reference>
|
|
47
|
-
<el-icon class="m-editor-page-bar-menu-icon">
|
|
48
|
-
<caret-bottom></caret-bottom>
|
|
49
|
-
</el-icon>
|
|
50
|
-
</template>
|
|
51
|
-
</el-popover>
|
|
52
|
-
</div>
|
|
39
|
+
<template #reference>
|
|
40
|
+
<el-icon class="m-editor-page-bar-menu-icon">
|
|
41
|
+
<caret-bottom></caret-bottom>
|
|
42
|
+
</el-icon>
|
|
43
|
+
</template>
|
|
44
|
+
</el-popover>
|
|
53
45
|
</div>
|
|
54
|
-
|
|
55
|
-
<el-icon><arrow-right-bold></arrow-right-bold></el-icon>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
46
|
+
</PageBarScrollContainer>
|
|
58
47
|
</template>
|
|
59
48
|
|
|
60
|
-
<script lang="ts">
|
|
61
|
-
import {
|
|
62
|
-
|
|
63
|
-
ComputedRef,
|
|
64
|
-
defineComponent,
|
|
65
|
-
inject,
|
|
66
|
-
markRaw,
|
|
67
|
-
onMounted,
|
|
68
|
-
onUnmounted,
|
|
69
|
-
ref,
|
|
70
|
-
toRaw,
|
|
71
|
-
watch,
|
|
72
|
-
} from 'vue';
|
|
73
|
-
import { ArrowLeftBold, ArrowRightBold, CaretBottom, Delete, DocumentCopy, Plus } from '@element-plus/icons';
|
|
49
|
+
<script lang="ts" setup>
|
|
50
|
+
import { computed, inject } from 'vue';
|
|
51
|
+
import { CaretBottom, Delete, DocumentCopy } from '@element-plus/icons-vue';
|
|
74
52
|
|
|
75
53
|
import type { MApp, MPage } from '@tmagic/schema';
|
|
76
|
-
import { NodeType } from '@tmagic/schema';
|
|
77
|
-
|
|
78
|
-
import ToolButton from '@editor/components/ToolButton.vue';
|
|
79
|
-
import type { Services } from '@editor/type';
|
|
80
|
-
import { generatePageNameByApp } from '@editor/utils/editor';
|
|
81
|
-
|
|
82
|
-
const useScroll = (root: ComputedRef<MApp | undefined>) => {
|
|
83
|
-
const pageBar = ref<HTMLDivElement>();
|
|
84
|
-
const itemsContainer = ref<HTMLDivElement>();
|
|
85
|
-
|
|
86
|
-
const pageBarWidth = ref(0);
|
|
87
|
-
const canScroll = ref(false);
|
|
88
|
-
|
|
89
|
-
const itemsContainerWidth = computed(() => pageBarWidth.value - 105);
|
|
90
|
-
|
|
91
|
-
let translateLeft = 0;
|
|
92
|
-
const resizeObserver = new ResizeObserver((entries) => {
|
|
93
|
-
for (const { contentRect } of entries) {
|
|
94
|
-
const { width } = contentRect;
|
|
95
|
-
pageBarWidth.value = width || 0;
|
|
96
|
-
|
|
97
|
-
setCanScroll();
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
const setCanScroll = () => {
|
|
102
|
-
if (itemsContainer.value) {
|
|
103
|
-
canScroll.value = itemsContainer.value.scrollWidth > pageBarWidth.value - 105;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
|
|
107
|
-
const scroll = (type: 'left' | 'right' | 'start' | 'end') => {
|
|
108
|
-
if (!itemsContainer.value) return;
|
|
109
54
|
|
|
110
|
-
|
|
55
|
+
import ToolButton from '../../components/ToolButton.vue';
|
|
56
|
+
import type { Services } from '../../type';
|
|
111
57
|
|
|
112
|
-
|
|
113
|
-
translateLeft += 100;
|
|
58
|
+
import PageBarScrollContainer from './PageBarScrollContainer.vue';
|
|
114
59
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
} else if (type === 'right') {
|
|
119
|
-
translateLeft -= 100;
|
|
60
|
+
const services = inject<Services>('services');
|
|
61
|
+
const editorService = services?.editorService;
|
|
120
62
|
|
|
121
|
-
|
|
122
|
-
translateLeft = -maxScrollLeft;
|
|
123
|
-
}
|
|
124
|
-
} else if (type === 'start') {
|
|
125
|
-
translateLeft = 0;
|
|
126
|
-
} else if (type === 'end') {
|
|
127
|
-
translateLeft = -maxScrollLeft;
|
|
128
|
-
}
|
|
63
|
+
const root = computed(() => editorService?.get<MApp>('root'));
|
|
129
64
|
|
|
130
|
-
|
|
131
|
-
};
|
|
65
|
+
const page = computed(() => editorService?.get('page'));
|
|
132
66
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
67
|
+
const switchPage = (page: MPage) => {
|
|
68
|
+
editorService?.select(page);
|
|
69
|
+
};
|
|
136
70
|
|
|
137
|
-
|
|
138
|
-
|
|
71
|
+
const copy = (node: MPage) => {
|
|
72
|
+
node && editorService?.copy(node);
|
|
73
|
+
editorService?.paste({
|
|
74
|
+
left: 0,
|
|
75
|
+
top: 0,
|
|
139
76
|
});
|
|
140
|
-
|
|
141
|
-
watch(
|
|
142
|
-
() => root.value?.items.length,
|
|
143
|
-
(length = 0, preLength = 0) => {
|
|
144
|
-
setTimeout(() => {
|
|
145
|
-
setCanScroll();
|
|
146
|
-
if (length < preLength) {
|
|
147
|
-
scroll('start');
|
|
148
|
-
} else {
|
|
149
|
-
scroll('end');
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
},
|
|
153
|
-
);
|
|
154
|
-
|
|
155
|
-
return {
|
|
156
|
-
pageBar,
|
|
157
|
-
itemsContainer,
|
|
158
|
-
canScroll,
|
|
159
|
-
|
|
160
|
-
itemsContainerWidth,
|
|
161
|
-
|
|
162
|
-
scroll,
|
|
163
|
-
};
|
|
164
77
|
};
|
|
165
78
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
setup() {
|
|
170
|
-
const services = inject<Services>('services');
|
|
171
|
-
const editorService = services?.editorService;
|
|
172
|
-
|
|
173
|
-
const root = computed(() => editorService?.get<MApp>('root'));
|
|
174
|
-
|
|
175
|
-
return {
|
|
176
|
-
Delete: markRaw(Delete),
|
|
177
|
-
DocumentCopy: markRaw(DocumentCopy),
|
|
178
|
-
|
|
179
|
-
...useScroll(root),
|
|
180
|
-
|
|
181
|
-
root,
|
|
182
|
-
page: computed(() => editorService?.get('page')),
|
|
183
|
-
|
|
184
|
-
switchPage(page: MPage) {
|
|
185
|
-
editorService?.select(page);
|
|
186
|
-
},
|
|
187
|
-
|
|
188
|
-
addPage() {
|
|
189
|
-
if (!editorService) return;
|
|
190
|
-
const pageConfig = {
|
|
191
|
-
type: NodeType.PAGE,
|
|
192
|
-
name: generatePageNameByApp(toRaw(editorService.get('root'))),
|
|
193
|
-
};
|
|
194
|
-
editorService.add(pageConfig);
|
|
195
|
-
},
|
|
196
|
-
|
|
197
|
-
copy(node: MPage) {
|
|
198
|
-
node && editorService?.copy(node);
|
|
199
|
-
editorService?.paste({
|
|
200
|
-
left: 0,
|
|
201
|
-
top: 0,
|
|
202
|
-
});
|
|
203
|
-
},
|
|
204
|
-
|
|
205
|
-
remove(node: MPage) {
|
|
206
|
-
editorService?.remove(node);
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
|
-
},
|
|
210
|
-
});
|
|
79
|
+
const remove = (node: MPage) => {
|
|
80
|
+
editorService?.remove(node);
|
|
81
|
+
};
|
|
211
82
|
</script>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="m-editor-page-bar" ref="pageBar">
|
|
3
|
+
<div id="m-editor-page-bar-add-icon" class="m-editor-page-bar-item m-editor-page-bar-item-icon" @click="addPage">
|
|
4
|
+
<el-icon><plus></plus></el-icon>
|
|
5
|
+
</div>
|
|
6
|
+
<div v-if="canScroll" class="m-editor-page-bar-item m-editor-page-bar-item-icon" @click="scroll('left')">
|
|
7
|
+
<el-icon><arrow-left-bold></arrow-left-bold></el-icon>
|
|
8
|
+
</div>
|
|
9
|
+
<div v-if="root" class="m-editor-page-bar-items" ref="itemsContainer" :style="`width: ${itemsContainerWidth}px`">
|
|
10
|
+
<slot></slot>
|
|
11
|
+
</div>
|
|
12
|
+
<div v-if="canScroll" class="m-editor-page-bar-item m-editor-page-bar-item-icon" @click="scroll('right')">
|
|
13
|
+
<el-icon><arrow-right-bold></arrow-right-bold></el-icon>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script setup lang="ts">
|
|
19
|
+
import { computed, inject, onMounted, onUnmounted, ref, toRaw, watch } from 'vue';
|
|
20
|
+
import { ArrowLeftBold, ArrowRightBold, Plus } from '@element-plus/icons-vue';
|
|
21
|
+
|
|
22
|
+
import { MApp, NodeType } from '@tmagic/schema';
|
|
23
|
+
|
|
24
|
+
import type { Services } from '../../type';
|
|
25
|
+
import { generatePageNameByApp } from '../../utils/editor';
|
|
26
|
+
|
|
27
|
+
const services = inject<Services>('services');
|
|
28
|
+
const editorService = services?.editorService;
|
|
29
|
+
|
|
30
|
+
const pageBar = ref<HTMLDivElement>();
|
|
31
|
+
const itemsContainer = ref<HTMLDivElement>();
|
|
32
|
+
const pageBarWidth = ref(0);
|
|
33
|
+
const canScroll = ref(false);
|
|
34
|
+
|
|
35
|
+
const itemsContainerWidth = computed(() => pageBarWidth.value - 105);
|
|
36
|
+
|
|
37
|
+
let translateLeft = 0;
|
|
38
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
39
|
+
for (const { contentRect } of entries) {
|
|
40
|
+
const { width } = contentRect;
|
|
41
|
+
pageBarWidth.value = width || 0;
|
|
42
|
+
|
|
43
|
+
setCanScroll();
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const setCanScroll = () => {
|
|
48
|
+
if (itemsContainer.value) {
|
|
49
|
+
canScroll.value = itemsContainer.value.scrollWidth > pageBarWidth.value - 105;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const scroll = (type: 'left' | 'right' | 'start' | 'end') => {
|
|
54
|
+
if (!itemsContainer.value) return;
|
|
55
|
+
|
|
56
|
+
const maxScrollLeft = itemsContainer.value.scrollWidth - itemsContainerWidth.value;
|
|
57
|
+
|
|
58
|
+
if (type === 'left') {
|
|
59
|
+
translateLeft += 100;
|
|
60
|
+
|
|
61
|
+
if (translateLeft > 0) {
|
|
62
|
+
translateLeft = 0;
|
|
63
|
+
}
|
|
64
|
+
} else if (type === 'right') {
|
|
65
|
+
translateLeft -= 100;
|
|
66
|
+
|
|
67
|
+
if (-translateLeft > maxScrollLeft) {
|
|
68
|
+
translateLeft = -maxScrollLeft;
|
|
69
|
+
}
|
|
70
|
+
} else if (type === 'start') {
|
|
71
|
+
translateLeft = 0;
|
|
72
|
+
} else if (type === 'end') {
|
|
73
|
+
translateLeft = -maxScrollLeft;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
itemsContainer.value.style.transform = `translate(${translateLeft}px, 0px)`;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
onMounted(() => {
|
|
80
|
+
pageBar.value && resizeObserver.observe(pageBar.value);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
onUnmounted(() => {
|
|
84
|
+
resizeObserver.disconnect();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
const root = computed(() => editorService?.get<MApp>('root'));
|
|
88
|
+
|
|
89
|
+
watch(
|
|
90
|
+
() => root.value?.items.length,
|
|
91
|
+
(length = 0, preLength = 0) => {
|
|
92
|
+
setTimeout(() => {
|
|
93
|
+
setCanScroll();
|
|
94
|
+
if (length < preLength) {
|
|
95
|
+
scroll('start');
|
|
96
|
+
} else {
|
|
97
|
+
scroll('end');
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
},
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const addPage = () => {
|
|
104
|
+
if (!editorService) return;
|
|
105
|
+
const pageConfig = {
|
|
106
|
+
type: NodeType.PAGE,
|
|
107
|
+
name: generatePageNameByApp(toRaw(editorService.get('root'))),
|
|
108
|
+
};
|
|
109
|
+
editorService.add(pageConfig);
|
|
110
|
+
};
|
|
111
|
+
</script>
|