mirror of
https://github.com/LukeHagar/sveltesociety.dev.git
synced 2025-12-07 20:57:45 +00:00
Fix: copy install command not working on firefox
This commit is contained in:
@@ -11,17 +11,15 @@
|
|||||||
export let repo = "";
|
export let repo = "";
|
||||||
|
|
||||||
let clipboardCopy = false
|
let clipboardCopy = false
|
||||||
const copyToClipboard = (text) => {
|
const copyToClipboard = (text) => {
|
||||||
navigator.permissions.query({name: "clipboard-write"}).then(result => {
|
navigator.clipboard
|
||||||
if (result.state == "granted" || result.state == "prompt") {
|
.writeText(text)
|
||||||
navigator.clipboard.writeText(text)
|
.then(() => {
|
||||||
clipboardCopy = true
|
clipboardCopy = true;
|
||||||
setTimeout(() => {
|
setTimeout(() => (clipboardCopy = false), 1000);
|
||||||
clipboardCopy = false
|
})
|
||||||
}, 1000)
|
.catch(() => alert('Clipboard copy Permission denied'));
|
||||||
}
|
};
|
||||||
}).catch(() => alert("Clipboard copy Permission denied"));
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
Reference in New Issue
Block a user