This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch build-community-plugin
in repository https://gitbox.apache.org/repos/asf/incubator-answer-website.git
The following commit(s) were added to refs/heads/build-community-plugin by this
push:
new d174968b fix: remove pugin-ui docs
d174968b is described below
commit d174968b271d5cd5b7a6412c7657ed17df5ea7e0
Author: shuai <[email protected]>
AuthorDate: Mon Nov 27 15:48:04 2023 +0800
fix: remove pugin-ui docs
---
community/contributing/plugins.md | 2 +-
community/contributing/plugins/plugin-for-ui.md | 164 ------------------------
sidebarsCommunity.js | 1 -
3 files changed, 1 insertion(+), 166 deletions(-)
diff --git a/community/contributing/plugins.md
b/community/contributing/plugins.md
index 51cc2b4b..6cbc2547 100644
--- a/community/contributing/plugins.md
+++ b/community/contributing/plugins.md
@@ -207,7 +207,7 @@ In order to simplify the development and compilation
process, we use [workspace]
export { default as editor_chart } from 'editor_chart';
```
-3. 运行 `pnpm pre-install`, and 重新运行 `pnpm start`, 最后在你需要加载这个插件的页面调用一下 PluginKit
中 changePluginActiveStatus 方法来激活插件。 **Changes here during the release phase do
not need to be submitted**.
+3. Run `pnpm pre-install`, and re-run `pnpm start`, and finally call the
changePluginActiveStatus method in PluginKit on the page where you need to load
the plugin to activate the plugin. **Changes here during the release phase do
not need to be submitted**.
```ts
import PluginKit from '@/utils/pluginKit';
diff --git a/community/contributing/plugins/plugin-for-ui.md
b/community/contributing/plugins/plugin-for-ui.md
deleted file mode 100644
index bd63cd7a..00000000
--- a/community/contributing/plugins/plugin-for-ui.md
+++ /dev/null
@@ -1,164 +0,0 @@
----
-sidebar_label: Plugin for UI
-slug: /plugins/plugin-for-ui
----
-
-# Develop a UI plug-in
-
-A UI plugin is not so different from a [standard plugin](/docs/plugins) or
React component, it just needs some configuration and wrapping.
-
-Having learned how to develop a standard plugin from the above documentation,
and having understood React components. let's move on to a step-by-step guide
to developing a ui plugin.
-
----
-
-## Development phase
-
-* Go to the `ui/src/plugins` directory and create a React component, such as
`Demo`.
-
-* Create the entry file `index.tsx` for the `Demo` component.
-
-* Create the plugin information file `info.yaml` next to the entry file.
Commonly used fields are as follows
-```yaml
-# info.yaml
-slug_name: ui_plugin_demo
-version: 0.0.1
-author: Answer.dev
-```
-
-* Write any React component you need in the `index.tsx` file and export it as
follows
-```ts
-// plugins/index.ts
-export default {
- info: pluginInfo,
- component: memo(Index),
-};
-```
-
-:::caution
-- It must be exported in this way. `pluginInfo` type definitions can be found
in the [Type Definitions](#type-definitions) section below
-
-- The file names must be `index.tsx` and `info.yaml`, otherwise it will affect
the use of the component.
-:::
-
-* Export the plugins you have just defined in the plugins list file
`plugins/index.ts`
-```ts
-export { default as Demo } from './Demo';
-```
-
-* Now you can use the `PluginRender` component to render the just-defined
plugin where you want it!
-```tsx
-<PluginRender slug_name="ui_plugin_demo" />
-```
-With the above, if your plugin is functionally complete, you are ready to move
on to the release phase.
-
-
-## Release phase
-
-* First, define the release registration file for the component. Using `Demo`
as an example, we write a `demo.go`
-```go
-// demo.go
-package demo
-
-import "github.com/apache/incubator-answer/plugin"
-
-type DemoPlugin struct {
-}
-
-func init() {
- plugin.Register(&DemoPlugin{})
-}
-
-func (d DemoPlugin) Info() plugin.Info {
- return plugin.Info{
- Name: plugin.MakeTranslator("i18n.demo.name"),
- SlugName: "demo_plugin",
- Description: plugin.MakeTranslator("i18n.demo.description"),
- Author: "answerdev",
- Version: "0.0.1",
- }
-}
-```
-:::info
-For detailed definitions, see the [Extension](/docs/plugins) section.
-:::
-
-* Then, move the entire `Demo` directory to the [official plugins
repository](https://github.com/apache/incubator-answer-plugins) and submit a PR
request for merging, and you've released the plugin.
-
----
-
-## I18n for plug-ins
-
-* Create an `i18n` directory under the `Demo` directory and add a language
file in `yaml` format, e.g. `en_US.yaml`.
- - The `plugin` and `ui` fields are fixed and must be used with these
two names.
- - The `ui_plugin_demo` section is the `slug_name` for the plugin, which
is the value of the `slug_name` field defined in `info.yaml`.
-```yaml
-# en_US.yaml
-plugin:
- ui_plugin_demo:
- ui:
- msg: UI Plugin Demo
-```
-
-* Create `index.ts` in the `i18n` directory and initialise the language
resources with the `pluginKit` tool.
-```ts
-import pluginKit from '@/utils/pluginKit';
-
-import en_US from './en_US.yaml';
-import zh_CN from './zh_CN.yaml';
-
-pluginKit.initI18nResource({
- en_US,
- zh_CN,
-});
-```
-
-* Import the language resource file in the `index.tsx` file of the plugin and
initialise the `t` function with the `pluginKit`. Then you can use the `t`
function in the same way as a normal `t` function.
-```tsx
-import pluginKit, { PluginInfo } from '@/utils/pluginKit';
-import './i18n';
-
-const Index: FC = () => {
- const { t } = useTranslation(pluginKit.getTransNs(), {
- keyPrefix: pluginKit.getTransKeyPrefix(pluginInfo),
- });
-
- return <div>{t('msg')}</div>;
-};
-```
-
-For details, please refer to the [example](#example) section
-
-## Type definitions
-```ts
-export type PluginType = 'Connector';
-
-export interface PluginInfo {
- slug_name: string;
- type?: PluginType;
- name?: string;
- description?: string;
-}
-
-export interface Plugin {
- info: PluginInfo;
- component: NamedExoticComponent | FC;
-}
-
-interface I18nResource {
- [lng: string]: {
- plugin: {
- [slug_name: string]: {
- ui: any;
- };
- };
- };
-}
-```
-
-## Example
-
-The final directory structure after the development of the `Demo` plugin is
shown in the figure.
-
-
-
-You can also see the [Demo sample
code](https://github.com/apache/incubator-answer/tree/main/ui/src/plugins/Demo)
for more information.
diff --git a/sidebarsCommunity.js b/sidebarsCommunity.js
index faba7be6..758dec42 100644
--- a/sidebarsCommunity.js
+++ b/sidebarsCommunity.js
@@ -24,7 +24,6 @@ module.exports = {
collapsed: true,
items: [
'contributing/plugins/plugin-config',
- 'contributing/plugins/plugin-for-ui',
'contributing/plugins/plugin-translation',
],
},