Rename isLexical to isLayoutBlock and fix background color logic#960
Merged
Rename isLexical to isLayoutBlock and fix background color logic#960
isLexical to isLayoutBlock and fix background color logic#960Conversation
isLexical for blocks
Contributor
|
Preview deployment: https://fix-is-lexical.preview.avy-fx.org |
isLexical to isLayoutBlock and fix background color logic
Contributor
|
🚀 This is included in version v1.10.0 |
This file contains hidden or 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
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.
Description
When working on adding ImageText to posts, I noticed our conatiner/bg logic was named wrong. This PR renames the confusingly-named
isLexicalblock prop toisLayoutBlock. The old name was misleading —isLexical={true}was used for blocks that were NOT inside Lexical (page layout blocks), andisLexical={false}for blocks that WERE inside Lexical. The new name makes the intent clear: layout blocks get their owncontainerwrapper, embedded blocks don't.Also fixes a bug in
BackgroundColorWrapperwherebgColorClass(e.g.'bg-transparent') was compared against'transparent', meaning the transparent check never matched.Key Changes
isLexical→isLayoutBlockacross 13 block components,RenderBlocks,RichText,BackgroundColorWrapper, andFooterBackgroundColorWrappercontainer logic: container is applied for layout blocks, or for embedded blocks with a non-transparent background'bg-transparent'payloadprop fromRenderBlocklexical-blocksseed page: A test page with blocks embedded inside a Content block's rich text field, useful for visually comparing embedded vs layout block renderingblockNode(),richTextRoot()in seed utilities for constructing Lexical block nodes in seed dataHow to test
pnpm seed/blockspage — layout blocks should render with containers as before/lexical-blocks— embedded blocks should render without their own container (unless they have a non-transparent background)Screenshots / Demo video
Blocks page
https://nwac.fix-is-lexical.preview.avy-fx.org/blocks
NEW lexical blocks page
https://nwac.fix-is-lexical.preview.avy-fx.org/lexical-blocks