Add drag-and-drop reordering for note tabs, and a user-facing guide

Tabs can now be dragged to reorder within a group and to move between
sections in one gesture: dropping on a tab's left/right half inserts
before/after it and adopts that tab's section, while a dedicated zone
past the last group ungroups and appends at the end. A blue indicator
line shows the drop position while dragging.

core/notes.reorder() takes the full new page-id order computed
client-side (NotePanel.vue has the reactive list already) rather than
recomputing positions server-side, validates it against the current
page-id set, sets the moved page's section, then renumbers position.
POST /api/notes/reorder exposes it.

Also adds docs/notes-guide.md, an end-user walkthrough of the shared
notes panel (pages, sections, drag-and-drop, AI interaction) — the
existing docs were all developer-facing specs with no operating
instructions for the feature itself.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-20 07:27:38 +09:00
co-authored by Claude Opus 5
parent 1c21fc3406
commit 8b2231ea97
8 changed files with 245 additions and 3 deletions
+18
View File
@@ -306,3 +306,21 @@ export async function renameNoteSection(oldName: string, newName: string | null)
})
return parseJson<{ renamed: number }>(res, 'セクション名変更')
}
/**
* タブのドラッグ&ドロップによる並べ替えをサーバーへ反映する。
* order には全ページIDをドラッグ後の新しい順序で渡す。pageId のページは section へ移動する
* (ドロップ先のタブと同じセクションを渡せば、その場でセクション間の移動を兼ねる)。
*/
export async function reorderNotePages(
pageId: number,
section: string | null,
order: number[],
): Promise<{ reordered: number }> {
const res = await fetch(`${BASE}/api/notes/reorder`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ page_id: pageId, section, order }),
})
return parseJson<{ reordered: number }>(res, 'ノート並べ替え')
}