I am creating a Spring MVC + Thymeleaf project. I would like the user to have control over some parts of the page, meaning that user could change text and format is as well with colors, font sizes, etc., using HTML tags. However, I have not found any way how to insert dynamic HTML into thymleaf HTML template. Is there any way how to do it ?
EDIT: Do I really have to use JS in order to be able to achieve that ? Thymeleaf really does not have any way of inserting dynamically generated HTML inside static HTML th template ?
Thanks.
Advertisement
Answer
As Thymeleaf doesn’t limit you in using any frontend libraries you like, you can just use any existing WYSIWYG editor you like. TinyMCE is one of them. Another great editor is Summernote. Here’s a Tutorial describing in detail how to use it with Spring and Thymeleaf: https://frontbackend.com/thymeleaf/spring-boot-bootstrap-thymeleaf-rich-text-editor
But again: there’s nothing special about Thymeleaf. You can use any HTML/JavaScript WYSIWYG editor you like.