Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

148
Vistas
Why ckeditor lose focus on any char entered in Laravel 8 / livewire 2 app?

In Laravel 8 / livewire 2 app I added ckeditor and it works, with livewire data updating with jkavascript, but problem is that when I enter 1 char in ckeditor area, it lose focus next next entered symbolsa are lost. I do :

            <div wire:ignore class="p-2 w-full">

                <textarea
                    wire:model.lazy="form.content"
                    class="form-control"
                    id="content_textarea"></textarea>
                <x-jet-input-error for="form.content" class="mt-2"/>
            </div>

...

                ClassicEditor
                    .create( document.querySelector( '#content_textarea' ), {
                        extraPlugins: [ SimpleUploadAdapterPlugin ],
                        // ...
                    } )

                    .then(editor => {
                        editor.model.document.on('change:data', () => {
                             console.log('change:data editor.getData()::')
                             console.log(editor.getData())
                        @this.set('form.content', editor.getData() )
                        })
                    })

                    .catch( error => {
                        console.error( error );
                    } );

I use lazy for all inputs on this form and they work ok - in browsers console I see fetching messages only when user leaves the input. In change:data event above I see that event is triggered and I supposed this break lazy mode, but I do not know how that can be fixed?

Thanks!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I found decision with using change:isFocused event :

CKEditorInit: function () {
    ClassicEditor
        .create( document.querySelector( '#content_textarea' ), {
            extraPlugins: [ SimpleUploadAdapterPlugin ],
        } )

        .then(editor => {
            editor.ui.focusTracker.on( 'change:isFocused', ( evt, name, isFocused ) => {
                if ( !isFocused ) {
                    const doc = document.getElementById('news_admin_page_container');
                    var wireIds = window.livewire.find(doc.getAttribute("wire:id"))
                    wireIds.set('form.content', editor.getData())
                }
            } );  // 'change:isFocused'
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda