Skip to content
Snippets Groups Projects
Commit a6be67ec authored by Aaron Dötsch's avatar Aaron Dötsch
Browse files

Remove line splitting on login page

parent d0778790
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ import { browser } from "$app/environment"; ...@@ -2,7 +2,7 @@ import { browser } from "$app/environment";
const functions = new Map(); const functions = new Map();
export function addInputHandler(handler) { export function addInputHandler(handler, splitOnNewline = true) {
if(!browser) return; if(!browser) return;
let input = ""; let input = "";
const keydown = (e) => { const keydown = (e) => {
...@@ -21,7 +21,7 @@ export function addInputHandler(handler) { ...@@ -21,7 +21,7 @@ export function addInputHandler(handler) {
}; };
const paste = (e) => { const paste = (e) => {
const text = e.clipboardData.getData("text"); const text = e.clipboardData.getData("text");
const lines = text.split("\n"); const lines = splitOnNewline ? text.split("\n") : [text];
for(const line of lines) for(const line of lines)
if(line.length > 0) if(line.length > 0)
handler(line); handler(line);
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
}); });
} }
onMount(() => addInputHandler(login)); onMount(() => addInputHandler(login, false));
onDestroy(() => { onDestroy(() => {
removeInputHandler(login); removeInputHandler(login);
clearTimeout(timeout); clearTimeout(timeout);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment