diff options
-rw-r--r-- | app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js | 9 | ||||
-rw-r--r-- | changelogs/unreleased/dm-copy-mr-source-branch-as-gfm.yml | 4 |
2 files changed, 13 insertions, 0 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 272dae25455..cfd34970f11 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) { diff --git a/changelogs/unreleased/dm-copy-mr-source-branch-as-gfm.yml b/changelogs/unreleased/dm-copy-mr-source-branch-as-gfm.yml new file mode 100644 index 00000000000..708c82604ad --- /dev/null +++ b/changelogs/unreleased/dm-copy-mr-source-branch-as-gfm.yml @@ -0,0 +1,4 @@ +--- +title: Paste a copied MR source branch name as code when pasted into a GFM form +merge_request: +author: |