Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I want to add new properties to the existing image render of the content grid editor that is located in:
As listed in the current code, it renders an image with this lines:
var altText = Model.value.altText ?? Model.value.caption ?? string.Empty;
<img src="@url" alt="@altText">
Where it takes the values for @altText?
I have added a property to the media datatype "altText" but is always null.
Where this altText comes from?
The alt text is the image caption which you can find in the bottom of the grid.
It is an issue/ oversight in my eyes.
The image caption is good for that sort of thing but it should be two options.
1. Image caption
2. Image alt text
However, in the code for rendering media, there is an OR for altText and caption. And in the editor you can only type one. Where the other value come from ? Very confusing....
Have you found a solution to fix this? I'm running into the same issues.
If it was me I would probably recommend adding a custom property to the Image media type.
That way you can then go into the media section and set the alt tag there.
This would mean that whereever you use that image it will always have to same alt tag. Regardless of if you used it in a Grid Editor / Rich Text Editor.
If we add another (mandatory) property to Image, say called AltText, how does output of the content of the Rich Text Editor know to inject the value from that field into the alt property when it renders the image? Do we have to do something special to make that connection?
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted