Currently, I'm using draft js editor, add plugin draft-js-video-plugin to insert video into editor and use draft-js-export-html to export html but the htmk result not includes video tag or anythings else.
Console log stateToHTML(this.state.editorState.getCurrentContent())
<p><br></p>
<figure> </figure>
<p><br></p>
I found same issue with export image here and they've resolved but not for video. I've read their source code on github and seem now they only support text, link and image.
So how can I get result HTML includes video from draft js? Please help me, thank you guys.
Credit to rafaelespinoza https://github.com/sstur/draft-js-utils/issues/59#issuecomment-314527096
I'm able to fix it using `entityStyleFn like below:
entityStyleFn: (entity) => {
const entityType = entity.get('type').toLowerCase();
if (entityType === 'draft-js-video-plugin-video') {
const data = entity.getData();
return {
element: 'video',
attributes: {
src: data.src,
},
};
}
return null;
},