History

Use navigator.clipboard.writeText

Simon Legner committed 1 year ago

Commit ba294a11 parent 34220e62 files · +3 −22Browse files

Showing the changes to assets/javascripts/lib (1 of 2 files). Show all

Unified · Split

assets/javascripts/lib/util.js+0−18
@@ -526,21 +526,3 @@ $.highlight = function (el, options) { · 525 unmodified lines
526526 el.classList.add(options.className);
527527 setTimeout(() => el.classList.remove(options.className), options.delay);
528528 };
529−
530−$.copyToClipboard = function (string) {
531− let result;
532− const textarea = document.createElement("textarea");
533− textarea.style.position = "fixed";
534− textarea.style.opacity = 0;
535− textarea.value = string;
536− document.body.appendChild(textarea);
537− try {
538− textarea.select();
539− result = !!document.execCommand("copy");
540− } catch (error) {
541− result = false;
542− } finally {
543− document.body.removeChild(textarea);
544− }
545− return result;
546−};