Skip to content

Rename isLexical to isLayoutBlock and fix background color logic#960

Merged
rchlfryn merged 5 commits intomainfrom
fix-is-lexical
Mar 1, 2026
Merged

Rename isLexical to isLayoutBlock and fix background color logic#960
rchlfryn merged 5 commits intomainfrom
fix-is-lexical

Conversation

@rchlfryn
Copy link
Collaborator

@rchlfryn rchlfryn commented Feb 28, 2026

Description

When working on adding ImageText to posts, I noticed our conatiner/bg logic was named wrong. This PR renames the confusingly-named isLexical block prop to isLayoutBlock. The old name was misleading — isLexical={true} was used for blocks that were NOT inside Lexical (page layout blocks), and isLexical={false} for blocks that WERE inside Lexical. The new name makes the intent clear: layout blocks get their own container wrapper, embedded blocks don't.

Also fixes a bug in BackgroundColorWrapper where bgColorClass (e.g. 'bg-transparent') was compared against 'transparent', meaning the transparent check never matched.

Key Changes

  • Rename isLexicalisLayoutBlock across 13 block components, RenderBlocks, RichText, BackgroundColorWrapper, and Footer
  • Fix BackgroundColorWrapper container logic: container is applied for layout blocks, or for embedded blocks with a non-transparent background
  • Fix transparent comparison bug: Both lines now correctly compare against 'bg-transparent'
  • Remove unused payload prop from RenderBlock
  • Update docs to reflect the rename
  • Add lexical-blocks seed page: A test page with blocks embedded inside a Content block's rich text field, useful for visually comparing embedded vs layout block rendering
  • Add seed helpers: blockNode(), richTextRoot() in seed utilities for constructing Lexical block nodes in seed data

How to test

  1. Run pnpm seed
  2. Visit the /blocks page — layout blocks should render with containers as before
  3. Visit /lexical-blocks — embedded blocks should render without their own container (unless they have a non-transparent background)
  4. Compare the two pages side-by-side to verify container/padding differences are correct

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

Lexical-Blocks-Northwest-Avalanche-Center-02-28-2026_11_20_AM

@rchlfryn rchlfryn self-assigned this Feb 28, 2026
@rchlfryn rchlfryn changed the title Fix is lexical Fix isLexical for blocks Feb 28, 2026
@rchlfryn rchlfryn changed the title Fix isLexical for blocks Fix container and background color for blocks Feb 28, 2026
@github-actions
Copy link
Contributor

Preview deployment: https://fix-is-lexical.preview.avy-fx.org

@rchlfryn rchlfryn added this pull request to the merge queue Mar 1, 2026
Merged via the queue into main with commit 94f7d63 Mar 1, 2026
9 checks passed
@rchlfryn rchlfryn deleted the fix-is-lexical branch March 1, 2026 01:21
@rchlfryn rchlfryn changed the title Fix container and background color for blocks Rename isLexical to isLayoutBlock and fix background color logic Mar 5, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 5, 2026

🚀 This is included in version v1.10.0

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant