Skip to content

Build your personal knowledge base with Trilium Notes

client/text editor/custom task states: specify the state name as a tooltip for static HTML rendition

Adorian Doran423005e7bdca
diff --git a/packages/ckeditor5/src/plugins/todo_list_multistate/todo_list_multistate_editing.ts b/packages/ckeditor5/src/plugins/todo_list_multistate/todo_list_multistate_editing.ts
index b87231be67..537d188994 100644
--- a/packages/ckeditor5/src/plugins/todo_list_multistate/todo_list_multistate_editing.ts
+++ b/packages/ckeditor5/src/plugins/todo_list_multistate/todo_list_multistate_editing.ts
@@ -138,6 +138,23 @@ export default class TodoListMultistateEditing extends Plugin {
} else {
writer.removeClass("tn-unknown-task-state", element);
}
+
+ // Data pipeline only: emit a native `title` tooltip so viewers of
+ // the shared page, the read-only preview, and exported HTML see
+ // the state's human name when they hover the task item. Skipped
+ // for anchor states (`none`/`done` — no explanation needed) and
+ // for unknown states (no definition to name). We intentionally
+ // do NOT set `title` in the editing pipeline: CKEditor's own
+ // hover would then race the plugin's Bootstrap tooltip.
+ const stateDef = typeof value === "string" && !isAnchorState(value)
+ ? stateByName.get(value)
+ : undefined;
+ const title = stateDef?.title || stateDef?.name;
+ if (title && options?.dataPipeline) {
+ writer.setAttribute("title", title, element);
+ } else {
+ writer.removeAttribute("title", element);
+ }
}
});