Latest

Thursday, July 13, 2017

Summernote set text through passed parameter in laravel

Asked by: John


My laravel controller passes parameters to the view which I can access by $note in {{ }}. All right, it works. I can get note's title. However, when I want to set the HTML for summernote, it somehow doesn't work. This is what I tried:

<script type="text/javascript">
$('#editor').summernote('code', '{{ $note->html }}');

as well as unescaped using {!! $note->html !!}}. The result is a summernote editor which looks like a normal text input. However, when manually setting [...]('code', '<html><h1>some html for example</h1></html>)[...] it works like a charm.

It is obvious that it's related to the way blade is putting out data using {{ }} but I can't currently figure out why. Using unescaped html had been the first approach that popped up in my mind.



Source

No comments:

Post a Comment

Adbox