Reputation:
I'm facing a problem and i couldn't find a solution to solve it. My problem is that i have apply a plugin which called as ( Wysiwyg - summernote editor into my Laravel framework project ) . Everything works fine but when i click on the edit page, the data is unable to retrieve from the database and directly edit with the editor function. Can anyone familiar with this help me out ? Thank you so much
<div class="form-group">
<label for="company_policy_policy_details">Please Enter Policy Details<span<p><font color="#F05340"> *</font></p></label></span>
<input type="text" name="policy_details" id="abc" class="form-control" value="{!!$policy->policy_details!!}" cols="139" rows="10">
</textarea>
</div>
<div id="summernote"></div>
<script>
$('#abc').summernote({
placeholder:value="{!!$policy->policy_details!!}",
tabsize: 2,
height: 100
});
</script>
</body>
</html>
</div>`
Expected output = i want the value in placeholder are able to show inside the editor and able to edit it directly , Thankssssss
Upvotes: 2
Views: 5103
Reputation: 5545
If you want to write html code and add it to editor you can use pasteHTML , to Paste HTML string.
// @param {String} HTML string
var HTMLstring = '<div><p>Hello, world</p><p>Summernote can insert HTML string</p></div>';
$('#summernote').summernote('pasteHTML', HTMLstring)
If you want to get data from database use the below code :
$('#summernote').summernote('code', {{$data->content}});
Upvotes: 0
Reputation: 4684
I believe this code will show the data from your db.
$('#summernote').summernote({
placeholder: "{!!$policy->policy_details!!}",
tabsize: 2,
height: 100
}).summernote('code', `{!!$policy->policy_details!!}`);
Upvotes: 3