Skip to content

Build your personal knowledge base with Trilium Notes

client/collections/board: trigger the column rename by double clicking on the column title

Adorian Doranae7f4f3d7b45
diff --git a/apps/client/src/widgets/collections/board/column.tsx b/apps/client/src/widgets/collections/board/column.tsx
index 28e2af1cae..a89ca3de3b 100644
--- a/apps/client/src/widgets/collections/board/column.tsx
+++ b/apps/client/src/widgets/collections/board/column.tsx
@@ -179,7 +179,14 @@ export default function Column({
{!isEditing ? (
<>
- <span className="title">
+ <span
+ className="title"
+ // In relation mode the title is a link to the note the column stands
+ // for, and the first of the two clicks has already followed it.
+ onDblClick={isInRelationMode
+ ? undefined
+ : () => setColumnNameToEdit(column)}
+ >
{isInRelationMode
? <NoteLink notePath={column} showNoteIcon />
: column}
diff --git a/apps/client/src/widgets/collections/board/index.spec.tsx b/apps/client/src/widgets/collections/board/index.spec.tsx
index d03d4e5bd0..53866b7f53 100644
--- a/apps/client/src/widgets/collections/board/index.spec.tsx
+++ b/apps/client/src/widgets/collections/board/index.spec.tsx
@@ -390,6 +390,19 @@ describe("Board column rename", () => {
expect(columnTitles(mountPoint)).toEqual([ "To Do", "Doing" ]);
});
+ it("opens the title editor when the title is double clicked", async () => {
+ const { container } = await setup();
+ const [ first ] = [ ...container.querySelectorAll<HTMLElement>(".board-column") ];
+
+ await act(async () => {
+ first.querySelector(".title")
+ ?.dispatchEvent(new MouseEvent("dblclick", { bubbles: true }));
+ });
+
+ expect(first.querySelector("h3")?.classList.contains("editing")).toBe(true);
+ expect(first.querySelector("h3 input")).not.toBeNull();
+ });
+
/** Renames the middle column, so a slot that is not the last one has to survive. */
async function renameSecondColumn(container: HTMLElement, newName: string) {
return renameColumnAt(container, 1, newName);