Issue comments: Attaching a file or image via button or drag-and-drop breaks Undo history
Summary
When writing a comment on an issue, after attaching a file or picture via either the "paper clip" button or drag-and-drop, the Undo history is broken and Ctrl+Z will not revert the last edit.
As a result, if the user accidentally highlighted text before doing the attachment operation, the highlighted text will be replaced by the attachment (this is normal) but since Undo won't work, the user will have lost the highlighted text.
Steps to reproduce
- Write a comment on any issue on any repo on GitLab
- Attach a file via paper clip button or drag-and-drop. The easiest is to drag-and-drop some image.
- Try Undo (Ctrl+Z)
Example Project
This works on any project. In fact, I just tested it on this very comment.
What is the current bug behavior?
Undo history before the attachment is lost (it will work with future edits only), so user cannot Undo attachment itself.
What is the expected correct behavior?
User should be able to Undo the attachment and even go further in the past.
Relevant logs and/or screenshots
N/A
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
N/A (the bug can be reproduced on the online version of gitlab.com as of 2024-02-14)
Possible fixes
Unknown