Conversation
- 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
|
@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. |
- 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
|
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! 😅). |
|
Not a problem! Thanks for taking the time to have a look, really appreciate it. |
|
Just a bump on this to say that I've merged the latest main into it. Still works if someone wants to take a look! 😉 |
|
@zoltanhosszu @samuelpecher do either of you fancy taking a look at this concept? :) |
|
Hey @lylo it's on our list to look at since we want the feature too! |
🥳 🙏 |
|
Hey @lylo we're headed in a similar direction with galleries. @zoltanhosszu and I have been honing selection control, which has been quite a journey since Lexical has some rough edges around |
Awesome! Yes, cursor selection seems to be a pain - I logged an issue I found on Firefox/Chromium around this very thing. Replicating Basecamp galleries (with perhaps some more intuitive way of doing this?) as my PR did would be great. What I'd love in the longer term is finer control over images, e.g. different text wrapping, image sizing but small steps! |
We're aiming for drop-in Trix compatibility 👍
Us too, after a solid v1 😅 |
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