diff --git a/frontend.ts b/frontend.ts index 0485d09..7746e88 100644 --- a/frontend.ts +++ b/frontend.ts @@ -1,4 +1,4 @@ -document.addEventListener('DOMContentLoaded', () => { + const inputElement = document.getElementById('input')as HTMLFormElement; const box = document.getElementById('response_text')as HTMLFormElement; @@ -22,13 +22,20 @@ inputElement.addEventListener('keydown', function(event) { function convert_form(): string { const user_input = inputElement.value; - const converted_user_input = user_input.replace(/ /g, ""); + if (user_input == "") { - box.textContent = converted_user_input; + return "error"; + } else { + const converted_user_input = user_input.replace(/ /g, ""); - inputElement.value = ''; - - return converted_user_input; + box.textContent = converted_user_input; + + inputElement.value = ''; + + copy_to_clipboard(); + + return converted_user_input;} + } @@ -39,4 +46,3 @@ function copy_to_clipboard() { } -}); \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index c965477..66d2b98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,9 +1,13 @@ { "name": "web_tool", + "version": "1.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { + "name": "web_tool", + "version": "1.0.0", + "license": "ISC", "dependencies": { "express": "^5.1.0" }, diff --git a/package.json b/package.json index 045e416..55c8753 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,4 @@ "author": "", "license": "ISC", "type": "commonjs" - - }