feat(post-form): live photo editor on entry edit (media API + SortableJS)
Replace the FilePond photo path in edit mode with our own thumbnail grid that talks straight to the media API (the gpx-manager pattern). Add/delete/reorder each persist immediately, decoupled from the form's text-field Save: - Add: HEIC->JPEG client-side, stock POST .../media per file, then ONE reorder after the batch (renumber photo-01..NN). On a failed reorder: auto-retry (idempotent), else roll the just-uploaded files back so no orphan stock-named image breaks cover=first. Upload progress shown per file. - Delete: inline 'Delete? [Confirm] [Cancel]' (Confirm disabled in flight), stock DELETE, then renumber the survivors. - Reorder: SortableJS drag -> POST /entry/<slug>/photos/order. On failure the move reverts to last-known-good; the shown grid never disagrees with disk without an inline error. - Loading + empty states; first cell badged Cover; photo-NN URLs cache-busted since reorder reuses them for different bytes. FilePond is fully decommissioned in edit mode (initPhotoConversion early-returns under EDIT_MODE): no stale photo_order manifest is posted on text Save, so cache-on-save can't delete a live-added photo. Create-mode FilePond is untouched. Adds sortablejs (bundled into js/post via the post-form entry). SVG excluded in the file-input accept; the server-side SVG block is a documented fast-follow. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Generated
+8
-1
@@ -12,7 +12,8 @@
|
||||
"heic-to": "^1",
|
||||
"maplibre-gl": "^4",
|
||||
"photoswipe": "^5",
|
||||
"scrollama": "^3"
|
||||
"scrollama": "^3",
|
||||
"sortablejs": "^1.15.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"esbuild": "^0.21",
|
||||
@@ -984,6 +985,12 @@
|
||||
"integrity": "sha512-PIPwB1kYBnbw/ezvPBJa5dCN5qEwokfpAkI3BmpZWAwcVID4nDf1qH6WV16A2fQaJmsKx0un5S/zhxN+PQeKDQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/sortablejs": {
|
||||
"version": "1.15.7",
|
||||
"resolved": "https://registry.npmjs.org/sortablejs/-/sortablejs-1.15.7.tgz",
|
||||
"integrity": "sha512-Kk8wLQPlS+yi1ZEf48a4+fzHa4yxjC30M/Sr2AnQu+f/MPwvvX9XjZ6OWejiz8crBsLwSq8GHqaxaET7u6ux0A==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz",
|
||||
|
||||
Reference in New Issue
Block a user