Skip to content

Commit

Permalink
Merge branch 'test' of github.com:answerdev/answer into test
Browse files Browse the repository at this point in the history
  • Loading branch information
shuashuai committed Sep 25, 2024
2 parents b9064e3 + 106aeab commit 5ffa558
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions ui/src/utils/pluginKit/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import type * as Type from '@/common/interface';
import { LOGGED_TOKEN_STORAGE_KEY } from '@/common/constants';
import { getPluginsStatus } from '@/services';
import Storage from '@/utils/storage';
import request from '@/utils/request';

import { initI18nResource } from './utils';
import { Plugin, PluginInfo, PluginType } from './interface';
Expand Down Expand Up @@ -227,7 +228,7 @@ const useRenderHtmlPlugin = (
})
.forEach((plugin) => {
plugin.hooks?.useRender?.forEach((hook) => {
hook(element);
hook(element, request);
});
});
};
Expand All @@ -247,7 +248,7 @@ const useRenderPlugin = (
})
.forEach((plugin) => {
plugin.hooks?.useRender?.forEach((hook) => {
hook(element);
hook(element, request);
});
});
};
Expand Down
6 changes: 5 additions & 1 deletion ui/src/utils/pluginKit/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import { NamedExoticComponent, FC, RefObject } from 'react';

import type * as Type from '@/common/interface';
import Request from '@/utils/request';

export enum PluginType {
Connector = 'connector',
Expand All @@ -44,7 +45,10 @@ export interface Plugin {
i18nConfig?;
hooks?: {
useRender?: Array<
(element: HTMLElement | RefObject<HTMLElement> | null) => void
(
element: HTMLElement | RefObject<HTMLElement> | null,
request?: typeof Request,
) => void
>;
useCaptcha?: (props: { captchaKey: Type.CaptchaKey; commonProps: any }) => {
getCaptcha: () => Record<string, any>;
Expand Down

0 comments on commit 5ffa558

Please sign in to comment.