Skip to content

Build your personal knowledge base with Trilium Notes

custom task states: add documentation for the hidden tree

Adorian Doran72697a549b71
diff --git a/apps/server/src/assets/doc_notes/en/system_state.html b/apps/server/src/assets/doc_notes/en/system_state.html
new file mode 100644
index 0000000000..ee0c7b024d
--- /dev/null
+++ b/apps/server/src/assets/doc_notes/en/system_state.html
@@ -0,0 +1,3 @@
+<p>This is a built-in task state and cannot be edited or removed.</p>
+
+<p>Only its position can be changed, which determines its order in the checkbox toolbar and the keyboard cycle.</p>
diff --git a/packages/trilium-core/src/services/hidden_subtree.ts b/packages/trilium-core/src/services/hidden_subtree.ts
index 0b76190085..582e0711e4 100644
--- a/packages/trilium-core/src/services/hidden_subtree.ts
+++ b/packages/trilium-core/src/services/hidden_subtree.ts
@@ -97,10 +97,9 @@ function buildHiddenSubtreeDefinition(helpSubtree: HiddenSubtreeItem[]): HiddenS
{ type: "label", name: "child:label:isCompleted", value: `promoted,single,boolean,alias=${t("hidden-subtree.task-state-attr-is-completed")}` },
{ type: "label", name: "child:label:color", value: `promoted,single,color,alias=${t("hidden-subtree.task-state-attr-color")}` },
{ type: "label", name: "child:label:isHidden", value: `promoted,single,boolean,alias=${t("hidden-subtree.task-state-attr-is-hidden")}` },
- // Documentation: `docName` for this container, `child:docName` is
- // copied onto every state note (anchors, seeded and user-created).
- { type: "label", name: "docName", value: "task_states" },
- { type: "label", name: "child:docName", value: "task_state" }
+ // Documentation page for this container. The anchor states use
+ // `system_state`, custom states use `task_state` (see createTaskStateNote).
+ { type: "label", name: "docName", value: "task_states" }
],
// Non-customizable anchor states — recreated if missing; they only
// determine where `none`/`done` sit in the toolbar/cycling order.
@@ -110,7 +109,10 @@ function buildHiddenSubtreeDefinition(helpSubtree: HiddenSubtreeItem[]): HiddenS
title: t("hidden-subtree.task-state-none"),
type: "doc",
icon: "bx-checkbox",
- attributes: [{ type: "label", name: "hidePromotedAttributes" }]
+ attributes: [
+ { type: "label", name: "hidePromotedAttributes" },
+ { type: "label", name: "docName", value: "system_state" }
+ ]
},
{
id: "_taskStateDone",
@@ -119,7 +121,8 @@ function buildHiddenSubtreeDefinition(helpSubtree: HiddenSubtreeItem[]): HiddenS
icon: "bx-check",
attributes: [
{ type: "label", name: "hidePromotedAttributes" },
- { type: "label", name: "color", value: "#4de64d" }
+ { type: "label", name: "color", value: "#4de64d" },
+ { type: "label", name: "docName", value: "system_state" }
]
}
]
diff --git a/packages/trilium-core/src/services/task_states.ts b/packages/trilium-core/src/services/task_states.ts
index 6003c42c6a..537feac62b 100644
--- a/packages/trilium-core/src/services/task_states.ts
+++ b/packages/trilium-core/src/services/task_states.ts
@@ -70,7 +70,8 @@ export function createTaskStateNote(state: TaskStateDef, options: {noteId?: stri
stateId: state.name,
markdownSymbol: state.markdownSymbol,
isCompleted: String(state.isCompleted),
- color: state.color
+ color: state.color,
+ docName: "task_state"
};
for (const [name, value] of Object.entries(labels)) {