amaelftah/laravel-trix

Is it possible to have a default text in editor

matthiasvanwoensel opened this issue · 1 comments

I can't find a way to add a default value to the editor, is there any way?

Hi @matthiasvanwoensel, I had the same problem for this, and i used this way to solve the problem. hopefully this information helps you.
You can use 'id' on $config:
@trix(\App\Post::class, 'body', ['id' => 'trix-body'])

and then you can add a default value to the editor using javascript:
<script> const trixBody = document.querySelector('#trix-body'); trixBody.value = "This is a default value"; </script>