Fix stripping newlines from input text

This commit is contained in:
2024-11-04 18:58:27 +01:00
parent c7db2be6d0
commit ebe4868645

View File

@@ -33,7 +33,7 @@ console.log(request);
if (form) {
form.addEventListener("submit", (e) => {
e.preventDefault();
const note = document.querySelector("#note");
const note: HTMLElement | null = document.querySelector("#note");
if (!note) {
console.error("No note found");
return;
@@ -41,22 +41,22 @@ console.log(request);
fetch(window.location.href, {
method: "POST",
body: note.textContent,
body: note.innerText,
}).then((res) => {
if (res.status != 200) {
console.error(res);
const err = res.statusText;
const kaput = document.querySelector("#kaput");
const kaput: HTMLElement | null = document.querySelector("#kaput");
if (!kaput) {
console.error("No kaput found");
return;
}
kaput?.classList.remove("display-none");
kaput.textContent = err;
kaput.innerText = err;
} else {
const kaput = document.querySelector("#kaput");
kaput?.classList.add("display-none");
note.textContent = "";
note.innerText = "";
window.location.reload();
}
});