add set current date button to blog editor
This commit is contained in:
parent
0c2aaa0b38
commit
09c09b6310
3 changed files with 14 additions and 0 deletions
|
|
@ -32,6 +32,11 @@ input[type="text"] {
|
|||
margin-top: 0;
|
||||
}
|
||||
|
||||
#blogpost button#set-current-date {
|
||||
margin: 0 .5em;
|
||||
padding: .4em .8em;
|
||||
}
|
||||
|
||||
#blogpost h2 {
|
||||
margin: 0;
|
||||
font-size: 2em;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
const blogID = document.getElementById("blogpost").dataset.id;
|
||||
const titleInput = document.getElementById("title");
|
||||
const publishDateInput = document.getElementById("publish-date");
|
||||
const setCurrentDateBtn = document.getElementById("set-current-date");
|
||||
const descInput = document.getElementById("description");
|
||||
const mdInput = document.getElementById("markdown");
|
||||
const blueskyActorInput = document.getElementById("bluesky-actor");
|
||||
|
|
@ -11,6 +12,13 @@ const visInput = document.getElementById("visibility");
|
|||
const saveBtn = document.getElementById("save");
|
||||
const deleteBtn = document.getElementById("delete");
|
||||
|
||||
setCurrentDateBtn.addEventListener("click", () => {
|
||||
let now = new Date;
|
||||
now.setMinutes(now.getMinutes() - now.getTimezoneOffset());
|
||||
publishDateInput.value = now.toISOString().slice(0, 16);
|
||||
saveBtn.disabled = false;
|
||||
});
|
||||
|
||||
saveBtn.addEventListener("click", () => {
|
||||
fetch("/api/v1/blog/" + blogID, {
|
||||
method: "PUT",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue