Bugzilla – Attachment 117310 Details for
Bug 27594
Add access to public download link for publicly-accessible uploads
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27594: (QA follow-up): Use clipboard API
Bug-27594-QA-follow-up-Use-clipboard-API.patch (text/plain), 2.97 KB, created by
Owen Leonard
on 2021-02-25 13:30:38 UTC
(
hide
)
Description:
Bug 27594: (QA follow-up): Use clipboard API
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2021-02-25 13:30:38 UTC
Size:
2.97 KB
patch
obsolete
>From 8cf0cd5a47dfc04dd5a83a152c3323b0720f80fb Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Thu, 25 Feb 2021 13:21:32 +0000 >Subject: [PATCH] Bug 27594: (QA follow-up): Use clipboard API > >While the Clipboard API doesn't >have 100% coverage (https://www.caniuse.com/?search=clipboard), it has >enough coverage for the "copy" operation that it can be counted on for >use in the staff interface. > >This patch removes the global copyToClipboard function and replaces it >with a call to ndavigator.clipboard.writeText() in the template. > >To test, follow the previous test plan and confirm that the public >download link is still copied correctly to the clipboard. >--- > koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt | 4 +++- > koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 13 ------------- > 2 files changed, 3 insertions(+), 14 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >index 2b2f38160c..d4468dfb54 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/upload.tt >@@ -438,7 +438,9 @@ > > $(".get-file").on("click", function(e){ > e.preventDefault(); >- copyToClipboard( $(this).attr("href") ); >+ if( navigator.clipboard ){ >+ navigator.clipboard.writeText( $(this).attr("href") ); >+ } > $(this).attr("data-original-title", _( "Link copied to the clipboard" ) ) > .tooltip("show"); > }); >diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >index 7411567556..04e1c6176f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js >@@ -358,16 +358,3 @@ function saveOrClearSimpleSearchParams() { > localStorage.setItem('cat_search_pulldown_selection', pulldown_selection ); > localStorage.setItem('searchbox_value', searchbox_value ); > } >- >-// https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f >-function copyToClipboard( text ){ >- var el = document.createElement("textarea"); // Create a <textarea> element >- el.value = text; // Set its value to the string that you want copied >- el.setAttribute("readonly", ""); // Make it readonly to be tamper-proof >- el.style.position = "absolute"; >- el.style.left = "-9999px"; // Move outside the screen to make it invisible >- document.body.appendChild(el); // Append the <textarea> element to the HTML document >- el.select(); // Select the <textarea> content >- document.execCommand("copy"); // Copy - only works as a result of a user action (e.g. click events) >- document.body.removeChild(el); // Remove the <textarea> element >-} >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27594
:
116218
|
116219
|
117289
|
117310
|
119241
|
119304
|
119305
|
119398
|
119906
|
119995
|
119996
|
119997
|
120416