save typed reply to localStorage in thread
This commit is contained in:
parent
502f1c59de
commit
973274fed3
@ -8,6 +8,24 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const inThread = () => {
|
||||||
|
const scheme = window.location.pathname.split("/");
|
||||||
|
return scheme[1] === "threads" && scheme[2] !== "create";
|
||||||
|
}
|
||||||
|
|
||||||
|
ta.addEventListener("input", () => {
|
||||||
|
if (!inThread()) return;
|
||||||
|
|
||||||
|
localStorage.setItem(window.location.pathname, ta.value);
|
||||||
|
})
|
||||||
|
|
||||||
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
|
if (!inThread()) return;
|
||||||
|
const prevContent = localStorage.getItem(window.location.pathname);
|
||||||
|
if (!prevContent) return;
|
||||||
|
ta.value = prevContent;
|
||||||
|
})
|
||||||
|
|
||||||
const buttonBold = document.getElementById("post-editor-bold");
|
const buttonBold = document.getElementById("post-editor-bold");
|
||||||
const buttonItalics = document.getElementById("post-editor-italics");
|
const buttonItalics = document.getElementById("post-editor-italics");
|
||||||
const buttonStrike = document.getElementById("post-editor-strike");
|
const buttonStrike = document.getElementById("post-editor-strike");
|
||||||
|
Loading…
Reference in New Issue
Block a user