From 4c6abdcaa131a37468aef250761394241a87978f Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Thu, 30 May 2024 15:01:15 +0800 Subject: [PATCH] feat: enable asynchronous resolving for UI extension points (#6018) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /area ui /kind feature /milestone 2.16.x #### What this PR does / why we need it: 优化 UI 部分的扩展点获取实现,让部分扩展点支持异步获取,之前的实现与文档不符。 比如: ```ts import { definePlugin } from "@halo-dev/console-shared"; import axios from "axios"; export default definePlugin({ components: {}, routes: [], extensionPoints: { "attachment:selector:create": async () => { const { data } = await axios.get( "/apis/v1alpha1/fake.halo.run/attachments/selectors" ); return data; }, }, }); ``` #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/6008 #### Does this PR introduce a user-facing change? ```release-note 优化 UI 部分的扩展点获取实现,让部分扩展点支持异步获取。 ``` --- .../components/AttachmentSelectorModal.vue | 34 +++-- .../comments/components/CommentListItem.vue | 59 ++++---- .../themes/components/ThemeListModal.vue | 50 ++++--- .../modules/system/backup/Backups.vue | 53 +++---- .../modules/system/plugins/PluginDetail.vue | 35 +++-- .../components/PluginInstallationModal.vue | 52 +++---- .../modules/system/users/UserDetail.vue | 45 +++--- ui/packages/shared/src/types/plugin.ts | 36 +++-- ui/src/components/editor/DefaultEditor.vue | 135 +++++++++--------- .../use-editor-extension-points.ts | 34 +++-- ui/uc-src/modules/profile/Profile.vue | 49 ++++--- 11 files changed, 300 insertions(+), 282 deletions(-) diff --git a/ui/console-src/modules/contents/attachments/components/AttachmentSelectorModal.vue b/ui/console-src/modules/contents/attachments/components/AttachmentSelectorModal.vue index 1a6190498..b0ae3f896 100644 --- a/ui/console-src/modules/contents/attachments/components/AttachmentSelectorModal.vue +++ b/ui/console-src/modules/contents/attachments/components/AttachmentSelectorModal.vue @@ -1,14 +1,13 @@ diff --git a/ui/console-src/modules/system/plugins/PluginDetail.vue b/ui/console-src/modules/system/plugins/PluginDetail.vue index 7bb818685..8a629ea82 100644 --- a/ui/console-src/modules/system/plugins/PluginDetail.vue +++ b/ui/console-src/modules/system/plugins/PluginDetail.vue @@ -1,27 +1,27 @@