maxeckel / livewire-editorjs

This Package aims for an easy integration of Editor.JS with Laravel Livewire
MIT License
146 stars 20 forks source link

In production, auto save on editor block the focus #11

Closed pirmax closed 3 years ago

pirmax commented 3 years ago

Hi,

In production, the auto save feature block the focus on editor... I type text and the focus is blocked after 1 to 2 seconds.

protected $listeners = [
    'editorjs-save:editor' => 'autoSave',
];

public function autoSave(array $json)
{
    $this->content = $json;
}

The Livewire component:

<livewire:admin.partials.custom-editor-component
                    :key="time()"
                    editor-id="editor"
                    :value="$content"
                    upload-disk="s3"
                    download-disk="s3"
                    class="min-h-screen"
                    :read-only="false"
                    :post="$post"
                    placeholder="Saisissez votre nouvelle histoire..."
            />

Thanks for help!

maxeckel commented 3 years ago

Hey @pirmax

this probably results from your autosave triggering a rerender of the component.

You should be able to avoid this by using wire:ignore.