From fee822c689e4b8a10f877e6da223def7a2e83553 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 11 Sep 2025 20:32:21 +0300 Subject: [PATCH] chore(react/collections/table): slightly improve editing experience --- .../src/widgets/collections/board/index.tsx | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/client/src/widgets/collections/board/index.tsx b/apps/client/src/widgets/collections/board/index.tsx index 13e15db5e..3547257b0 100644 --- a/apps/client/src/widgets/collections/board/index.tsx +++ b/apps/client/src/widgets/collections/board/index.tsx @@ -375,6 +375,7 @@ function Card({ const { branchIdToEdit } = useContext(BoardViewContext); const isEditing = branch.branchId === branchIdToEdit; const colorClass = note.getColorClass() || ''; + const editorRef = useRef(null); const handleDragStart = useCallback((e: DragEvent) => { e.dataTransfer!.effectAllowed = 'move'; @@ -390,6 +391,10 @@ function Card({ openNoteContextMenu(api, e, note.noteId, branch.branchId, column); }, [ api, note, branch, column ]); + useEffect(() => { + editorRef.current?.focus(); + }, []); + return (
{note.title} ) : ( { if (e.key === "Enter") { - api.renameCard(note.noteId, e.currentTarget.value); + const newTitle = e.currentTarget.value; + if (newTitle !== note.title) { + api.renameCard(note.noteId, newTitle); + } api.dismissEditingTitle(); } @@ -414,6 +423,12 @@ function Card({ api.dismissEditingTitle(); } }} + onBlur={(newTitle) => { + if (newTitle !== note.title) { + api.renameCard(note.noteId, newTitle); + } + api.dismissEditingTitle(); + }} /> )}