@@ -14,11 +14,11 @@ import type { ToolbarGroup, ToolbarGroupItem } from '../../toolbars/types.js'
14
14
import { BlockIcon } from '../../../lexical/ui/icons/Block/index.js'
15
15
import { InlineBlocksIcon } from '../../../lexical/ui/icons/InlineBlocks/index.js'
16
16
import { createClientFeature } from '../../../utilities/createClientFeature.js'
17
+ import { getBlockImageComponent } from './getBlockImageComponent.js'
17
18
import { BlockNode } from './nodes/BlocksNode.js'
18
19
import { InlineBlockNode } from './nodes/InlineBlocksNode.js'
19
20
import { INSERT_BLOCK_COMMAND , INSERT_INLINE_BLOCK_COMMAND } from './plugin/commands.js'
20
21
import { BlocksPlugin } from './plugin/index.js'
21
-
22
22
export const BlocksFeatureClient = createClientFeature (
23
23
( { featureClientSchemaMap, props, schemaPath } ) => {
24
24
const schemaMapRenderedBlockPathPrefix = `${ schemaPath } .lexical_internal_feature.blocks.lexical_blocks`
@@ -64,7 +64,7 @@ export const BlocksFeatureClient = createClientFeature(
64
64
? {
65
65
items : clientBlocks . map ( ( block ) => {
66
66
return {
67
- Icon : BlockIcon ,
67
+ Icon : getBlockImageComponent ( block . imageURL , block . imageAltText ) ,
68
68
key : 'block-' + block . slug ,
69
69
keywords : [ 'block' , 'blocks' , block . slug ] ,
70
70
label : ( { i18n } ) => {
@@ -130,7 +130,7 @@ export const BlocksFeatureClient = createClientFeature(
130
130
ChildComponent : BlockIcon ,
131
131
items : clientBlocks . map ( ( block , index ) => {
132
132
return {
133
- ChildComponent : BlockIcon ,
133
+ ChildComponent : getBlockImageComponent ( block . imageURL , block . imageAltText ) ,
134
134
isActive : undefined , // At this point, we would be inside a sub-richtext-editor. And at this point this will be run against the focused sub-editor, not the parent editor which has the actual block. Thus, no point in running this
135
135
key : 'block-' + block . slug ,
136
136
label : ( { i18n } ) => {
@@ -159,7 +159,9 @@ export const BlocksFeatureClient = createClientFeature(
159
159
ChildComponent : InlineBlocksIcon ,
160
160
items : clientInlineBlocks . map ( ( inlineBlock , index ) => {
161
161
return {
162
- ChildComponent : InlineBlocksIcon ,
162
+ ChildComponent : inlineBlock . imageURL
163
+ ? getBlockImageComponent ( inlineBlock . imageURL , inlineBlock . imageAltText )
164
+ : InlineBlocksIcon ,
163
165
isActive : undefined ,
164
166
key : 'inlineBlock-' + inlineBlock . slug ,
165
167
label : ( { i18n } ) => {
0 commit comments