aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/features')
-rw-r--r--src/features/messages.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 8f8bdd4..a254295 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -10923,6 +10923,7 @@ export function messagesFeature(ctx) {
// opens the thread — not on the picture.
function onPicture(e) {
const el = e.currentTarget;
+ if (el.closest('.note-gallery')) return true; // a gallery tile is all picture (cropped to fill)
const r = el.getBoundingClientRect();
const nw = el.naturalWidth, nh = el.naturalHeight;
if (!nw || !nh || !r.width || !r.height) return true;
@@ -11381,6 +11382,31 @@ export function messagesFeature(ctx) {
for (const p of splitEmoji(part, emojiAt)) out.push(...(typeof p === 'string' ? mdInline(p) : [emojiImg(p.code, p.url)]));
} else out.push(...mdInline(part));
}
+ return pictureRuns(out);
+ }
+ // Two or more pictures in a row (only blank space between them) share one
+ // box of justified rows, the way the Images feed lays them out, instead of
+ // a screen each: a post of thirteen photos was thirteen screens to scroll
+ // past ("could we put them into a masonry grid layout within the post kinda
+ // like we do on our images feed", Adam, 2026-11-18). A tap still opens the
+ // picture in the pager, with the rest a swipe away.
+ const isNoteImg = (n) => !!n && n.nodeType === 1 && n.tagName === 'IMG' && n.classList.contains('note-img');
+ function pictureRuns(nodes) {
+ const out = [];
+ for (let i = 0; i < nodes.length; i++) {
+ if (!isNoteImg(nodes[i])) { out.push(nodes[i]); continue; }
+ const run = [nodes[i]];
+ let j = i + 1, last = i;
+ for (; j < nodes.length; j++) {
+ const n = nodes[j];
+ if (isNoteImg(n)) { run.push(n); last = j; continue; }
+ if (typeof n === 'string' && !n.trim()) continue;
+ break;
+ }
+ if (run.length < 2) { out.push(nodes[i]); continue; }
+ out.push(h('div', { class: 'note-gallery' }, ...run));
+ i = last;
+ }
return out;
}