Shared Content: offer the Shared library on ImageText, LinkPreview, ImageLinkGrid and other image slots
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- next.js, typescript
Direzione di ricerca
Start with src/fields/mediaSource.ts and src/utilities/resolveMediaSource.ts, then trace the block configs and components for ImageText, LinkPreview, ImageLinkGrid, and InlineMedia. The issue splits the work into a blocks PR and a later collections PR; begin with the block slots and their image readers, and check the shared-content prerequisites before starting. Done when adopted slots offer both sources, existing center images still render, readers resolve either library correctly, and migrations pass pnpm migrate:check.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
Add the "Center library / Shared library" choice to the remaining image slots. #1335 (Shared Content: the SharedMedia collection and a source choice on the Media block) adds it to the Media block only. mediaSourceFields in src/fields/mediaSource.ts builds the three fields for a slot, and resolveMediaSource in src/utilities/resolveMediaSource.ts picks what to render. Each new slot needs one call to the first, and every place that reads the slot's image has to go through the second.
Refs #564. Blocked until the Shared Content stack (#1328, #1335, #1336, #1340) merges.
Before any slot: extend mediaSourceFields
- Pass
filterOptionsthrough. ImageText, LinkPreview, ImageLinkGrid and the Events thumbnail all restrict the picker withgetImageTypeFilter. Today the helper can't pass that on, so adopting it would let those slots pick videos. - Accept admin overrides such as
descriptionandallowCreatefor both upload fields. - Accept distinct field names (e.g.
featuredImageSource) for slots that are fields on a collection. Events has two image slots on one document, so their names can't collide.
Part 1: the blocks (one PR)
These are cheap: one block config and one component each.
| Slot | Where it lives | Notes |
|---|---|---|
ImageText image |
Layouts, Posts rich text | Required. The component reads image in two places. |
LinkPreview cards[].image |
Layouts | Inside an array, which works because the source choice only depends on sibling fields. |
ImageLinkGrid columns[].image |
Layouts | Inside an array, same as LinkPreview. |
InlineMedia media |
Announcements rich text (inline block) | No migration. The component does its own type narrowing on media. |
Migration: source (default 'center') and shared_media_id on 12 tables. Those are the block, link_preview_cards and image_link_grid_columns tables for pages and home_pages and their _v version twins. Rich-text copies are stored as JSON, so they need no migration and no backfill, since a slot with no source value already means the center's library.
Add ON DELETE set null to each ADD ... REFERENCES by hand. migrate:create drops it from ALTERs; see 20260923_033051_add_shared_media.ts and its explanation file.
Seed: put one shared-source instance of each block on the All Blocks page so the "Where this is used" panel and the References column show them.
Part 2: images on collections (later PR)
These are more expensive: each needs its own migration, and more code reads each field.
- Posts
featuredImage: built with the SEO plugin'sMetaImageField, so it has to be replaced or wrapped. It is indefaultPopulate. Readers:src/utilities/queries/getPosts.tssrc/components/PostPreview/index.tsxsrc/components/PostPreviewSmallRow.tsxsrc/app/api/[center]/og/getOgDocData.ts, wheregetImgAttrsFromMediaResourceand the WebP conversion are typed forMediaonly
- Events
featuredImageandthumbnailImage:featuredImageis aMetaImageFieldwithhasGenerateFn. Readers:- the event page
getOgDocData.tsEventPreviewEventPreviewSmallRow
- Biographies
photo: required.AuthorAvatarhard-codesgetDocumentById('media', ...), and the Team block reads the photo in two places. - Sponsors
photo: required. The Sponsors block validator checks the photo's aspect ratio, and the Banner, Static and Carousel components read it.
Out of scope for now:
- Galleries
items[].media: the array item already has its own type radio, so the conditions would nest. - Pages
meta.image: no frontend reader. - Settings brand assets: they are per-center by nature.
Acceptance
- Every adopted slot offers the choice, and an existing slot with no source value still renders the center image.
- Switching back to "Center library" clears the shared reference. The References count and the "Where this is used" panel both follow the change.
- Every reader of an adopted slot goes through
resolveMediaSource. No reader narrows the value toMediawithout checking which library it came from. pnpm migrate:checkhas been run, and the migration's explanation file records the hand-addedON DELETEclauses.
- Lingua principale
- TypeScript
- Stelle
- 6
- Fork
- 2
- Merge medio
- 1g 11h
- PR unite (30g)
- 35
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NWACus/web
-
tech debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
bug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
tech debt
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement needs-triage tenant:a3
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
NWACus/web#1190 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug ready-for-agent
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
NWACus/web#1154 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Issue simili
-
Media browser returns "Not found" for repositories using the SHA-256 object formatForse già presa @adamchodera l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Follow-ups from #312Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
janhesters/remixcn#318 ·
I maintainer di solito rispondono entro 1 giorno
-
Interceptor LaunchTestProfile.sh: no Windows (Git Bash/MSYS) branch, test profile never launchesAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
danielmiessler/LifeOS#3150 ·
I maintainer di solito rispondono entro 5 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
Make the "%" unit spacing the same in the web and in A10Forse già presa @kragent66-glitch l’ha presa oggi. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
maiychrus25/OpenTea-DX-OS#226 · 1 commento ·