Fix stripping newlines from input text
This commit is contained in:
@@ -33,7 +33,7 @@ console.log(request);
|
|||||||
if (form) {
|
if (form) {
|
||||||
form.addEventListener("submit", (e) => {
|
form.addEventListener("submit", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const note = document.querySelector("#note");
|
const note: HTMLElement | null = document.querySelector("#note");
|
||||||
if (!note) {
|
if (!note) {
|
||||||
console.error("No note found");
|
console.error("No note found");
|
||||||
return;
|
return;
|
||||||
@@ -41,22 +41,22 @@ console.log(request);
|
|||||||
|
|
||||||
fetch(window.location.href, {
|
fetch(window.location.href, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: note.textContent,
|
body: note.innerText,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.status != 200) {
|
if (res.status != 200) {
|
||||||
console.error(res);
|
console.error(res);
|
||||||
const err = res.statusText;
|
const err = res.statusText;
|
||||||
const kaput = document.querySelector("#kaput");
|
const kaput: HTMLElement | null = document.querySelector("#kaput");
|
||||||
if (!kaput) {
|
if (!kaput) {
|
||||||
console.error("No kaput found");
|
console.error("No kaput found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
kaput?.classList.remove("display-none");
|
kaput?.classList.remove("display-none");
|
||||||
kaput.textContent = err;
|
kaput.innerText = err;
|
||||||
} else {
|
} else {
|
||||||
const kaput = document.querySelector("#kaput");
|
const kaput = document.querySelector("#kaput");
|
||||||
kaput?.classList.add("display-none");
|
kaput?.classList.add("display-none");
|
||||||
note.textContent = "";
|
note.innerText = "";
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user