I am trying to build a rich text editor for a little application, and I ran into a problem. I don’t want to upload the whole text every time the user saves the document. The most efficient way I could think of, would be to pick out the changes that were made on the client side, upload them, and then process them on the server. Of course you can’t just upload newText – originalText, the server needs to know where exactly in the text those changes occurred, to piece everything back together on the server.
So I guess my questions are, how do I pick out the changes and how do I upload the changes so the Server knows where to put them again? Is there a common way to do it? If not, how would you do it? I can’t think of any smart way to achieve this. I use PHP 7.3.8 and if you post js Code, jQuery would be appreciated (not that good with vanilla js).
Advertisement
Answer
As AD7six said: It is not a common practice to send updates as diffs, e.g. WordPress (a publishing app/platform – used for everything from blogs to the New York times) doesn’t do that.
It saves almost no bandwidth, so its not worth it.