mirror of https://github.com/halo-dev/halo
#### What type of PR is this? /area console /kind feature #### What this PR does / why we need it: 让评论来源的显示支持通过插件扩展,目前如 [瞬间](https://github.com/halo-sigs/plugin-moments) 这类的插件如果使用了评论模块,那么在评论管理是无法显示具体来源的: <img width="627" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/0df354dc-ed42-4217-abbd-5bce67329e0d"> 此 PR 为 Console 端提供了拓展方法,使用方式如下: ```ts import { definePlugin } from "@halo-dev/console-shared"; import type { CommentSubjectRefResult } from "@halo-dev/console-shared"; import type { Extension } from "@halo-dev/api-client"; import type { Moment } from "./types"; export default definePlugin({ components: {}, extensionPoints: { "comment:subject-ref:create": () => { return [ { kind: "Moment", group: "moment.halo.run", resolve: (subject: Extension): CommentSubjectRefResult => { const moment = subject as Moment; return { label: "瞬间", title: determineMomentTitle(moment), externalUrl: `/moments/${moment.metadata.name}`, route: { name: "Moments", }, }; }, }, ]; }, }, }); ``` #### Which issue(s) this PR fixes: Fixes #3554 #### Special notes for your reviewer: #### Does this PR introduce a user-facing change? ```release-note Console 端的评论来源显示支持通过插件扩展 ``` |
||
|---|---|---|
| .. | ||
| .changeset | ||
| .husky | ||
| .vscode | ||
| cypress | ||
| docs | ||
| packages | ||
| public | ||
| src | ||
| .editorconfig | ||
| .env.development | ||
| .env.production | ||
| .eslintrc.cjs | ||
| .gitignore | ||
| .gitpod.yml | ||
| .npmignore | ||
| .npmrc | ||
| .prettierignore | ||
| Makefile | ||
| OWNERS | ||
| README.md | ||
| cypress.json | ||
| env.d.ts | ||
| index.html | ||
| package.json | ||
| pnpm-lock.yaml | ||
| pnpm-workspace.yaml | ||
| postcss.config.js | ||
| prettier.config.js | ||
| tailwind.config.js | ||
| tsconfig.app.json | ||
| tsconfig.json | ||
| tsconfig.node.json | ||
| tsconfig.vitest.json | ||
| vite.config.ts | ||
| vitest.config.ts | ||