sanity-plugin-media
sanity-plugin-media copied to clipboard
Media Properties in preview object unknown
Hiya.
Thanks for the great plugin!
We are trying to setup a preview for the media references on media entity level within Sanity. We are somehow unable to wire the field id to the sanity preview selection. "title" for example is unknown.
"sanity": "^3.29.0", "sanity-plugin-media": "^2.2.5",
defineField({
title: "Files",
name: "files",
type: "array",
of: [
{
type: "file",
preview: {
//select: { title: "file.title" }, // unknown
//select: { title: "media.title" }, // unknown
select: { title: "title" }, // unknown
prepare({ title }) {
//console.log(selection)
return {
title: title,
};
},
},
},
],
options: {
hotspot: true, // <-- Defaults to false
},
validation: (Rule) => Rule.required(),
}),
Is this a bug? Or is there a fancy property path we just dont know.
Thanks
ok this here seems to be the correct way to bind the file properties.:
select: { title: "asset.title", asset: "asset" },
closing the issue