Several years ago, I've programmed a similar editor (main task is the event bindings) that's keystroke-logging/autosaving
https://rumble.com/vg2w21-hypertext-components-visualizing-tracked-text-changes.html just 1. not in-browser (sandobx) but native (one Java Swing and one in C++/Qt while not fully working), 2. creating revision history and visualizing it (no git). No variants/branching (because no merging), not Ink&Switch so-called "local-first" CRDTs (because these are depending on, assuming, WWW SaaS and trapped inside localStorage WWW browser sandbox). May one day calculate/resolve merging/conflicts myself (hopefully). Obviously, next directions naturally would be proper buffer editing (standoff, structural, treesitter, other), streaming to HDD + remote server, and so on. Not sure why this isn't the standard/default for all edit controls in GUI toolkits, and instead limited to just isolated specialized apps :-(