Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Do I Save and Display HTML in Grails Using the CKEditor?

I'm using the CKEditor plugin of Grails and while I can store the HTML content from CKEditor to the database, I can not render it properly in the view.

What I'm getting in the view is the HTML escaped and not as mark-up content.

<p> sdfsdfsadf</p> <p> asdfasdfasdf</p> <p> asdfasdfasdf</p> <p> &yen;</p>

When I want:

sdfsdfsadf
asdfasdfasdf
asdfasdfasdf
¥

How do I get the stored data to render properly?

like image 606
John Giotta Avatar asked Jan 16 '23 23:01

John Giotta


2 Answers

Migrated to Grails 2.4 and after some head scratching, found <%=expression%> is deprecated.

Using the new syntax ${raw(expression)} solved my issue.

like image 157
Warren Kim Avatar answered Jan 23 '23 10:01

Warren Kim


try ${instance?.attribute?.decodeHTML()}

like image 34
Roberto Perez Alcolea Avatar answered Jan 23 '23 10:01

Roberto Perez Alcolea