Open sydneywu opened 1 year ago
In the getBlockRendererFunc, the image is able to access currentContent. Code below. But this is not available to customBlockRenderer.
const getBlockRenderFunc = (config, customBlockRenderer) => (block) => { if (typeof customBlockRenderer === 'function') { const renderedComponent = customBlockRenderer(block, config, config.getEditorState); if (renderedComponent) return renderedComponent; } if (block.getType() === 'atomic') { const contentState = config.getEditorState().getCurrentContent(); const entity = contentState.getEntity(block.getEntityAt(0)); if (entity && entity.type === 'IMAGE') { return { component: getImageComponent(config), editable: false, }; } else if (entity && entity.type === 'EMBEDDED_LINK') { return { component: Embedded, editable: false, }; } } return undefined; };
CustomBlockRenderer type defintion is as so:
customBlockRenderFunc?(block: ContentBlock): any;
Should it be updated to
customBlockRenderFunc?(block: ContentBlock, config: object, getEditorState: Function): any;
In the getBlockRendererFunc, the image is able to access currentContent. Code below. But this is not available to customBlockRenderer.
CustomBlockRenderer type defintion is as so:
Should it be updated to