-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
[FEATURE] Autocomplete when tags
field is not on root document
#12
Comments
I have the same issue as @S-G-K . I may be wrong but #13 doesn't seem to resolve our issue. In my case I have Snippets of my shemasdocuments/project.js export default {
name: 'project',
type: 'document',
title: 'Project',
fields: [
{
name: 'title',
type: 'string',
title: 'Title'
},
{
name: 'mainImage',
type: 'mainImage',
title: 'Main image'
}
} objects/mainImage.js export default {
name: 'mainImage',
type: 'image',
title: 'Image',
options: {
hotspot: true,
accept: 'image/*'
},
validation: Rule => Rule.required().error('A main image is required!'),
fields: [
{
name: 'description',
type: 'string',
title: 'Descritpion',
description: 'La description aide à optimiser le SEO',
options: {
isHighlighted: true
},
validation: Rule => Rule.error('You have to fill out the description text.').required()
},
{
name: 'tags',
title: 'Tags',
type: 'tags',
options: {
isHighlighted: true
}
}
],
preview: {
select: {
imageUrl: 'asset.url',
title: 'caption'
}
}
} SuggestionI think the plugin should recognize the type of document on which it is set so it will query sanity api on the right document and not on the parent document. |
Thank you for this. I'll take a look over the weekend. I think I made it work with nested objects initially, but there were some quirks to work out |
So sorry that this "over the weekend" turned into "by the end of this year", but I finally got some time to work on this, and hopefully will have this working, well, by the end of this year :) |
Great work on this plugin, thank you!
Is your feature request related to a problem? Please describe.
I'm trying to use the tags field inside an object (which will be included in several documents).
Unfortunately, the plugin does not register the tags made inside for instance
metadata.tags
for reuse.Describe the solution you'd like
I would like to be able to define an option of where the plugin looks for the
tags
field so that I can get autocomplete inside objects.This would also allow (although I don't have an example use case) for different sets of tags based on their document path/or field name.
For instance:
options: { tagsPath: 'metadata.tags' }
or
options: { tagsPath: 'metadata.keywords' }
Describe alternatives you've considered
Having only the tags field on the root document (this works, but is not particularly elegant)
Happy to discuss, and or contribute to this (with guidance)!
The text was updated successfully, but these errors were encountered: