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!")
|
||||
}
|
||||
|
||||
if (navigator.canShare) {
|
||||
show(shareButton)
|
||||
|
||||
shareButton.addEventListener("click", function () {
|
||||
show(shareButton)
|
||||
shareButton.addEventListener("click", function () {
|
||||
const url = window.location.toString()
|
||||
if (navigator.canShare) {
|
||||
navigator.share({
|
||||
title: "zer0bin paste",
|
||||
url: window.location.toString(),
|
||||
url: url,
|
||||
})
|
||||
})
|
||||
}
|
||||
} else {
|
||||
navigator.clipboard.writeText(url)
|
||||
addMessage("Copied URL to clipboard!")
|
||||
}
|
||||
})
|
||||
|
||||
disable(saveButton)
|
||||
disable(markdownButton)
|
||||
|
|
Loading…
Reference in New Issue