Is it possible to render a custom block where some parts of it are editable and some are not?
Here is an example of what I am trying to achieve. The ReadOnlyComponent component should be read only, while the WriteComponent contains data that can be editable.
class CustomBlock extends React.Component {
props: Props;
render() {
return (
<Layout>
<LeftColumn>
<ReadOnlyComponent>
{this.props.block.getData().get('speaker')}
</ReadOnlyComponent>
</LeftColumn>
<RightColumn>
<WriteComponent>
<EditorBlock {...this.props} />
</WriteComponent>
</RightColumn>
</Layout>
);
}
}
Here is the blockRendererFn prop that we pass to the Editor to create custom block components:
<Editor
editorState={this.state.editorState}
blockRendererFn={() => ({
component: CustomBlock,
})}
/>