draft-js-utils
draft-js-utils copied to clipboard
img tag  
entityStyleFn: (entity) => {
const entityType = entity.get('type').toLowerCase();
const data = entity.getData();
switch(entityType){
case 'image':
return {
element: 'img',
attributes: { src: data.src },
style: { maxWidth: '100%', height: 'auto' }
}
}
}
let html = stateToHTML(contentState, options)
html :
<figure><img src="...." style="max-width: 100%; height: auto"> </img></figure>
  Causes placeholders under images
How to turn into:
<figure><img src="...." style="max-width: 100%; height: auto" /></figure>