mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 21:27:20 +00:00
feat: support enable/disable plugin (#3605)
This commit is contained in:
@@ -3,28 +3,19 @@ import { createElement } from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
|
||||
import { DebugContent } from './UI/debug-content';
|
||||
import { DetailContent } from './UI/detail-content';
|
||||
import { HeaderItem } from './UI/header-item';
|
||||
|
||||
export const entry = (context: PluginContext) => {
|
||||
console.log('copilot entry');
|
||||
context.register('headerItem', div => {
|
||||
const root = createRoot(div);
|
||||
root.render(
|
||||
createElement(context.utils.PluginProvider, {}, createElement(HeaderItem))
|
||||
);
|
||||
return () => {
|
||||
root.unmount();
|
||||
};
|
||||
});
|
||||
|
||||
context.register('window', div => {
|
||||
const root = createRoot(div);
|
||||
root.render(
|
||||
createElement(
|
||||
context.utils.PluginProvider,
|
||||
{},
|
||||
createElement(DetailContent)
|
||||
createElement(HeaderItem, {
|
||||
Provider: context.utils.PluginProvider,
|
||||
})
|
||||
)
|
||||
);
|
||||
return () => {
|
||||
|
||||
Reference in New Issue
Block a user