rich text react

How would a component that lets a user customize rich text work? Would it just be markdown? What about wysiwyg? Is it just turning everything to markdown in real time?
7 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
benten
benten2y ago
I'd reccomend tiptap
Tom
Tom2y ago
just wanted to say thanks for the suggestion. much easier to use than slate, much less broken than plate. No styling included though.
Develliot
Develliot2y ago
I was trying to figure out what it saves the document as under the hood. If it saves as markdown but renders as markup that makes me a hell of a lot less nervous than something that saves as html.
Leonidas
Leonidas2y ago
Html and Markdown are human friendly formats, a conversion to them is definitly recommended. Under the hood all of these editors probably store the internal state as a JSON, which is probably an array of different block types. This is the format that i highly recommend you to use for storing it in the database. Please do not store html directly in your database, that decision locks you in with your current editor choice. When you only store the internal format you can always choose a new editor - which better suits your needs in the future. You would only need to build a legacy format transformer to handle old messages you still wanna keep in your database - if editing them with the new editor is a requirement
Develliot
Develliot2y ago
My main concern is security Saving and rendering user generated html gives me the hebbie jeebies
Leonidas
Leonidas2y ago
In that case you will want to parse the text editors data format before turning that into HTML. Depending on the available documentation this is easier or harder. Lexical’s Playground shows you side by side whats rendered to them DOM and the underlying data format. Take a look there☝🏼 As it should 😅
Want results from more Discord servers?
Add your server