Pita/etherpad-lite — pull request #204 by lorenzogil (2011-11-17 10:02:50+00:00)
Title: Implementation of the setHTML API

This is the perfect partner for the getHTML API.

At the beginning I tried to to understand how the client code works with the ace2 editor and the easysync internal representation and all that stuff (I even read and understood the math paper)l. I wanted to add a changeset to the Pad with just the differences betweend the old content and the new one and I almost got it working but there were too many corner cases that made it crashes. Then I lowerd my requirements a little bit and put an intermediate state where I would set the pad content to blank before applying the new content. This made the code way easier and more mantenible IMHO.

The other thing I feel can be improved is the common code that runs both on the client and the server. Before my previous simplification there was quite a lot of this code and I changed the client code to be able to use it from the server side. After the simplification I discovered I didn't need that much code from the client.

Anyway, I hope you like this new contribution.