awcodes / filament-tiptap-editor

A Rich Text Editor plugin for Filament Forms.
MIT License
249 stars 64 forks source link

Editor is not reset in SPA mode of Filament #395

Closed mihob closed 1 month ago

mihob commented 1 month ago

Filament Version

v3.2.85

Plugin Version

v3.3.5

PHP Version

PHP 8.3.7

Problem description

When using filament in SPA mode, the editor always keeps the content of the first occurrence

For example, I have a resource Books with a TipTap field abstract. If I now open Book A and then Book B, abstract in Book B will always have the value of ‘abstract’ from Book A.

Even if you edit a completely different resource that also has a TipTap field abstract, it will always contain the value of Book A.

Expected behavior

The editor updates its value correctly.

Steps to reproduce

  1. Set filament to spa mode
  2. Edit a resource with a tiptap field.
  3. Open another resource that contains a tiptap field with the same name.

Reproduction repository

No response

Relevant log output

No response

awcodes commented 1 month ago

I don't know of any way to fix this. due to alpine's proxy the editors need to be maintained on the global window object, so without a page refresh that will never get destroyed.

mihob commented 1 month ago

It is not possible to refresh the editor instance when navigating to another page using wire:navigate? I'm not that deep into it, but surely Filament or Livewire will fire an event or something like that

mihob commented 1 month ago

awesome! thx!