I like the way you use a combination of <textarea> for editing and <pre> for DOM elements.
I actually have come to the same solution for a transcription web app.
I have found that <textarea> manipulation from JS is not really possible without `Document.execCommand` which is deprecated. Some edits will clear the undo history.
Do you have any notes you can share?