feat(richtext-lexical): separate configuration for lexical block icons#15632
Conversation
AlessioGr
left a comment
There was a problem hiding this comment.
Let's do the following:
- mark
imageURLandimageAltTextproperties as@deprecated, and add JSDocs - add one new property:
images?: {
icon: { url: , alt: },
thumbnail: { url: , alt: },
}|
@AlessioGr could you please check packages\richtext-lexical\src\features\blocks\client\getBlockImageComponent.tsx I moved images to
Moved images to admin properties table in docs, and moved image guidlines section under admin options table |
|
About ts error on top, i added export type ClientBlock = {
admin?: Pick<NonNullable<Block['admin']>, 'custom' | 'disableBlockName' | 'group' | 'images'>
fields: ClientField[]
labels?: LabelsClient
} & Pick<Block, 'imageAltText' | 'imageURL' | 'jsx' | 'slug'> |
AlessioGr
left a comment
There was a problem hiding this comment.
I think this looks good like that, thank you!
Head branch was pushed to by a user without write access
|
@AlessioGr pinging, because i removed images config from test blocks configs, for e2e tests to pass. |
|
From claude code: When a block has admin.images.thumbnail with an alt text (e.g. alt: 'Block thumbnail'), the browser includes that alt text in the button's accessible name. The addBlock helper selects blocks in the drawer using: getByRole('button', { name: exactText(blockToSelect) })So when searching for 'Content', it expects the button's accessible name to be exactly "Content", but it's now "Block thumbnail Content" — causing the locator to fail. I moved images config to WithIcon block, and vibe-coded tests for it (sorry). Pushing here to test. |
|
🚀 This is included in version v3.79.0 |


This PR adds a new images property to BlockConfig, allowing developers to specify separate images for different UI contexts:
Why
Currently,
imageURLserves dual purposes:Citing documentation:
This creates problem , where developer needs to choose either good looking icons (but worse UX on block drawers) or good looking thumnails, but scaled down images as icons.
Solution
Add a dedicated
imagesproperty with a fallback chain:Now you can set different URL for block icons in lexical blocks:

Example:
Backwards Compatibility
Fully backwards compatible — imageURL and imageAltText still work (marked as @deprecated), with automatic fallback to the new images property behavior.