diff options
-rw-r--r-- | app/helpers/button_helper.rb | 16 | ||||
-rw-r--r-- | changelogs/unreleased/dm-copy-diff-file-title-as-gfm.yml | 4 |
2 files changed, 8 insertions, 12 deletions
diff --git a/app/helpers/button_helper.rb b/app/helpers/button_helper.rb index a417c8df8bd..c85e96cf78d 100644 --- a/app/helpers/button_helper.rb +++ b/app/helpers/button_helper.rb @@ -1,10 +1,10 @@ module ButtonHelper # Output a "Copy to Clipboard" button # - # data - Data attributes passed to `content_tag` - # text - Text to copy - # gfm - GitLab Flavored Markdown to copy, if different from `text` - # target - Selector for target element to copy from + # data - Data attributes passed to `content_tag` (default: {}): + # :text - Text to copy (optional) + # :gfm - GitLab Flavored Markdown to copy, if different from `text` (optional) + # :target - Selector for target element to copy from (optional) # # Examples: # @@ -23,14 +23,10 @@ module ButtonHelper # 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. - text = data.delete(:text) - if text + if text = data.delete(:text) data[:clipboard_text] = if gfm = data.delete(:gfm) - { - text: text, - gfm: gfm, - } + { text: text, gfm: gfm } else text end diff --git a/changelogs/unreleased/dm-copy-diff-file-title-as-gfm.yml b/changelogs/unreleased/dm-copy-diff-file-title-as-gfm.yml index 54fd3f5c929..506883bc17d 100644 --- a/changelogs/unreleased/dm-copy-diff-file-title-as-gfm.yml +++ b/changelogs/unreleased/dm-copy-diff-file-title-as-gfm.yml @@ -1,4 +1,4 @@ --- -title: Copy diff file path as GFM -merge_request: +title: After copying a diff file or blob path, pasting it into a comment field will format it as Markdown. +merge_request: 9876 author: |