✨ 一覧のドラッグ&ドロップ並べ替え(ピン/非ピングループ独立)#26
Merged
Merged
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
何を
サイドバー一覧のスニペットをドラッグ&ドロップで並べ替えられるようにしました。
ピン留めグループと非ピングループは独立して扱われます: 同じグループの項目の上でだけドロップを受け付けるため、ドラッグでグループを跨ぐことはできません(ピン状態はピンボタンでのみ切り替え)。
Workers 版 (html-vault-worker#2) と同じ機能の移植で、同 #3 のスナップバック(ドロップ解放時に残像が元の位置へ飛んで戻るアニメーション)抑止も最初から含んでいます。
なぜ
更新日時順の自動並びだけでは、よく使うスニペットを意図した順に並べられないため。
変更内容
orderを追加。ソートは「ピン留め先頭 → グループ内はorder昇順(未設定は-updatedフォールバック)」に変更PUT /api/snippets/orderを追加(セッション+CSRF必須)。表示順の完全なID列を受け取り各スニペットのorderに位置を保存。ID形式(16進32文字)を全件バリデーション/api/snippets/:id(PUT) より先に登録.itemに HTML5 Drag & Drop を実装。ドラッグ中は DOM を直接動かしてライブプレビューし、dragend で確定順を保存dragoverで「ドラッグ元とドロップ先のpinnedが一致するときだけ」受け入れることでグループ独立を保証dragover/dropを常に受け入れ、どこで離してもドロップ成立扱いにしてスナップバックアニメーションを抑止i18n
新規の表示文言はありません(既存キーのみ使用)。
npm run build:i18nで未定義プレースホルダ警告が出ないことを確認済み。確認
ローカル (Node) で確認済み: ログイン → 保存 → プレビュー → 削除 → 再起動
orderAPI のバリデーション(不正IDで400、CSRF無しで403)制限
🤖 Generated with Claude Code