-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AlessioGr
requested review from
denolfe,
jmikrut and
DanRibbens
as code owners
November 15, 2024 20:37
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
jmikrut
reviewed
Nov 16, 2024
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
This then reduces the amount of times lexical blocks re-render when any modal is opened
🚀 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this PR, you can now customize the way that
blocks
andinlineBlocks
are rendered within Lexical'sBlocksFeature
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 theadmin.components.Block
property on yourblock
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-inBlockEditButton
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: