Skip to content

Build your personal knowledge base with Trilium Notes

feat(tasks): store parent note ID

Elian Doranbb822126cda4
diff --git a/src/public/app/services/tasks.ts b/src/public/app/services/tasks.ts
index 400e947126..becf7fd25c 100644
--- a/src/public/app/services/tasks.ts
+++ b/src/public/app/services/tasks.ts
@@ -1,7 +1,13 @@
import server from "./server.js";
-export async function createNewTask(title: string) {
+interface CreateNewTasksOpts {
+ parentNoteId: string;
+ title: string;
+}
+
+export async function createNewTask({ parentNoteId, title }: CreateNewTasksOpts) {
await server.post(`tasks`, {
+ parentNoteId,
title
});
}
diff --git a/src/public/app/widgets/type_widgets/task_list.ts b/src/public/app/widgets/type_widgets/task_list.ts
index b54ee35c70..a91d9879ec 100644
--- a/src/public/app/widgets/type_widgets/task_list.ts
+++ b/src/public/app/widgets/type_widgets/task_list.ts
@@ -95,11 +95,14 @@ export default class TaskListWidget extends TypeWidget {
}
async #createNewTask(title: string) {
- if (!title) {
+ if (!title || !this.noteId) {
return;
}
- await taskService.createNewTask(title);
+ await taskService.createNewTask({
+ title,
+ parentNoteId: this.noteId
+ });
}
async doRefresh(note: FNote) {