diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2017-05-12 17:26:20 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2017-05-12 17:26:20 +0000 |
commit | 5c7f63f590100deafb8b04bec9daf9006ed1105e (patch) | |
tree | 99b3bb1d43f5413e1701b3c5556a87055f595f8a /app | |
parent | fa3a1fad376d73c37720ae90a33be1c7f05f13c9 (diff) | |
parent | 7942d8639f2c0da7a40fcafa59f9cffeb532347a (diff) | |
download | gitlab-ce-5c7f63f590100deafb8b04bec9daf9006ed1105e.tar.gz |
Merge branch 'dm-copy-mr-source-branch-as-gfm' into 'master'
Paste a copied MR source branch name as code when pasted into a GFM form
See merge request !11315
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js index 001bf6682f8..9e7299fcdeb 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js @@ -12,6 +12,15 @@ export default { commitsText() { return gl.text.pluralize('commit', this.mr.divergedCommitsCount); }, + branchNameClipboardData() { + // This supports code in app/assets/javascripts/copy_to_clipboard.js that + // works around ClipboardJS limitations to allow the context-specific + // copy/pasting of plain text or GFM. + return JSON.stringify({ + text: this.mr.sourceBranch, + gfm: `\`${this.mr.sourceBranch}\``, + }); + }, }, methods: { isBranchTitleLong(branchTitle) { @@ -72,7 +81,7 @@ export default { <button class="btn btn-transparent btn-clipboard has-tooltip" data-title="Copy branch name to clipboard" - :data-clipboard-text="mr.sourceBranch"> + :data-clipboard-text="branchNameClipboardData"> <i aria-hidden="true" class="fa fa-clipboard"></i> |