diff options
author | Mike Greiling <mike@pixelcog.com> | 2017-11-29 00:34:51 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2017-11-29 00:37:58 +0300 |
commit | 2e5ce7e60f16c2e49178442ea065f5154b265d52 (patch) | |
tree | 6900beaf2215d1e61f6ca9696edcce34e04e3b34 /app/assets | |
parent | 7b893d1b52fa9df61739ce291c931338f95ef6d5 (diff) |
move copy_to_clipboard to behaviors directory as it is needed on all pages
[ci-skip]
Diffstat (limited to 'app/assets')
-rw-r--r-- | app/assets/javascripts/behaviors/copy_to_clipboard.js (renamed from app/assets/javascripts/copy_to_clipboard.js) | 4 | ||||
-rw-r--r-- | app/assets/javascripts/behaviors/index.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/main.js | 1 |
3 files changed, 4 insertions, 3 deletions
diff --git a/app/assets/javascripts/copy_to_clipboard.js b/app/assets/javascripts/behaviors/copy_to_clipboard.js index 35fd8087624..e61745c3be2 100644 --- a/app/assets/javascripts/copy_to_clipboard.js +++ b/app/assets/javascripts/behaviors/copy_to_clipboard.js @@ -35,7 +35,7 @@ function genericError(e) { showTooltip(e.trigger, `Press ${key}-C to copy`); } -$(() => { +export default function initCopyToClipboard() { const clipboard = new Clipboard('[data-clipboard-target], [data-clipboard-text]'); clipboard.on('success', genericSuccess); clipboard.on('error', genericError); @@ -70,4 +70,4 @@ $(() => { clipboardData.setData('text/plain', json.text); clipboardData.setData('text/x-gfm', json.gfm); }); -}); +} diff --git a/app/assets/javascripts/behaviors/index.js b/app/assets/javascripts/behaviors/index.js index 671532394a9..34e905222b4 100644 --- a/app/assets/javascripts/behaviors/index.js +++ b/app/assets/javascripts/behaviors/index.js @@ -1,6 +1,7 @@ import './autosize'; import './bind_in_out'; import initCopyAsGFM from './copy_as_gfm'; +import initCopyToClipboard from './copy_to_clipboard'; import './details_behavior'; import installGlEmojiElement from './gl_emoji'; import './quick_submit'; @@ -9,3 +10,4 @@ import './toggler_behavior'; installGlEmojiElement(); initCopyAsGFM(); +initCopyToClipboard(); diff --git a/app/assets/javascripts/main.js b/app/assets/javascripts/main.js index 08e326cba9c..f4da471a6c9 100644 --- a/app/assets/javascripts/main.js +++ b/app/assets/javascripts/main.js @@ -44,7 +44,6 @@ import './commits'; import './compare'; import './compare_autocomplete'; import './confirm_danger_modal'; -import './copy_to_clipboard'; import Flash, { removeFlashClickListener } from './flash'; import './gl_dropdown'; import './gl_field_error'; |