1
0
mirror of https://github.com/lus/pasty.git synced 2023-08-10 21:13:09 +03:00

Fix tabulator key input

This commit is contained in:
Lukas SP 2020-08-24 19:30:33 +02:00
parent fa7699d17b
commit a1cd915759
2 changed files with 7 additions and 2 deletions

View File

@ -56,6 +56,11 @@ async function loadPaste() {
const input = document.getElementById("input"); const input = document.getElementById("input");
input.classList.remove("hidden"); input.classList.remove("hidden");
input.focus(); input.focus();
window.addEventListener("keydown", function(event) {
if (event.keyCode != 9) return;
event.preventDefault();
input.value += " ";
});
} }
} }
spinner.surround(loadPaste); spinner.surround(loadPaste);

View File

@ -5,7 +5,7 @@ import * as spinner from "./spinner.js";
// setupKeybinds initializes the keybinds for the buttons // setupKeybinds initializes the keybinds for the buttons
export function setupKeybinds() { export function setupKeybinds() {
window.onkeydown = function(event) { window.addEventListener("keydown", function(event) {
// Return if the CTRL key was not pressed // Return if the CTRL key was not pressed
if (!event.ctrlKey) return; if (!event.ctrlKey) return;
@ -36,7 +36,7 @@ export function setupKeybinds() {
event.preventDefault(); event.preventDefault();
element.click(); element.click();
} }
} });
} }
// setupButtons configures the click listeners of the buttons // setupButtons configures the click listeners of the buttons