Skip to content

Copy diff file path as GFM

Douwe Maan requested to merge dm-copy-diff-file-title-as-gfm into master

Followup to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/8597

copy-file-path-as-gfm

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

Merge request reports