mirror of https://github.com/zer0bin-dev/zer0bin
feat: ✨ Share button = copy to clipboard if no sharenav
This commit is contained in:
parent
fff67c1a43
commit
648b6aac4e
|
@ -167,16 +167,19 @@ function viewPaste(content: string, views: string, singleView: boolean) {
|
||||||
addMessage("This is a single-view paste!")
|
addMessage("This is a single-view paste!")
|
||||||
}
|
}
|
||||||
|
|
||||||
if (navigator.canShare) {
|
show(shareButton)
|
||||||
show(shareButton)
|
shareButton.addEventListener("click", function () {
|
||||||
|
const url = window.location.toString()
|
||||||
shareButton.addEventListener("click", function () {
|
if (navigator.canShare) {
|
||||||
navigator.share({
|
navigator.share({
|
||||||
title: "zer0bin paste",
|
title: "zer0bin paste",
|
||||||
url: window.location.toString(),
|
url: url,
|
||||||
})
|
})
|
||||||
})
|
} else {
|
||||||
}
|
navigator.clipboard.writeText(url)
|
||||||
|
addMessage("Copied URL to clipboard!")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
disable(saveButton)
|
disable(saveButton)
|
||||||
disable(markdownButton)
|
disable(markdownButton)
|
||||||
|
|
Loading…
Reference in New Issue