Copy diff file path as GFM
Followup to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8597
The JS is a pretty big hack to work around the fact that ClipboardJS doesn't allow you to hook into the copy command/event: The Ruby clipboard_button
helper sneaks a JSON hash with text
and gfm
keys into the data attribute ClipboardJS tries to copy as text, and then at the last minute intercepts the copy
command/event to deconstruct this JSON hash and set the text/plain
and text/x-gfm
copy data types to the expected values. It's pretty hacky, but it works!
/cc @smcgivern