Render HTML code in TextArea



Is it possible to render html code in an TextArea? For example a link?


"Here is a lot of text. link



If you are using Thymeleaf you’d use the data-th-utext (for Unformatted Text) to properly output HTML. In addition, the data needs to be run through the portal.processHtml() function in JavaScript to transform all links from key-values to proper URLs. Once that is done a web editor can move target for links, and even pictures, around as much as they want without breaking links =)


I’m actually not using thymeleaf.
Okey, to tell the whole story, i’m actually sending data containing text to another application that uses the data and shows it through a TextArea in Enonic directly. So what I wanted to do was to send data containing text, but where i was also able to put “<a href…” , so when it was shown in the Enonic TextArea it would be rended as a link. :slight_smile:


So, you are rather looking for a markdown inputType with preview support?


Thanks for explanation! And I’ve been thinking of 'why do we need portal.processHtml() if the data is displayed as it should just using data-th-utext instead of data-th-text?' Now I do know why. :slight_smile: