blocksuite icon indicating copy to clipboard operation
blocksuite copied to clipboard

feat: react adapters

Open pengx17 opened this issue 1 year ago • 2 comments
trafficstars

Add custom react wrapper, custom react renderer for lit and examples.

This PR migrated codes that are currently in AFFiNE codebase. We free like it is the time to move into blocksuite.

  1. react wrapper: add a custom createReactComponentFromLit that is similar to createComponent from @lit/react. This was added to mitigate issues that web components in blocksuite are often instantiated via creating web components & appending to dom directly in JS, described in https://github.com/lit/lit/issues/4435
  2. react-lit portal: that makes it easier to convert React element into Lit (TemplateResult). Original PR: https://github.com/toeverything/AFFiNE/pull/6124
  3. examples: like the react-basic example, but re-mastered with the React adapters fragments + demo for react-lit portal

https://github.com/toeverything/blocksuite/assets/584378/a927c640-4c92-40f3-88b1-4231171f47cf

pengx17 avatar Mar 15 '24 09:03 pengx17

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blocksuite ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2024 6:07am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
blocksuite-docs ⬜️ Ignored (Inspect) Visit Preview Mar 21, 2024 6:07am

vercel[bot] avatar Mar 15 '24 09:03 vercel[bot]

  • #6490 Graphite 👈
  • master

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @pengx17 and the rest of your teammates on Graphite Graphite

pengx17 avatar Mar 21 '24 03:03 pengx17

Closing after discussion. A new react adapter will be introduced.

Saul-Mirone avatar May 13 '24 09:05 Saul-Mirone