🐛 fix: #57 fixed

This commit is contained in:
Dominic Harris 2022-04-06 11:35:07 -04:00
parent b5978aab45
commit 1dabd0a670
No known key found for this signature in database
GPG Key ID: 93CCF85F3E2A4F65
3 changed files with 11 additions and 4 deletions

View File

@ -38,7 +38,7 @@ html(lang='en')
a.logo.noselect(href='/') zer0bin
.buttons.noselect
button#save-button.btn(aria-label='Save')
button#copy-button.btn(aria-label='Copy')
button#duplicate-button.btn(aria-label='Duplicate')
button#new-button.btn(aria-label='New paste')
button#markdown-button.btn(aria-label='Markdown')

View File

@ -20,7 +20,7 @@ import { IconDefinition } from "@ant-design/icons-svg/lib/types"
const saveButton = <HTMLButtonElement>document.getElementById("save-button")
const newButton = <HTMLButtonElement>document.getElementById("new-button")
const copyButton = <HTMLButtonElement>document.getElementById("copy-button")
const copyButton = <HTMLButtonElement>document.getElementById("duplicate-button")
const hideButton = <HTMLButtonElement>document.getElementById("hide-button")
const githubButton = <HTMLButtonElement>document.getElementById("github-button")
const shareButton = <HTMLButtonElement>document.getElementById("share-button")
@ -85,7 +85,7 @@ tippy("#new-button", {
allowHTML: true,
})
tippy("#copy-button", {
tippy("#duplicate-button", {
content: "Duplicate paste<br><span class='keybind'>Ctrl + D</span>",
placement: "bottom",
animation: "scale",

View File

@ -33,7 +33,7 @@ const viewCounter = <HTMLSpanElement>(
)
const saveButton = <HTMLButtonElement>document.getElementById("save-button")
const newButton = <HTMLButtonElement>document.getElementById("new-button")
const copyButton = <HTMLButtonElement>document.getElementById("copy-button")
const copyButton = <HTMLButtonElement>document.getElementById("duplicate-button")
const hideButton = <HTMLButtonElement>document.getElementById("hide-button")
const shareButton = <HTMLButtonElement>document.getElementById("share-button")
const markdownButton = <HTMLButtonElement>(
@ -273,15 +273,22 @@ saveButton.addEventListener("click", async function () {
document.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.key === "s") {
if(saveButton.disabled) { return; }
e.preventDefault()
savePaste()
} else if (e.ctrlKey && e.key === "n") {
if(newButton.disabled) { return; }
e.preventDefault()
newPaste()
} else if (e.ctrlKey && e.key === "d") {
if (duplicatePaste.disabled) { return; }
e.preventDefault()
duplicatePaste()
} else if (e.ctrlKey && e.key === "m") {
e.preventDefault()
toggleMarkdown()
}