mirror of
https://github.com/halo-dev/halo.git
synced 2025-12-20 16:44:38 +08:00
#### What type of PR is this? /area ui /kind api-change /milestone 2.22.x #### What this PR does / why we need it: See #7925 #### Which issue(s) this PR fixes: Fixes #7925 #### Special notes for your reviewer: #### Does this PR introduce a user-facing change? ```release-note 将 `@halo-dev/console-shared` 重命名为 `@halo-dev/ui-shared` ```
1.1 KiB
1.1 KiB
评论编辑器扩展点
用于替换 Halo 在 Console 的默认评论输入框。
注意: 此扩展点并非通用扩展点,由于 Halo 早期设定,Halo 在前台的评论组件 UI 部分由 评论组件插件 提供,而在此插件的后续版本中提供了富文本编辑器的功能,所以为了保持 Console 的评论输入框与前台一致,所以专为此插件提供了替换输入框的扩展点。
定义方式
import { definePlugin } from "@halo-dev/ui-shared";
import { markRaw } from "vue";
import CommentEditor from "./components/CommentEditor.vue";
export default definePlugin({
extensionPoints: {
"comment:editor:replace": () => {
return {
component: markRaw(CommentEditor),
};
},
},
});
其中,组件需要包含的 props 如下:
autoFocus:是否自动聚焦,需要在组件中判断是否为true,然后聚焦输入框。
需要定义的 emit 如下:
(event: "update", value: { content: string; characterCount: number }):向调用方传递内容和字符数更新的事件。