amaelftah/laravel-trix

Cannot render trixRitchText without Editor ?

midsonlajeanty opened this issue · 2 comments

when i use this syntax into blade view :

@trix($post, 'content')

{!! $post->trix('content') !!} //must use HasTrixRichText trait in order for $model->trix() method work

{!! app('laravel-trix')->make($post, 'content') !!}

the trix editor is render, but i need to render only html string. How con i make it ?

One way I did was to render without the toolbar and through JavaScript, disable editing.

BLADE:
@trix($post, 'content', [ 'hideToolbar' => true ])

JS:

<script>
        var trixEditor = document.querySelector('trix-editor');

        trixEditor.setAttribute('contenteditable', false);
    </script>

Thanks ...