diff options
author | Simon Knox <psimyn@gmail.com> | 2017-04-21 00:40:48 +0300 |
---|---|---|
committer | Simon Knox <psimyn@gmail.com> | 2017-04-21 00:43:42 +0300 |
commit | ae2e0b691548d3b4dcb6dc29ce21482a3d616d72 (patch) | |
tree | 03bdd44cc64ee5723314ae8651b8883628eafe0d /app/assets/javascripts/lib | |
parent | bbd83376d625b8d9cb73cbc83c3c0eb71b1abf32 (diff) |
fix inline diff copying in firefox
Diffstat (limited to 'app/assets/javascripts/lib')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index 01c4b9821d3..8058672eaa9 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -169,7 +169,10 @@ w.gl.utils.getSelectedFragment = () => { const selection = window.getSelection(); if (selection.rangeCount === 0) return null; - const documentFragment = selection.getRangeAt(0).cloneContents(); + const documentFragment = document.createDocumentFragment(); + for (let i = 0; i < selection.rangeCount; i += 1) { + documentFragment.appendChild(selection.getRangeAt(i).cloneContents()); + } if (documentFragment.textContent.length === 0) return null; return documentFragment; |