summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-01-24 09:04:25 +0000
committerPhil Hughes <me@iamphill.com>2018-01-24 09:04:25 +0000
commitde2c642199378a984832a717fc57a1719cd83d61 (patch)
treee995273258fbb1770db30e14068ffe77d3542b55
parent74da79113bb2eb7363403d7c2a9f1e0624590b74 (diff)
parent194e1b8f32618e60af0cf7767b6facecce40d74e (diff)
downloadgitlab-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.js7
-rw-r--r--changelogs/unreleased/32546-cannot-copy-paste-on-ios.yml5
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