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

Media Properties in preview object unknown #209

Open
MokDevelopment opened this issue Feb 27, 2024 · 1 comment
Open

Media Properties in preview object unknown #209

MokDevelopment opened this issue Feb 27, 2024 · 1 comment

Comments

@MokDevelopment
Copy link

MokDevelopment commented Feb 27, 2024

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

@MokDevelopment
Copy link
Author

ok this here seems to be the correct way to bind the file properties.:

select: { title: "asset.title", asset: "asset" },

closing the issue

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

No branches or pull requests

1 participant