laravel-trix icon indicating copy to clipboard operation
laravel-trix copied to clipboard

Is it possible to have a default text in editor

Open matthiasvanwoensel opened this issue 3 years ago • 1 comments

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

matthiasvanwoensel avatar Jun 09 '21 10:06 matthiasvanwoensel

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>

mas-iybaz avatar Jan 12 '22 04:01 mas-iybaz