Improve handling of undo/redo events in web demo (#1254)
Fixes #1254. In the demo on https://jsonnet.org, if you hit redo/undo for multiple characters, the demo breaks. This seems to be because the browser generates multiple text change events (Chrome 139, MacOS 14.6).
Previous Behavior
https://jsonnet.org/
https://github.com/user-attachments/assets/1855eaed-9b17-4ef4-beab-9c438e6f1d47
New Behavior
https://github.com/user-attachments/assets/6c9b291e-d7f8-4b1e-a020-7b3aa96b3e9a
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.