I built a Draft.js editor in my Rails application. I use the convertToRaw()
and convertFromRaw()
methods to persist its state on the server and restore it later.
Now I want to add a custom Todo block component as explained here, except that it would save a Todo object to the database, reference it, and render it… The goal being to be able to "extract" these objects from the editor and use them elsewhere in the app.
Since a picture is worth a thousand words, here's one I found in an article on Transclusion which shows pretty well what I have in mind:
But to be honest, I'm not sure at all what would be the best way to implement such a feature. Especially since I'd like to apply it to other Draft.js blocks in the future…
Thank you for the help!
David