Skip to content

Link button in an issue description and comment behaving incorrectly after switching from preview

Summary

Link button behaving incorrectly after preview (i.e. adds entire snippet on selected block of code instead of just url part). cmd+k shortcut works as expected.

ezgif-5-7034059abb

Also similar end result was caused by other activities prior that (i.e. after using collapsable section), review this thread in #random.

Steps to reproduce

  1. Start making text in issues's description or comment
  2. Switch to "Preview"
  3. Switch back
  4. Select piece of text that needs link
  5. Click on "Add a link" button

It adds: [example]([url](url)) instead of [example](url) (equivalent of double click).

Example Project

What is the current bug behavior?

What is the expected correct behavior?

It should add [example](url) (assuming initially example as text was selected in comment/description of an issue).

Relevant logs and/or screenshots

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes