Search code examples
elm

What's the alternative to innerHtml attribute in elm 0.19?


I have an application that allows users create their own e-mail HTML templates via WYSIWYG editor (TinyMCE) and I have a preview functionality for stored templates that shows stored HTML tpl code from the server. It worked flawlessly with elm 0.18. I was showing it using innerHtml property.

And now with elm 0.19 innerHtml is gone. The only alternative I've found is html-parser. But TinyMCE sometimes creates not so valid HTML and the parser fails.

What can I do now?


Solution

  • There is no alternative to innerHtml in 0.19. You must either parse the input, like you have stated, or delegate to javascript using either a WebComponent, Ports, or a data- attribute and a javascript hook.

    Here's a link to the discussion in html-extra that talks about some of the challenges of innerHtml and that it is forbidden in 0.19

    https://github.com/elm-community/html-extra/issues/15