You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by ro...@apache.org on 2024/08/13 07:02:39 UTC
(incubator-answer) 01/01: feat:Support Render type plugins
This is an automated email from the ASF dual-hosted git repository.
robin0716 pushed a commit to branch feat/markdown-render
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
commit 5918ba44aeb62f4d38eb0c8d6fd2dd6da107db54
Author: robin <ro...@rnode.me>
AuthorDate: Tue Aug 13 15:02:29 2024 +0800
feat:Support Render type plugins
---
ui/src/utils/pluginKit/index.ts | 3 ++-
ui/src/utils/pluginKit/interface.ts | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ui/src/utils/pluginKit/index.ts b/ui/src/utils/pluginKit/index.ts
index 1f7efaca..26e3a288 100644
--- a/ui/src/utils/pluginKit/index.ts
+++ b/ui/src/utils/pluginKit/index.ts
@@ -221,7 +221,8 @@ const useRenderHtmlPlugin = (
return (
plugin.activated &&
plugin.hooks?.useRender &&
- plugin.info.type === PluginType.Editor
+ (plugin.info.type === PluginType.Editor ||
+ plugin.info.type === PluginType.Render)
);
})
.forEach((plugin) => {
diff --git a/ui/src/utils/pluginKit/interface.ts b/ui/src/utils/pluginKit/interface.ts
index e1b8ab0c..462ae47b 100644
--- a/ui/src/utils/pluginKit/interface.ts
+++ b/ui/src/utils/pluginKit/interface.ts
@@ -27,6 +27,7 @@ export enum PluginType {
Editor = 'editor',
Route = 'route',
Captcha = 'captcha',
+ Render = 'render',
}
export interface PluginInfo {
@@ -45,7 +46,7 @@ export interface Plugin {
useRender?: Array<
(element: HTMLElement | RefObject<HTMLElement> | null) => void
>;
- useCaptcha?: (props: { captchaKey: Type.CaptchaKey; commonProps: any }) => {
+ useCaptcha?: (props: { captchaKey: Type.CaptchaKey; commonProps: any; }) => {
getCaptcha: () => Record<string, any>;
check: (t: () => void) => void;
handleCaptchaError: (error) => any;