From ed6d9b2b679083022cae962a7cefbdddc799fbe9 Mon Sep 17 00:00:00 2001 From: roymondchen Date: Sun, 29 Sep 2024 17:05:10 +0800 Subject: [PATCH] =?UTF-8?q?feat(editor):=20=E9=A1=B5=E9=9D=A2/=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E7=89=87=E4=B8=8D=E5=86=8D=E4=BD=BF=E7=94=A8tab?= =?UTF-8?q?=E5=88=86=E5=BC=80=E6=98=BE=E7=A4=BA=EF=BC=8C=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/editor/src/Editor.vue | 1 + packages/editor/src/layouts/Framework.vue | 1 + .../editor/src/layouts/page-bar/AddButton.vue | 38 ++++-- .../editor/src/layouts/page-bar/PageBar.vue | 86 ++++-------- .../page-bar/PageBarScrollContainer.vue | 129 ++++++------------ .../editor/src/layouts/page-bar/PageList.vue | 2 +- .../editor/src/layouts/page-bar/Search.vue | 64 +++++++++ .../src/layouts/page-bar/SwitchTypeButton.vue | 45 ------ packages/editor/src/services/editor.ts | 4 +- packages/editor/src/theme/page-bar.scss | 31 +++-- packages/editor/src/type.ts | 3 +- 11 files changed, 189 insertions(+), 215 deletions(-) create mode 100644 packages/editor/src/layouts/page-bar/Search.vue delete mode 100644 packages/editor/src/layouts/page-bar/SwitchTypeButton.vue diff --git a/packages/editor/src/Editor.vue b/packages/editor/src/Editor.vue index 3469d5d37..f0bf681cb 100644 --- a/packages/editor/src/Editor.vue +++ b/packages/editor/src/Editor.vue @@ -114,6 +114,7 @@ + diff --git a/packages/editor/src/layouts/Framework.vue b/packages/editor/src/layouts/Framework.vue index 5dcfe9ee5..6494b1222 100644 --- a/packages/editor/src/layouts/Framework.vue +++ b/packages/editor/src/layouts/Framework.vue @@ -39,6 +39,7 @@ + diff --git a/packages/editor/src/layouts/page-bar/AddButton.vue b/packages/editor/src/layouts/page-bar/AddButton.vue index bddf8a1d7..de6222938 100644 --- a/packages/editor/src/layouts/page-bar/AddButton.vue +++ b/packages/editor/src/layouts/page-bar/AddButton.vue @@ -3,9 +3,31 @@ v-if="showAddPageButton" id="m-editor-page-bar-add-icon" class="m-editor-page-bar-item m-editor-page-bar-item-icon" - @click="addPage" > - + + + + + +
@@ -15,8 +37,10 @@ import { computed, inject, toRaw } from 'vue'; import { Plus } from '@element-plus/icons-vue'; import { NodeType } from '@tmagic/core'; +import { TMagicPopover } from '@tmagic/design'; import Icon from '@editor/components/Icon.vue'; +import ToolButton from '@editor/components/ToolButton.vue'; import type { Services } from '@editor/type'; import { generatePageNameByApp } from '@editor/utils/editor'; @@ -24,23 +48,19 @@ defineOptions({ name: 'MEditorPageBarAddButton', }); -const props = defineProps<{ - type: NodeType.PAGE | NodeType.PAGE_FRAGMENT; -}>(); - const services = inject('services'); const uiService = services?.uiService; const editorService = services?.editorService; const showAddPageButton = computed(() => uiService?.get('showAddPageButton')); -const addPage = () => { +const addPage = (type: NodeType.PAGE | NodeType.PAGE_FRAGMENT) => { if (!editorService) return; const root = toRaw(editorService.get('root')); if (!root) throw new Error('root 不能为空'); const pageConfig = { - type: props.type, - name: generatePageNameByApp(root, props.type), + type, + name: generatePageNameByApp(root, type), items: [], }; editorService.add(pageConfig); diff --git a/packages/editor/src/layouts/page-bar/PageBar.vue b/packages/editor/src/layouts/page-bar/PageBar.vue index 28e370ff8..7da98ff9d 100644 --- a/packages/editor/src/layouts/page-bar/PageBar.vue +++ b/packages/editor/src/layouts/page-bar/PageBar.vue @@ -1,10 +1,10 @@