For a while now we have introduced the __experimentalRole property for block attributes. In spite of its name, the feature is considered stable, since it's been in many WP releases.
Its usage right now is having a content value, that is used in various features like the contentOnly mode and pattern transformations. Recently we expanded its usage by supporting a local value.
This role could be useful for marking some media attributes too, and handle cases where we could easily create previews of media blocks (like Image, Media Text etc..), support more blocks in the post publish panel to upload external images, etc..
In order to make some media blocks more semantic, we'd need more than one role though. For start we'd need the id and the url, which could have different names in blocks. For example the id in Image block is id and in Media Text is mediaId.
We will most certainly need a mediaType role as well. An example would be video and audio have different tag attributes and a preview for them would have to be generated differently. You can see an example of such handling for media tab in inserter.
Finally, right now these attributes have the content role assigned and that could simply mean that the new media roles are also considered content. This would require more testing though in order to validate that this is the case for all blocks that use them.
For a while now we have introduced the
__experimentalRoleproperty for block attributes. In spite of its name, the feature is considered stable, since it's been in many WP releases.Its usage right now is having a
contentvalue, that is used in various features like thecontentOnlymode and pattern transformations. Recently we expanded its usage by supporting alocalvalue.This role could be useful for marking some
mediaattributes too, and handle cases where we could easily create previews ofmediablocks (like Image, Media Text etc..), support more blocks in the post publish panel to upload external images, etc..In order to make some media blocks more semantic, we'd need more than one role though. For start we'd need the
idand theurl, which could have different names in blocks. For example theidin Image block isidand in Media Text ismediaId.We will most certainly need a
mediaTyperole as well. An example would bevideo and audiohave different tag attributes and a preview for them would have to be generated differently. You can see an example of such handling for media tab in inserter.Finally, right now these attributes have the
contentrole assigned and that could simply mean that the new media roles are also considered content. This would require more testing though in order to validate that this is the case for all blocks that use them.