mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-17 07:12:30 +08:00
feat(tasks): display due date in editable textbox
This commit is contained in:
parent
fcd7b986aa
commit
637ba78100
@ -78,10 +78,10 @@ function buildTasks(tasks: FTask[]) {
|
|||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildEditContainer() {
|
function buildEditContainer(task: FTask) {
|
||||||
return `\
|
return `\
|
||||||
<label>Due date:</label>
|
<label>Due date:</label>
|
||||||
<input type="date" data-tasks-role="due-date" />
|
<input type="date" data-tasks-role="due-date" value="${task.dueDate ?? ""}" />
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,18 +130,15 @@ export default class TaskListWidget extends TypeWidget {
|
|||||||
|
|
||||||
// Add the new edit container.
|
// Add the new edit container.
|
||||||
const $editContainer = $target.find(".edit-container");
|
const $editContainer = $target.find(".edit-container");
|
||||||
$editContainer.html(buildEditContainer());
|
const task = this.#getCorrespondingTask($target);
|
||||||
|
if (task) {
|
||||||
|
$editContainer.html(buildEditContainer(task));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.$taskContainer.on("change", "input", async (e) => {
|
this.$taskContainer.on("change", "input", async (e) => {
|
||||||
const $target = $(e.target);
|
const $target = $(e.target);
|
||||||
const taskId = $target.closest("li")[0].dataset.taskId;
|
const task = this.#getCorrespondingTask($target);
|
||||||
if (!taskId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const task = froca.getTask(taskId);
|
|
||||||
|
|
||||||
if (!task) {
|
if (!task) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -159,6 +156,15 @@ export default class TaskListWidget extends TypeWidget {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#getCorrespondingTask($target: JQuery<HTMLElement>) {
|
||||||
|
const taskId = $target.closest("li")[0].dataset.taskId;
|
||||||
|
if (!taskId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return froca.getTask(taskId);
|
||||||
|
}
|
||||||
|
|
||||||
async #createNewTask(title: string) {
|
async #createNewTask(title: string) {
|
||||||
if (!title || !this.noteId) {
|
if (!title || !this.noteId) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user