Open steveparks opened 1 month ago
Does this happen in all fieldtypes, or just Bard?
Good question. I just tried it in a markdown field and the behaviour is slightly different.
In the markdown field it drops fewer characters and puts the cursor back to the start of the block of text that was just saved.
Screen recording attached...
https://github.com/user-attachments/assets/3422606e-80dd-46cf-87ad-a11920877cc9
I believe this is due to the PublishForm resetting the values after every save - https://github.com/statamic/cms/blob/5.x/resources/js/components/entries/PublishForm.vue#L607
Not sure why this is done, unless it's a multi-user editing the same content thing. Perhaps the solution is to keep track of which field is in focus and don't reset that field?
Bug description
When typing into an entry with Autosave enabled, the cursor regularly jumps back a few characters at the point of each sutosave, losing the characters that were being typed at that point.
It seems that autosave is reloading the text as it was at the moment it was autosaved a fraction of a second before, and so anything that was typed in between the autosave and that reload gets dropped.
Have added a screen recording below.
I'm aware Autosave is an experimental feature, so am reporting in the hope of being able to help troubleshoot and improve it ready for primetime.
Options to address the issue:
Additionally, when editing content locally with npm run dev active, autosave triggers a full reload of the page with every autosave. I guess this is because of the change to the file for the entry. That may not be possible to avoid, so may just need to be documented.
How to reproduce
Enable autosave in /config/statamic/autosave.php, plus in the json config files for a collection (as described in autosave.php).
Go to the main text entry field on an entry edit form for that collection. Type an article as a normal content creator would.
Logs
No response
Environment
Installation
Fresh statamic/statamic site via CLI
Additional details
https://github.com/user-attachments/assets/ac1e72ba-846b-4330-8988-62a3212bd6fa