Skip to content

Image galleries#716

Open
samuelpecher wants to merge 9 commits intodecorator-selectionfrom
image-gallery
Open

Image galleries#716
samuelpecher wants to merge 9 commits intodecorator-selectionfrom
image-gallery

Conversation

@samuelpecher
Copy link
Collaborator

@samuelpecher samuelpecher commented Feb 2, 2026

Drop-in replacement for Trix image galleries

  • new ImageGalleryNode implementing ElementNode overriding selection to force a NodeSelection at all times
  • new AttachmentExtension conditionally loaded when attachments are enabled
  • single-image galleries are unwrapped into a plain attachment

Contrasting with Trix, selection in a gallery is always on a node, not in-between. Galleries can be split with Enter and Backspace Del behave as expected

@lylo
Copy link
Contributor

lylo commented Feb 2, 2026

This is exciting!

I appreciate this is draft but I tried it and found an issue, just in case you hadn't spotted it:

  1. Add gallery (2 or more images)
  2. Add a standalone (non-gallery) image after it
  3. Save

Now when you edit this content, Lexxy merges all 3 images into one gallery. If you happened to have a paragraph of text between the gallery and the standalone image, it gets deleted.

Also noticed that when adding a gallery at the end of the editor, the cursor appears to be positioned beyond the boundary of lexxy-editor__content

@samuelpecher
Copy link
Collaborator Author

Thanks for checking it out so early!

Now when you edit this content, Lexxy merges all 3 images into one gallery. If you happened to have a paragraph of text between the gallery and the standalone image, it gets deleted.

I'd have expected http://lexxy.localhost:3000/sandbox/images to have the same issue with the gallery followed by the images. This is part of wrapping the entire content with <div> when galleries are just <div>s themselves.

Also noticed that when adding a gallery at the end of the editor, the cursor appears to be positioned beyond the boundary of lexxy-editor__content

@zoltanhosszu fancy having a peek?

@zoltanhosszu zoltanhosszu force-pushed the image-gallery branch 2 times, most recently from a6cfbb0 to c5549c3 Compare February 3, 2026 14:40
@samuelpecher samuelpecher force-pushed the image-gallery branch 4 times, most recently from 77c9baf to 5b47b4f Compare February 10, 2026 18:01
@samuelpecher samuelpecher changed the base branch from main to decorator-selection February 10, 2026 18:37
@samuelpecher samuelpecher marked this pull request as ready for review February 11, 2026 11:37
samuelpecher and others added 9 commits February 11, 2026 13:48
Introduce ImageGalleryNode and accompanying extension. The gallery uses
ElementNode to give Lexical selection, overriden for node-level
selection. `contents.uploadFiles` accepts multiple files and will handle
gallery insertion/promotion and sort non-galleryable files.

Co-authored-by: Zoltan Hosszu <zoltan@37signals.com>
Utility class to handle upload scenarios with an OO pattern
@kebiki
Copy link

kebiki commented Feb 19, 2026

This will be a huge feature. Thanks for working on this @samuelpecher

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.

4 participants

Comments