简体   繁体   中英

Dynamic HTML in Thymeleaf

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 dynamicly generated HTML inside static HTML th template ?

Thanks.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM