mweiss / elm-rte-toolkit

A toolkit for creating rich text editors in Elm
https://mweiss.github.io/elm-rte-toolkit/
BSD 3-Clause "New" or "Revised" License
149 stars 14 forks source link

Add more powerful validation support #13

Open mweiss opened 4 years ago

mweiss commented 4 years ago

See: https://discourse.elm-lang.org/t/a-toolkit-to-create-rich-text-editors-in-elm/5464/5?u=mweiss

I think the most general way of doing this would be to have custom validation expressions in RichText.Model.ElementDefinition that would take in a node and return a list of validation errors if there were any.

validateNode : Node -> List String

But perhaps this is overkill, and creating something more specialized like content expressions would be easier for people to use, or more expressive for other things like defaulting behavior. In that case, perhaps having a content expression type that users implement for each element definition is the way to go.