Images seem to introduce some interesting. It looks like we could map the image to "image" but there's also URI and root-relative URL. What's the difference between these different mappings?
That is best explained by quoting the test coverage, which makes this very explicit:
'Silly image 🤡 → URI → Root-relative file URL' => 'ℹ︎␜entity:node:foo␝field_silly_image␞␟entity␜␜entity:file␝uri␞␟url', 'Silly image 🤡 → URI' => 'ℹ︎␜entity:node:foo␝field_silly_image␞␟entity␜␜entity:file␝uri␞␟value', "Silly image 🤡" => 'ℹ︎␜entity:node:foo␝field_silly_image␞␟src_with_alternate_widths',
- The first ("URI → root-relative file URL"): the image field's reference to the File entity is followed, then the "url" property on the "uri" field on the File entity is retrieved.
- The second ("URI"): the image field's reference to the File entity is followed, then the "value" property on the "uri" field on the File entity is retrieved — aka the main property on that field, which is why there's one less level in the hierarchy for this one.
- The third ("just the image field itself"): the image field's
src_with_alternate_widthscomputed property that Canvas added.You can only see all 3 , because the second one returns a
public://URI. but, arguably, it does not make sense to expose "root-relative file URL" for an image field, either, becausesrc_with_alternate_widthsis likely preferable. Except … if you want to link to the original image, because then the query string is just noise.[…]
👆 Note the bold+underlined bit!
I think with the improved labels it would have made sense to me what was being offered there. FWIW, I was testing this with code components so maybe the prop type in code components should be setting stronger restrictions for the stream wrapper URL to not be offered?
The code component editor is correct, it's just coarse. I think we need to expand the code component editor UI (and the JSON schema for props that code components are allowed to have) to allow for optional granularity. This is especially true for links. Because the hyperlink is literally the foundation of the web, and it's also literally what a CMS is about: managing content and relations between them. So it's important that the author of a code component can actually specify what kind of link they expect. Because only then can Canvas offer links!
This is what that UI currently looks like, annotated to convey what the coarse prop shapes are that you're allowed to pick:
Allow more granularity. See the change record that in August through September introduced the ability for highly structured approaches to restricting links. (Before then, it was a hacky pattern: …-based mess, aka regex hell 🧟).
Which maps to contentMediaType. Offer 4 choices initially:
contentMediaType being set in JSON Schema)
contentMediaType: image/*) → will result in only suggestions for image fields and image media
contentMediaType: video/*) → will result in only suggestions for video media
contentMediaType: text/html) → will result in only suggestions for the host entity's URL (since
✨
In a content template, how can I link to an entity?
Active
), entity reference fields (once
🐛
HostEntityUrlPropSource shouldn't be specific to the host entity
Postponed: needs info
lands) and link fields
Perhaps with a UI description along the lines of
Which maps to contentMediaType. Offer 2 choices initially:
x-allowed-schemes: [http, https])
Perhaps with a UI description along the lines of
Alternatively, we could omit that second setting and just always restrict all "URL prop shapes" for code components to x-allowed-schemes: [http, https], and provide an update path to make it so.
TBD
Active
1.0
Component sources
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
No activities found.