diff options
| author | Shishkevich D. <135337715+shishkevichd@users.noreply.github.com> | 2025-03-06 22:43:46 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-03-06 22:43:46 +0300 |
| commit | 2d8cca3a2ec1ae9034b7bc28a2fb5f2260f43e1a (patch) | |
| tree | d9b0f6b919d75d872b0c1a3cf30a4b009ccf21e5 /web/assets/js | |
| parent | cf7fec1351e44c624e599c226c35748f187ff8d1 (diff) | |
refactor: delete `clipboardjs` (#2727)
text copying can be done without using additional libraries
Diffstat (limited to 'web/assets/js')
| -rw-r--r-- | web/assets/js/util/common.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/web/assets/js/util/common.js b/web/assets/js/util/common.js index 779af0bf..df826aa9 100644 --- a/web/assets/js/util/common.js +++ b/web/assets/js/util/common.js @@ -64,6 +64,24 @@ function formatSecond(second) { } } +function copyToClipboard(text) { + // !! here old way of copying is used because not everyone can afford https connection + return new Promise((resolve) => { + const textarea = document.createElement("textarea"); + + textarea.value = text; + + document.body.appendChild(textarea); + + textarea.select(); + document.execCommand("copy"); + + document.body.removeChild(textarea); + + resolve(text) + }) +} + function addZero(num) { if (num < 10) { return "0" + num; |
