From 2d8cca3a2ec1ae9034b7bc28a2fb5f2260f43e1a Mon Sep 17 00:00:00 2001 From: "Shishkevich D." <135337715+shishkevichd@users.noreply.github.com> Date: Fri, 7 Mar 2025 02:43:46 +0700 Subject: refactor: delete `clipboardjs` (#2727) text copying can be done without using additional libraries --- web/assets/js/util/common.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'web/assets/js') 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; -- cgit v1.2.3