Skip to content

Allow expanding issue/MR/epic references in content editor

Himanshu Kapoor requested to merge 406741-ce-expand into master

What does this MR do and why?

GitLab flavoured markdown supports the following:

This MR adds the same support to content editor in two ways:

1. Input rules for issues, MRs and epics

Now you can type an issue, MR or epic ID with a + or +s suffix, and it will automatically expand to its title or the summary in the editor.

Notes:

  1. Since the metadata is fetched from the backend, it is updated with a slight delay. But you can keep typing and the reference will automatically update once the data is retrieved.
  2. If a reference has already been converted to a link (note that the text is blue), and you add a + after it, it won't expand to full text. It only expands plain text.

2. Toggling the display type using the bubble menu

If you inserted a reference already, you can toggle how it is displayed using the bubble menu. You can also use this bubble menu to copy the reference URL, visit reference URL, copy URL and remove the reference.

Screenshots or screen recordings

Context Screen recording
Typing using input rules Screen Recording 2023-05-11 at 16.31.15.mov
Changing the reference type using the dropdown Screen Recording 2023-05-11 at 16.55.00.mov

How to set up and validate locally

  1. Enable feature flag :content_editor_on_issues.
  2. Create a new issue. Enable content editor by clicking Switch to rich text.
  3. Insert a reference by typing # or !.
  4. Click the reference to show the reference bubble menu.
  5. Play around with the actions: dropdown, copy reference URL, visit reference, remove reference.
  6. Alternatively, type the issue/MR/epic ID manually with or without +/ +s suffixes, and observe that it resolves to a reference link.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #406741 (closed)

Edited by Himanshu Kapoor

Merge request reports

Loading