Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(richtext-lexical): allow replacing entire blocks with custom components #9234

Merged
merged 15 commits into from
Nov 16, 2024

Conversation

AlessioGr
Copy link
Member

@AlessioGr AlessioGr commented Nov 15, 2024

With this PR, you can now customize the way that blocks and inlineBlocks are rendered within Lexical's BlocksFeature by passing your own React components.

This is super helpful when you need to create "previews" or more accurate UI for your Lexical blocks.

For example, let's say you have a gallery block where your admins select a bunch of images. By default, Lexical would just render a collapsible with your block's fields in it. But now you can customize the admin.components.Block property on your block config by passing it a custom React component for us to render instead.

So using that, with this gallery example, you could make a dynamic gallery React component that shows the images to your editors - and then render our built-in BlockEditButton to allow your editors to manage your gallery in a drawer.

Here is an example where the BlockEditButton is added to the default Block Collapsible/Header:

image

Copy link

vercel bot commented Nov 15, 2024

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

Name Status Preview Comments Updated (UTC)
template-with-vercel-website ❌ Failed (Inspect) Nov 15, 2024 11:57pm

@jmikrut jmikrut changed the title feat(richtext-lexical): allow replacing entire inline block with custom component feat(richtext-lexical): allow replacing entire blocks with custom components Nov 16, 2024
@AlessioGr AlessioGr merged commit 63cc966 into beta Nov 16, 2024
60 checks passed
@AlessioGr AlessioGr deleted the backuppp branch November 16, 2024 22:30
Copy link

🚀 This is included in version v3.0.0-beta.134

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants