this reminds me of google docs, they have a pretty good system for automatically saving large text to a database. Now I donโt know about the internal components of Google docs, but this is what you might want to learn.
Google has a lot more bandwidth, so their method may not work for you, although it seems that they constantly store data on their servers.
what you can do is use javascript and save the data on the user side and load the data only into the database when the user leaves or clicks โsaveโ. That way, when they return to the page while the save file is being saved, they can return to their file.
source share