Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

nilsree
Copy link

@nilsree nilsree commented Jan 31, 2023

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] to SanityReference<SanityImageAsset> Asset property in SanityBlock, further AltText property is added to SanityImageAsset.

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 the SanityReferenceTypeConverter, 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.

@chtombre chtombre requested a review from rvanoord April 12, 2023 07:26
@@ -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"];
Copy link
Collaborator

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;
Copy link
Collaborator

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.

@nilsree nilsree requested a review from rvanoord August 1, 2023 13:32
@Eivinddh
Copy link

@rvanoord I've fixed your requested changes 🔨

@nilsree
Copy link
Author

nilsree commented Oct 26, 2023

@rvanoord @chtombre

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants