Skip to content

Commit

Permalink
[structure] Simplify default editor for document type lists
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Oct 24, 2019
1 parent c1c0c61 commit b9501cf
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions packages/@sanity/structure/src/documentTypeListItems.ts
Expand Up @@ -11,7 +11,6 @@ import {EditorBuilder} from './Editor'
import {isActionEnabled} from './parts/documentActionUtils'
import {DocumentTypeListBuilder} from './DocumentTypeList'
import {IntentChecker} from './Intent'
import {ChildResolverOptions} from './ChildResolver'

const PlusIcon = getPlusIcon()
const ListIcon = getListIcon()
Expand Down Expand Up @@ -89,17 +88,12 @@ export function getDocumentTypeList(typeName: string, sanitySchema?: Schema): Do
{id: 'layout', title: 'Layout'},
{id: 'actions', title: 'Actions'}
])
.child((documentId: string, context: ChildResolverOptions) => {
const params = context.parameters || {}
const {template, ...parameters} = params
const editor = new EditorBuilder()
.child((documentId: string) =>
new EditorBuilder()
.id('editor')
.schemaType(type)
.documentId(documentId)
.parameters(parameters)

return typeof template === 'string' ? editor.template(template) : editor
})
)
.canHandleIntent(intentChecker)
.menuItems([
// Create new (from action button)
Expand Down

0 comments on commit b9501cf

Please sign in to comment.