Implement drag-and-drop image import into the post editor #46
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
specs/editor_post.alliumrequires drag-and-drop image import into the post editor:@guarantee DragDropImages(line ~169, "Drop image file onto editor area triggers import chain"), surface eventImageDroppedOnEditor(editor.post_id, file_path)(line ~115), and rulePostDragDropImage(line ~305) which chains throughaction_patterns.alliumDragDropImageChain. The GUI has no implementation: there is noiced::window::Event::FileDropped(or equivalent) handling anywhere incrates/bds-uiand no drop-target logic incrates/bds-ui/src/views/post_editor.rs. bDS2 implements this behavior (baseline in../bDS2).The import chain itself already exists and is used by the Gallery workflow and media import: image import into the media library, post-media linking, thumbnail generation, optional AI enrichment, and Markdown insertion (see
crates/bds-core/src/engine/gallery_import.rsand the post editor gallery/InsertMedia handlers incrates/bds-ui).Task
iced::Event::Window(window::Event::FileDropped(path))in the app subscription; Iced 0.13 delivers one event per file).action_patterns.alliumDragDropImageChain: import into the media library, link to the current post, then insert the Markdown image reference at the cursor position in the editor buffer. Reuse the same engine paths as the Gallery workflow — no new import logic.../bDS2and match it).locales/ui/*.ftlfiles.crates/bds-ui.DOCUMENTATION.md(Working with media) to document drag-and-drop import once it exists.Definition of done
cargo test --workspacepasses.Implemented drag-and-drop image import for active post editors. Supported images now queue sequential import/link tasks, insert host-absolute /media/... Markdown at the buffer cursor, persist the post, refresh relationships and media, and run optional AI enrichment and metadata translation as background tasks. Airplane mode and unavailable endpoints skip enrichment with localized warning toasts while preserving the import. Unsupported files and drops outside an active post editor are ignored. The existing Insert Media action now also writes host-absolute URLs; legacy bds-media:// parsing remains read-only compatibility. Added five-locale UI copy, user documentation, README coverage, Allium contract updates, and isolated routing, queueing, cursor, persistence/linking, URL, and airplane-mode tests. Neutral review against issue #46, bDS2, and Allium found no missing behavior. Verified with cargo fmt --all -- --check; cargo clippy --workspace --all-targets -- -D warnings; cargo build --workspace; cargo machete --with-metadata; cargo outdated --workspace --root-deps-only --exit-code 1; cargo test --workspace; allium check specs/.allium; and allium analyse specs/.allium. Commit:
29cdd01.