-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Blocks.EMBEDDED_ASSET] not working for images #1
Comments
I forked the project and found a fix that works for me. You can override |
BREAKING CHANGE: Overrides for custom elements are now indexed the other way round: nodeType -> contentType/mimeType instead of contentType/mimeType -> nodeType fix #1
BREAKING CHANGE: Overrides for custom elements are now indexed the other way round: nodeType -> contentType/mimeType instead of contentType/mimeType -> nodeType fix #1
Hi @codeithuman! Thanks for opening an issue. I struggled a bit to find a good, flexible solution for embedded assets and entries. Assets are particularly tricky since they don't have a content type and the mime type seems overly specific (e.g. you probably want to use the same component for I've finally found a compromise that I'm happy with: for assets, you can now define custom components by mime type group — that's the first part of the mime type, e.g. Have a look at the updated docs and let me know what you think! |
Wonderful, thank you @connor-baer! I'll be able to take a look before the end of the week and let you know. Again, I appreciate your time on this. |
I've also added default components for image, video, and audio assets. Published as 2.1.0. |
@connor-baer @codeithuman have either of you been able to test this and confirm that it's working? I'm getting a:
It looks like there is no My graphQL query looks like this
And the results looks like this:
I believe the error is stemming from that empty Any help would be greatly appreciated. Everything else is working fine. Thanks. |
Kyle, I tried it real quick and have a similar error. Unfortunately I
haven’t had time to look into it further and still using the have solution
in the fork I made.
I will be revisiting this in the weeks to come as I’m planning to use
Contentful + Gatsby on additional projects in the future.
…On Tue, Feb 12, 2019 at 5:46 AM Kyle Fraser ***@***.***> wrote:
@connor-baer <https://github.com/connor-baer> @codeithuman
<https://github.com/codeithuman> have either of you been able to test
this and confirm that it's working?
I'm getting a:
Node type is invalid red line error.
It looks like there is no nodeType in the content array on the
embedded-asset-block in my query and thus it's failing.
My graphQL query looks like this
body {
nodeType
content {
nodeType
data {
target {
sys {
id
}
}
}
content {
value
nodeType
}
}
}
And the results looks like this:
...
{
"nodeType": "embedded-asset-block",
"data": {
"target": {
"sys": {
"id": "c5cTwlejTau9t8MRbUNEze"
}
}
},
"content": []
},
{
"nodeType": "heading-2",
"data": {
"target": null
},
"content": [
{
"value": "Test header field",
"nodeType": "text"
}
]
},
...
I believe the error is stemming from that empty content array and that
it's looking for a nodeType within that.
Any help would be greatly appreciated. Everything else is working fine.
Thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADVSbXcEWwQcry98i5JQ1Svu15TqXixLks5vMsWWgaJpZM4adcMX>
.
|
@kylefraser For assets, I use the mime type group which is extracted from the asset's mime type. The mime type is not part of the Could you please try with this query?
|
@connor-baer scratch that, I'm able to grab this.. still no image however. looks like it's because of the extra
|
Yeah, If you're unable to adapt your content structure, I'd recommend looking at the official |
Thank you all for the feedback. @connor-baer we were able to get everything working with the |
[Blocks.EMBEDDED_ASSET] not working for images.
I think it has to do with
rich-text-to-jsx/src/rich-text-to-jsx.js
Line 118 in 5096c38
My node structure does not match this pattern, but looks like the following. It is an image asset uploaded to a rich text field:
My goal is to pull the
id
(contentful_id
) out ofdata.target.sys
and then use to query for that image and produce a fluid image forgatsby-image
.The text was updated successfully, but these errors were encountered: