The markdown buttons break the undo function, so if you accidentally (or intentionally) click on them, you can't easily fix it

Summary

The markdown buttons break the undo function, so if you accidentally (or intentionally) click on them, you can't easily fix it, and you lose all of your undo history, which breaks the UI expectations

Steps to reproduce

  • Go to any editor (e.g. comment in an MR, or open an issue)
  • Type some text
  • Use undo in the context menu or Ctrl+Z/Cmd+Z
  • See that it works
  • Use one of the MD buttons (e.g. select a word and click on the "Bold" button)
  • Use undo in the context menu or Ctrl+Z/Cmd+Z
  • See that they do nothing, no matter how many times you press them (I tried about 5-10 times)

Example Project

This is a UI issue

What is the current bug behavior?

Using the markdown buttons break the undo/redo functionality

What is the expected correct behavior?

Using the markdown buttons should not break undo/redo, and you should be able to undo a markdown button action.

Relevant logs and/or screenshots

None relevant

Output of checks

None relevant

Results of GitLab environment info

None relevant

Results of GitLab application Check

None relevant

Possible fixes

Not sure what JS library is used. It seems that it's possible to change the text programmaticaly and add to the undo stack