Cannot enter data on new documents when using tabs inputcomponent
Closed this issue · 5 comments
Hi,
I have two schema definitions:
-
simpleFields.js:
export default { name: 'simpleFields', title: 'Simple product fields', type: 'object', fields: [ { name: 'title', title: 'Title', type: 'string', validation: Rule => Rule.required() }, ], }
-
testProduct.js
export default { name: 'testProduct', title: 'Test product', type: 'document', fieldsets: [ { name: 'general', title: 'General' }, ], fields: [ { name: 'simpleFields', type: 'simpleFields', fieldset: 'general', }, ], }
When I add tabs to the testProduct as follows:
`import Tabs from 'sanity-plugin-tabs'
export default {
name: 'testProduct',
title: 'Test product',
type: 'document',
inputComponent: Tabs,
fieldsets: [
{ name: 'general', title: 'General' },
],
fields: [
{
name: 'simpleFields',
type: 'simpleFields',
fieldset: 'general',
},
],
}
`
i.e. I make the import and add "inputComponent: Tabs,", I can no longer enter text into the input field simpleFields.title.
I've just noticed this today, too
i noticed this also. my suspicion is (didnt test it out), is that @LouiseEH and me applied inputComponent: Tabs
to a document
, whereas the documentation states it should be on an object
. However, having a wrapper object around all content is unfortunately not an option for me. when i find time i might test it out, for now we are not using this plugin
Yes @andre-brdoch that was indeed the problem, using inputComponent on document level. We solved the problem as you suggest by wrapping the fields in an object, although not optimal, it works. Unfortunate that it is not an option for you.
I was wondering if there was another way to implement tabs, without having to have the wrapper object. The problem is only object
types accept an inputComponent
.
Structure builder's form view could be another way, it comes with build-in tab behavior. However, it would require to re-implement the whole form component, which I can not figure out how to do properly so far.
Closing this for now. If you find a way to reimplement the form component give me a shout @andre-brdoch . Totally agree that skipping the wrapper object is preferrable