Metric embeds do not gracefully handle being copied within gitlab flavoured markdown
Summary
If a user selects the text in an issue description that includes an embedded metric and copies it, the resulting text does not cleanly contain description-only text. It also includes unordered text from the embedded metric chart.
Steps to reproduce
- Embed a metric in gitlab flavoured markdown, for instance inside an issue.
- Save the issue.
- Select the text of the issue.
- Copy the text.
What is the current bug behavior?
The text of the embedded charts is included. For example:
test issue
http://localhost:3001/root/tr-dev-cluster-ee-2/environments/37/metrics
Core Usage (Total)
Total CoresTime0000.0010.0010.0018:00 AM10:00 AM12:00 PM2:00 PM3:44 PM
Total (cores)
Avg: 864μ · Max: 892μ
Memory Usage (Total)
Total Memory Used (GB)Time00.0050.010.0150.020.0250.038:00 AM10:00 AM12:00 PM2:00 PM3:44 PM
Total (GB)
Avg: 24.5m · Max: 25.499999999999996m
What is the expected correct behavior?
Only the description text is included.
test issue
http://localhost:3001/root/tr-dev-cluster-ee-2/environments/37/metrics
Relevant logs and/or screenshots
Possible fixes
Add a copy implementation to the javascripts/behaviors/markdown/copy_as_gfm.js
file.
Edited by 🤖 GitLab Bot 🤖