0

Instances undefined

Hello, i have two CKEDITORS in my form, included by:

@include('components.ckeditor', ['name' => 'obs_completo', 'descricao' => $produto ? $produto->descricao : old('obs_completo'), 'placeholder' => 'Insira seu texto aqui'])
@include('components.ckeditor', ['name' => 'descricao_fabricante', 'descricao' => $produto->informacao ? $produto->informacao->descricao_fabricante : '', 'placeholder' => 'Insira seu texto aqui'])

but when i try to change the value with via console or code by:

CKEDITOR.instances.obs_completo.setData( '<p>Test.</p>' );

I get an error:

VM3710:1 Uncaught TypeError: Cannot read properties of undefined (reading 'obs_completo')`

And CKEDITOR.instances returns undefined

My code

<div>
    <textarea class="form-control" id="{{$name}}" name="{{$name}}" rows="3"></textarea>
</div>

@push('js')
    <script>
        // This sample still does not showcase all CKEditor 5 features (!)
        // Visit https://ckeditor.com/docs/ckeditor5/latest/features/index.html to browse all the features.
        CKEDITOR.ClassicEditor.create(document.getElementById("{{$name}}"), {
            ckfinder: {
                uploadUrl: '{{route('ckeditor-upload').'?_token='.csrf_token()}}',
            },
            ...

        console.log(CKEDITOR.instances);
    </script>
@endpush

I tried to change the ckeditor value, but i get an error.

1
  • Include 1: @include('components.ckeditor', ['name' => 'obs_completo', 'descricao' => $produto ? $produto->descricao : old('obs_completo'), 'placeholder' => 'Insira seu texto aqui']) Include 2: @include('components.ckeditor', ['name' => 'descricao_fabricante', 'descricao' => $produto->informacao ? $produto->informacao->descricao_fabricante : '', 'placeholder' => 'Insira seu texto aqui']) Commented Jun 13 at 14:57

0

Browse other questions tagged or ask your own question.