amaelftah / laravel-trix

Configurable Basecamp Trix Editor (WYSIWYG) delivered to your laravel application
MIT License
526 stars 53 forks source link

Cannot render trixRitchText without Editor ? #81

Closed midsonlajeanty closed 9 months ago

midsonlajeanty commented 1 year ago

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 ?

d4rkm0d3324 commented 10 months ago

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>
midsonlajeanty commented 9 months ago

Thanks ...