fix: 🐛 Fix copy button

This commit is contained in:
ThatOneCalculator 2022-03-21 16:18:37 -07:00
parent ec20eb89e3
commit bae89b7899
1 changed files with 14 additions and 7 deletions

View File

@ -220,14 +220,21 @@ editor.addEventListener(
false
)
copyButton.addEventListener("click", function () {
const content = editor.value
copyButton.addEventListener("click", async function () {
const path = window.location.pathname
const split = path.split("/")
const id = split[split.length - 1]
await getPaste(id, function (err, res) {
if (err) {
return
}
const content = res["data"]["content"]
window.history.pushState(null, "", "/")
newPaste()
window.history.pushState(null, "", "/")
newPaste()
rawContent = content
editor.value = content
rawContent = content
editor.value = content
})
})
newButton.addEventListener("click", function () {