Skip to content

Conversation

@lylo
Copy link

@lylo lylo commented Oct 28, 2025

This is a proof of concept for basic attachment gallery support. I'm hoping it starts a discussion about whether this is the right direction to take with galleries.

It adds a new AttachmentGalleryNode object which wraps multiple <action-text-attachment> nodes in a <div>. You can also delete nodes in a gallery and have it correctly reformat based on the remaining nodes.

It supports up to 9 images in a 3x3 grid (like Trix). Inserting via the toolbar and drag and drop is supported.

Known limitations

  • No error handling around file type etc

lylo added 3 commits October 28, 2025 09:06
- Create AttachmentGalleryNode to wrap 2+ uploaded images
- Update gallery grid layout (2-col, 3-col) based on image count
- Move cursor outside gallery after upload/deletion to prevent layout issues
- Auto-unwrap gallery when reduced to 1 or 0 images
- Add CSS grid styling for attachment galleries
- Add tests for gallery creation and deletion behavior
@lylo
Copy link
Author

lylo commented Oct 28, 2025

@jorgemanrubia would appreciate your initial thoughts on this. I had another PR but it diverged too much from main, so this is a fresh one. It also adds support for deleting images from galleries.

lylo added 3 commits October 28, 2025 09:20
- Ensure empty paragraph exists after gallery when replacing last node
- Simplify cursor positioning to only look forward (next sibling)
- Create new paragraph after gallery if next node isn't suitable
- Fixes cursor appearing in gallery grid cells after drag-and-drop
@jorgemanrubia
Copy link
Member

Hey @lylo thank you so much for your work exploring galleries. I will review this one soon, sorry I have been busy with several fronts (new product on its final stage! 😅).

@lylo
Copy link
Author

lylo commented Oct 30, 2025

Not a problem! Thanks for taking the time to have a look, really appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants