How to use the @sanity/initial-value-templates.getParameterlessTemplatesBySchemaType function in @sanity/initial-value-templates

To help you get started, we’ve selected a few @sanity/initial-value-templates examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sanity-io / sanity / packages / @sanity / structure / src / DocumentList.ts View on Github external
return typeNames.reduce((items, typeName) => {
    const schemaType = schema.get(typeName)
    if (!isActionEnabled(schemaType, 'create')) {
      return items
    }

    return items.concat(
      getParameterlessTemplatesBySchemaType(typeName).map(
        (tpl): InitialValueTemplateItem => ({
          type: 'initialValueTemplateItem',
          id: tpl.id,
          templateId: tpl.id
        })
      )
    )
  }, templateItems)
}

@sanity/initial-value-templates

Build templates for initial values

MIT
Latest version published 1 year ago

Package Health Score

79 / 100
Full package analysis