I'm trying to use tinyMCE with my Laravel project. The problem is when I store the new article the html tags are not working. They're showing up like a plain text on display on my laravel view:
This is the code implemented in create.blade.php:
<script type="text/javascript" src="{{ asset('/js/tinymce/tinymce.min.js') }}"></script>
<script type="text/javascript">
tinymce.init({
selector : "textarea",
plugins : ["advlist autolink lists link image charmap print preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste jbimages"],
toolbar : "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image jbimages",
});
</script>
Markup is escaped by default in Laravel. If you're storing text in your database that contains markup, you will either want to apply a getter to your Eloquent Model that will unescape it for you, or use the following Blade syntax:
{!! $model->text !!}
When dealing with unescaped output, I would highly recommend limiting the tags that can be applied in your TinyMCE editor by using the valid_elements attribute.