This has been an issue for a long time but I’ve got into the habit of always having the split view and editing the text in the code editor instead of on the page.
I also experienced in few occasions editing text in design view breaks the code, most of the time the closing tag was affected. Dragging element in App Structure or DOM panel too quickly might also break the code. I haven’t able to reproduce the issue for report because those not happen every time. There must be something wrong with the code editor or deign view engine that requires fix.