Skip to content

Fix delete text on attach file toolbar button

Paul Slaughter requested to merge ps-fix-delete-markdown-text-on-upload into master

What does this MR do and why?

This MR fixes an assumption made in an insertText helper function. We shouldn't run document.execCommand('delete') is we don't have a selection.

This fixes a bug where a character is removed when the attach-file button is pressed.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Before After
bug_attach_file_delete fix_attach_file_delete

How to set up and validate locally

This bug is also being fixed as a side-effect of Add guard clause to insertMarkdownText (!145027 - merged). If that MR isn't merged yet, you can validate this MR by:

  1. Start GDK
  2. Go to an Issue or Merge Request
  3. Write a new comment with ABCDEF and click the attach-file toolbar button. Cancel the file dialog. The comment text should not change.

Otherwise, this MR is still good to go, but there might not be any user-facing changes.

Thanks

Thanks to @leipert and @john-slaughter for pairing with me here 🎉

https://youtu.be/dSAo-wtNjDg?feature=shared

Edited by Paul Slaughter

Merge request reports

Loading