-
Notifications
You must be signed in to change notification settings - Fork 20
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
SanityImageAsset: Alternative text + include in SanityImageAsset reference object #68
base: master
Are you sure you want to change the base?
SanityImageAsset: Alternative text + include in SanityImageAsset reference object #68
Conversation
@@ -144,6 +144,8 @@ public Task<string> SerializeImageAsync(JToken input, SanityOptions options) | |||
{ | |||
var asset = input["asset"]; | |||
var imageRef = asset?["_ref"]?.ToString(); | |||
var assetValue = asset?["value"]; | |||
var imageAltText = assetValue?["altText"]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps ?? ""
should be added to the end of this line to avoid imageAltText being null. Alternatively the alt tag should only be added if altImageText isn't null on the line further down.
@@ -66,6 +66,7 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s | |||
|
|||
//Get reference from object | |||
var valRef = type.GetProperty("Ref").GetValue(value) as string; | |||
object Value = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit picky here, but we should use camelCase instead of PascalCase for local variable names.
@rvanoord I've fixed your requested changes 🔨 |
There are now two open pull requests that have been unresolved for several months in addition to the 6 open pull requests from dependabot, without any active response from your end. Furthermore, there are 4 open issues, with the latest activity dating back to May 2022. Security, reliability, and active collaboration are essential to us as we work with Sanity and .NET across various projects and for different clients. We need to have confidence that you will continue the development of this package and take contributions seriously. I want to take a constructive approach to this situation, but it's disappointing to see so little interest in further development, especially with nearly 200,000 downloads of this package. Can we expect more active participation, or should we consider this repository as inactive? |
Images can have alternative text defined via the media plugin, but with the current version of Sanity.Linq, this text is not included with images.
We have added
[Include]
toSanityReference<SanityImageAsset> Asset
property inSanityBlock
, furtherAltText
property is added toSanityImageAsset
.We noticed that when adding an image inside a block editor, the image object we get from Sanity.Linq is only a reference. In this case, alternative text is added by including the original
Value
object on the reference in theSanityReferenceTypeConverter
, and included into the default image html serializer.Please provide feedback if you see anything wrong with this solution and feel free to make changes.