Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blocksuite/react

Package Overview
Dependencies
Maintainers
5
Versions
199
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blocksuite/react

A React Component & Hooks Library for BlockSuite editor built for AFFiNE.

  • 0.0.0-20230420060121-36f39072-nightly
  • npm
  • Socket score

Version published
Weekly downloads
7
increased by75%
Maintainers
5
Weekly downloads
 
Created
Source

@blocksuite/react

Usage

Use @blocksuite/editor

import dynamic from 'next/dynamic';
import { useBlockSuiteStore } from '@blocksuite/react';

export const Editor = dynamic(
  async () => (await import('@blocksuite/react/editor')).Editor,
  {
    ssr: false,
  }
);

export default function Page() {
  const currentPage = useBlockSuiteStore(store => store.currentPage);
  return <Editor page={page} />;
}

Use @blocksuite/store

// in _app.tsx
import type { AppProps } from 'next/app';
import { BlockSuiteProvider, createBlockSuiteStore } from '@blocksuite/react';
import { Workspace } from '@blocksuite/store';
import { IndexedDBDocProvider } from '@blocksuite/store';

const localWorkspace = new Workspace({
  id: 'local-room',
  isSSR: typeof window === 'undefined',
  providers: typeof window === 'undefined' ? [] : [IndexedDBDocProvider],
});

export default function App({ Component, pageProps }: AppProps) {
  return (
    <BlockSuiteProvider
      createStore={() => createBlockSuiteStore(localWorkspace)}
    >
      <Component {...pageProps} />
    </BlockSuiteProvider>
  );
}

FAQs

Package last updated on 20 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc