feat: add listView, contentRole and content attributes to blocks in preparation of wp7#96
Conversation
…reparation of wp7
There was a problem hiding this comment.
Pull request overview
Deze PR bereidt de Yard Gutenberg blocks voor op de (aangekondigde) pattern-editing wijzigingen richting WordPress 7.0 door block metadata uit te breiden, zodat blocks beter als “content” te bewerken zijn in patronen en container-blocks een eigen weergave krijgen in de List View.
Changes:
- Voegt
supports.contentRoletoe aan meerdere blocks om pattern-editing als content mogelijk te maken. - Voegt
supports.listViewtoe aan container-/wrapper-blocks zodat ze een eigen entry in de List View krijgen. - Markeert specifieke block attributes met
role: "content"zodat die attributes als content bewerkbaar zijn in patterns.
Reviewed changes
Copilot reviewed 29 out of 33 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Blocks/timeline/block.json | Timeline wrapper: contentRole/listView toegevoegd; align attribute default verwijderd. |
| src/Blocks/timeline-item/block.json | Timeline item: supports.contentRole toegevoegd + formatting. |
| src/Blocks/timeline-item-collapse/block.json | Markeert title/subtitle attributes als content via role: "content". |
| src/Blocks/tabs/block.json | Tabs wrapper: contentRole/listView toegevoegd. |
| src/Blocks/tabs-item/block.json | Tabs item: supports.contentRole + headingText als role: "content". |
| src/Blocks/slider/block.json | Slider wrapper: contentRole/listView toegevoegd + supports herordend. |
| src/Blocks/slide/block.json | Slide: supports.contentRole toegevoegd + formatting. |
| src/Blocks/iconlist/block.json | Iconlist wrapper: contentRole/listView toegevoegd. |
| src/Blocks/iconlist-item/block.json | Iconlist item: meerdere attributes gemarkeerd met role: "content". |
| src/Blocks/icon/block.json | Icon: supports.contentRole toegevoegd. |
| src/Blocks/counting-number/block.json | Counting number: supports.contentRole toegevoegd. |
| src/Blocks/collapse/block.json | Collapse wrapper: contentRole/listView toegevoegd. |
| src/Blocks/collapse-item/block.json | Collapse item: headingText/subtitleText gemarkeerd met role: "content". |
| package-lock.json | Version bump en dependency lock updates. |
| build/Blocks/timeline/index.js | Build output bijgewerkt voor timeline metadata/supports. |
| build/Blocks/timeline/index.asset.php | Asset hash update. |
| build/Blocks/timeline/block.json | Build block.json bijgewerkt (contentRole/listView, align attr weg). |
| build/Blocks/timeline-item/index.js | Build output bijgewerkt voor timeline-item supports. |
| build/Blocks/timeline-item/index.asset.php | Asset hash update. |
| build/Blocks/timeline-item/block.json | Build block.json: supports.contentRole toegevoegd. |
| build/Blocks/timeline-item-collapse/index.js | Build output bijgewerkt voor attribute role: "content". |
| build/Blocks/timeline-item-collapse/index.asset.php | Asset hash update. |
| build/Blocks/timeline-item-collapse/block.json | Build block.json: role: "content" op title/subtitle. |
| build/Blocks/tabs/block.json | Build block.json: supports.contentRole/listView. |
| build/Blocks/tabs-item/block.json | Build block.json: headingText role + supports.contentRole. |
| build/Blocks/slider/block.json | Build block.json: supports.contentRole/listView. |
| build/Blocks/slide/block.json | Build block.json: supports.contentRole. |
| build/Blocks/iconlist/block.json | Build block.json: supports.contentRole/listView. |
| build/Blocks/iconlist-item/block.json | Build block.json: attributes role: "content". |
| build/Blocks/icon/block.json | Build block.json: supports.contentRole. |
| build/Blocks/counting-number/block.json | Build block.json: supports.contentRole. |
| build/Blocks/collapse/block.json | Build block.json: supports.contentRole/listView. |
| build/Blocks/collapse-item/block.json | Build block.json: attributes role: "content". |
Files not reviewed (3)
- build/Blocks/timeline-item-collapse/index.js: Language not supported
- build/Blocks/timeline-item/index.js: Language not supported
- build/Blocks/timeline/index.js: Language not supported
Comments suppressed due to low confidence (2)
src/Blocks/collapse-item/block.json:50
- Volgens de PR-beschrijving krijgen content-blokken
supports.contentRole: true. Dit block voegt welrole: "content"toe aan attributes, maarsupportsmistcontentRole, waardoor het block mogelijk niet als bewerkbare content in patterns wordt behandeld.
"role": "content"
}
},
"parent": [ "yard/collapse" ],
"supports": {
src/Blocks/timeline/block.json:17
- Het
alignattribute met default"wide"is verwijderd. Dit wijzigt het standaard gedrag bij het inserten van dit block (nieuw geplaatste blocks krijgen geenalignwide-class meer tenzij expliciet gekozen). Graag bevestigen dat dit intentioneel is; zo niet, voeg hetalignattribute met default terug toe (zoals bij o.a.yard/tabs/yard/slider).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "subtitle": { | ||
| "type": "string", | ||
| "source": "html", | ||
| "selector": ".wp-block-yard-timeline-item-collapse__subtitle" | ||
| "selector": ".wp-block-yard-timeline-item-collapse__subtitle", | ||
| "role": "content" |
There was a problem hiding this comment.
False positive. Zodra je "role": "content" toevoegt aan één attribuut, doet dat hetzelfde als supports.contentRole: true
| "role": "content" | ||
| } | ||
| }, | ||
| "parent": ["yard/iconlist"], | ||
| "parent": [ "yard/iconlist" ], | ||
| "supports": { |
There was a problem hiding this comment.
False positive. Zodra je "role": "content" toevoegt aan één attribuut, doet dat hetzelfde als supports.contentRole: true
laravdiemen
left a comment
There was a problem hiding this comment.
Nice! Hoe zit het met het query block, aan gezien die niet hierin staat. Moet die ook aangepast worden of gaat dat al goed?
| "background": true, | ||
| "color": true | ||
| }, | ||
| "contentRole": true, |
There was a problem hiding this comment.
Wat is nu precies de keuze wanneer je "contentRole": true gebruikt en wanneer "role": "content" op een attribute? Bij dit blok zijn er ook attributes waarbij die role content zou kunnen
There was a problem hiding this comment.
"role": "content" Moet je toevoegen bij een attribuut + control die echt in de editor-styles-wrapper staat, niet in de inspector.
Bij dit blok kun je niks in de editor-styles-wrapper aanpassen, maar wel in de inspector. Dus vandaar contentRole true. Zo is hij wel aanklikbaar.
Zal het een keer tonen hoe het werkt :-)
| "parent": ["yard/slider"], | ||
| "parent": [ "yard/slider" ], | ||
| "supports": { | ||
| "contentRole": true, |
There was a problem hiding this comment.
Een slide heeft ook innerblocks toch, zou "listView": true dan ook hier toegevoegd kunnen worden?
There was a problem hiding this comment.
de "listView" attribuut is niet voor innerBlocks, maar echt voor blokken die als container functioneren rondom dezelfde meerdere blokken. Dus bijv. de core/buttons (die meerdere core/button bevat), onze collapse list, timeline list, etc.
|
|
||
| "supports": { | ||
| "anchor": true, | ||
| "contentRole": true, |
There was a problem hiding this comment.
Hier heb je nu wel allebei staan, als ik je comment op copilot zie is dit dubbelop? En zelfde opmerking of hier de listview ook bij zou moeten? Mijn listview opmerking geldt voor misschien nog wel meer blokken maar misschien dat ik het mis heb dus ik benoem het hierna niet meer
There was a problem hiding this comment.
Ohja oeps, contentRole is hier overbodig.
https://make.wordpress.org/core/2026/03/15/pattern-editing-in-wordpress-7-0/
Zie ook het bericht in de Frontend - Updates channel.
Het toevoegen van deze extra attributen zorgen ervoor dat onze blokken:
Eigen list view:
en als je er op klikt: