Skip to content

Build your personal knowledge base with Trilium Notes

feat(client/tasks): create task list note type

Elian Doran102473325291
diff --git a/src/public/app/entities/fnote.ts b/src/public/app/entities/fnote.ts
index 2e02931120..ec200bdfab 100644
--- a/src/public/app/entities/fnote.ts
+++ b/src/public/app/entities/fnote.ts
@@ -28,7 +28,8 @@ const NOTE_TYPE_ICONS = {
doc: "bx bxs-file-doc",
contentWidget: "bx bxs-widget",
mindMap: "bx bx-sitemap",
- geoMap: "bx bx-map-alt"
+ geoMap: "bx bx-map-alt",
+ taskList: "bx bx-list-check"
};
/**
@@ -36,7 +37,7 @@ const NOTE_TYPE_ICONS = {
* end user. Those types should be used only for checking against, they are
* not for direct use.
*/
-export type NoteType = "file" | "image" | "search" | "noteMap" | "launcher" | "doc" | "contentWidget" | "text" | "relationMap" | "render" | "canvas" | "mermaid" | "book" | "webView" | "code" | "mindMap" | "geoMap";
+export type NoteType = "file" | "image" | "search" | "noteMap" | "launcher" | "doc" | "contentWidget" | "text" | "relationMap" | "render" | "canvas" | "mermaid" | "book" | "webView" | "code" | "mindMap" | "geoMap" | "taskList";
export interface NotePathRecord {
isArchived: boolean;
diff --git a/src/public/app/services/note_types.ts b/src/public/app/services/note_types.ts
index 7aebd48ffb..fc6e7bed6b 100644
--- a/src/public/app/services/note_types.ts
+++ b/src/public/app/services/note_types.ts
@@ -20,6 +20,7 @@ async function getNoteTypeItems(command?: NoteTypeCommandNames) {
{ title: t("note_types.web-view"), command, type: "webView", uiIcon: "bx bx-globe-alt" },
{ title: t("note_types.mind-map"), command, type: "mindMap", uiIcon: "bx bx-sitemap" },
{ title: t("note_types.geo-map"), command, type: "geoMap", uiIcon: "bx bx-map-alt" },
+ { title: t("note_types.task-list"), command, type: "taskList", uiIcon: "bx bx-list-check" }
];
const templateNoteIds = await server.get<string[]>("search-templates");
diff --git a/src/public/app/widgets/note_detail.ts b/src/public/app/widgets/note_detail.ts
index afd51a6aef..a16de3ecea 100644
--- a/src/public/app/widgets/note_detail.ts
+++ b/src/public/app/widgets/note_detail.ts
@@ -35,6 +35,7 @@ import GeoMapTypeWidget from "./type_widgets/geo_map.js";
import utils from "../services/utils.js";
import type { NoteType } from "../entities/fnote.js";
import type TypeWidget from "./type_widgets/type_widget.js";
+import TaskListWidget from "./type_widgets/task_list.js";
const TPL = `
<div class="note-detail">
@@ -72,7 +73,8 @@ const typeWidgetClasses = {
attachmentDetail: AttachmentDetailTypeWidget,
attachmentList: AttachmentListTypeWidget,
mindMap: MindMapWidget,
- geoMap: GeoMapTypeWidget
+ geoMap: GeoMapTypeWidget,
+ taskList: TaskListWidget
};
/**
diff --git a/src/public/app/widgets/note_type.ts b/src/public/app/widgets/note_type.ts
index 9b3b906650..1824974fd5 100644
--- a/src/public/app/widgets/note_type.ts
+++ b/src/public/app/widgets/note_type.ts
@@ -48,7 +48,8 @@ const NOTE_TYPES: NoteTypeMapping[] = [
{ type: "image", title: t("note_types.image"), selectable: false },
{ type: "launcher", mime: "", title: t("note_types.launcher"), selectable: false },
{ type: "noteMap", mime: "", title: t("note_types.note-map"), selectable: false },
- { type: "search", title: t("note_types.saved-search"), selectable: false }
+ { type: "search", title: t("note_types.saved-search"), selectable: false },
+ { type: "taskList", title: t("note_types.task-list"), selectable: false }
];
const NOT_SELECTABLE_NOTE_TYPES = NOTE_TYPES.filter((nt) => !nt.selectable).map((nt) => nt.type);
diff --git a/src/public/app/widgets/type_widgets/task_list.ts b/src/public/app/widgets/type_widgets/task_list.ts
new file mode 100644
index 0000000000..30a5572a21
--- /dev/null
+++ b/src/public/app/widgets/type_widgets/task_list.ts
@@ -0,0 +1,26 @@
+import type FNote from "../../entities/fnote.js";
+import TypeWidget from "./type_widget.js";
+
+const TPL = `
+<div class="note-detail-task-list note-detail-printable">
+ Task list goes here.
+</div>
+`;
+
+export default class TaskListWidget extends TypeWidget {
+
+ static getType() { return "taskList" }
+
+ doRender() {
+ this.$widget = $(TPL);
+ }
+
+ async doRefresh(note: FNote) {
+ this.$widget.show();
+
+ if (!this.note) {
+ return;
+ }
+ }
+
+}
diff --git a/src/public/translations/en/translation.json b/src/public/translations/en/translation.json
index 1a5d92b324..feaba40ef4 100644
--- a/src/public/translations/en/translation.json
+++ b/src/public/translations/en/translation.json
@@ -1416,7 +1416,8 @@
"widget": "Widget",
"confirm-change": "It is not recommended to change note type when note content is not empty. Do you want to continue anyway?",
"geo-map": "Geo Map",
- "beta-feature": "Beta"
+ "beta-feature": "Beta",
+ "task-list": "To-Do List"
},
"protect_note": {
"toggle-on": "Protect the note",
diff --git a/src/services/note_types.ts b/src/services/note_types.ts
index 3e086acf4f..46a2e01a92 100644
--- a/src/services/note_types.ts
+++ b/src/services/note_types.ts
@@ -15,7 +15,8 @@ const noteTypes = [
{ type: "doc", defaultMime: "" },
{ type: "contentWidget", defaultMime: "" },
{ type: "mindMap", defaultMime: "application/json" },
- { type: "geoMap", defaultMime: "application/json" }
+ { type: "geoMap", defaultMime: "application/json" },
+ { type: "taskList", defaultMime: "" }
];
function getDefaultMimeForNoteType(typeName: string) {