diff options
author | Phil Hughes <me@iamphill.com> | 2018-01-24 12:04:25 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-01-24 12:04:25 +0300 |
commit | de2c642199378a984832a717fc57a1719cd83d61 (patch) | |
tree | e995273258fbb1770db30e14068ffe77d3542b55 /app/assets/javascripts | |
parent | 74da79113bb2eb7363403d7c2a9f1e0624590b74 (diff) | |
parent | 194e1b8f32618e60af0cf7767b6facecce40d74e (diff) |
Merge branch '32546-cannot-copy-paste-on-ios' into 'master'
Resolve "Cannot copy/paste on iOS"
Closes #32546
See merge request gitlab-org/gitlab-ce!15804
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/behaviors/copy_as_gfm.js | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/assets/javascripts/behaviors/copy_as_gfm.js b/app/assets/javascripts/behaviors/copy_as_gfm.js index c6eca72c51b..ffe90595b5d 100644 --- a/app/assets/javascripts/behaviors/copy_as_gfm.js +++ b/app/assets/javascripts/behaviors/copy_as_gfm.js @@ -299,6 +299,13 @@ const gfmRules = { export class CopyAsGFM { constructor() { + // iOS currently does not support clipboardData.setData(). This bug should + // be fixed in iOS 12, but for now we'll disable this for all iOS browsers + // ref: https://trac.webkit.org/changeset/222228/webkit + const userAgent = (typeof navigator !== 'undefined' && navigator.userAgent) || ''; + const isIOS = /\b(iPad|iPhone|iPod)(?=;)/.test(userAgent); + if (isIOS) return; + $(document).on('copy', '.md, .wiki', (e) => { CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformGFMSelection); }); $(document).on('copy', 'pre.code.highlight, .diff-content .line_content', (e) => { CopyAsGFM.copyAsGFM(e, CopyAsGFM.transformCodeSelection); }); $(document).on('paste', '.js-gfm-input', CopyAsGFM.pasteGFM); |