diff --git a/assets/index.js b/assets/index.js
index e249c94..38b362c 100644
--- a/assets/index.js
+++ b/assets/index.js
@@ -63,6 +63,7 @@ const ICONS = {
delete: ``,
view: ``,
copyLink: ``,
+ copyLinkCheckmark: ``,
}
/**
@@ -474,7 +475,7 @@ function addPath(file, index) {
actionView = `${ICONS.view}`;
}
if (!isDir) {
- actionCopyLink = `
${ICONS.copyLink}
`;
+ actionCopyLink = `${ICONS.copyLink}
`;
}
let actionCell = `
@@ -658,12 +659,18 @@ async function setupEditorPage() {
/**
* Copy url to clipboard
+ * @param {HTMLElement} element - The clicked element
* @param {string} url
* @returns
*/
-async function copyLink(url) {
+async function copyLink(element, url) {
try {
await navigator.clipboard.writeText(url);
+ // show checkmark for 1 second
+ element.innerHTML = ICONS.copyLinkCheckmark;
+ setTimeout(() => {
+ element.innerHTML = ICONS.copyLink;
+ }, 1000);
} catch (err) {
alert(`Failed to copy link, ${err.message}`);
}
|