Skip to content

Instantly share code, notes, and snippets.

@gustav1105
Created February 16, 2020 16:38
Show Gist options
  • Save gustav1105/ae0688ad9de7648236dfbd08543c97fd to your computer and use it in GitHub Desktop.
Save gustav1105/ae0688ad9de7648236dfbd08543c97fd to your computer and use it in GitHub Desktop.
render-block
const renderBlock = (contentBlock: ContentBlock) => {
if (contentBlock.getType() === "atomic") {
const entityKey = contentBlock.getEntityAt(0);
const entityData = editorState
.getCurrentContent()
.getEntity(entityKey)
.getData();
return {
component: MediaComponent,
editable: false,
props: {
src: { file: entityData.src }
}
};
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment