Closed zbrox closed 7 years ago
This is used in a node.js backend and since I'm not using any ES6 features, I'm also not using babbel or anything of the sort, so I had to import the function like this const draftToHtml = require('draftjs-to-html').default;
Using babel this seems to be fine.
Good to know 👍
Just as an update, it wasn't the ES6 import syntax that was the problem. In my quick test to see if it would work with ES6 I copy pasted the JSON I usually save in a database from DraftJS' convert to raw function. But I didn't paste it as it is but back as JSON so it worked. But where the issue was observed I was actually feeding draftToHtml a string of the JSON :) I was under the wrong impression that draftToHtml was expecting the unparsed JSON string :)
When using draftToHtml on a valid raw state I only get an empty string. There are no errors or warning being raised, just an empty string returned.