diff options
author | Phil Hughes <me@iamphill.com> | 2018-01-24 09:04:25 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-01-24 09:04:25 +0000 |
commit | de2c642199378a984832a717fc57a1719cd83d61 (patch) | |
tree | e995273258fbb1770db30e14068ffe77d3542b55 | |
parent | 74da79113bb2eb7363403d7c2a9f1e0624590b74 (diff) | |
parent | 194e1b8f32618e60af0cf7767b6facecce40d74e (diff) | |
download | gitlab-ce-de2c642199378a984832a717fc57a1719cd83d61.tar.gz |
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
-rw-r--r-- | app/assets/javascripts/behaviors/copy_as_gfm.js | 7 | ||||
-rw-r--r-- | changelogs/unreleased/32546-cannot-copy-paste-on-ios.yml | 5 |
2 files changed, 12 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); diff --git a/changelogs/unreleased/32546-cannot-copy-paste-on-ios.yml b/changelogs/unreleased/32546-cannot-copy-paste-on-ios.yml new file mode 100644 index 00000000000..f4c44983736 --- /dev/null +++ b/changelogs/unreleased/32546-cannot-copy-paste-on-ios.yml @@ -0,0 +1,5 @@ +--- +title: Fix copy/paste on iOS devices due to a bug in webkit +merge_request: 15804 +author: +type: fixed |