feat: add @affine/sdk (#3536)

This commit is contained in:
Alex Yang
2023-08-02 21:47:05 -07:00
committed by GitHub
parent d3c719d89a
commit ea34d66e14
39 changed files with 256 additions and 93 deletions

View File

@@ -1,8 +1,5 @@
import {
currentWorkspaceIdAtom,
rootStore,
} from '@toeverything/plugin-infra/atom';
import type { PluginContext } from '@toeverything/plugin-infra/entry';
import type { PluginContext } from '@affine/sdk/entry';
import { currentWorkspaceAtom, rootStore } from '@affine/sdk/entry';
import { createElement } from 'react';
import { lazy } from 'react';
import { createRoot } from 'react-dom/client';
@@ -14,7 +11,7 @@ const HeaderItem = lazy(() =>
export const entry = (context: PluginContext) => {
console.log('register');
console.log('hello, world!');
console.log(rootStore.get(currentWorkspaceIdAtom));
console.log(rootStore.get(currentWorkspaceAtom));
context.register('headerItem', div => {
const root = createRoot(div);
root.render(createElement(HeaderItem));