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

Ability to extend fields available on type #106

Open
andrewmumblebee opened this issue Aug 9, 2024 · 0 comments
Open

Ability to extend fields available on type #106

andrewmumblebee opened this issue Aug 9, 2024 · 0 comments

Comments

@andrewmumblebee
Copy link

andrewmumblebee commented Aug 9, 2024

Is your feature request related to a problem? Please describe.
It would be great if we could add additional fields to the type, similar to how the type: 'image' built-in type works.

i.e.

defineType({
  name: 'codeBlock',
  title: 'Code',
  type: 'code',
  fields: [
	defineField({
		name: 'caption',
		type: 'string',
		title: 'Caption',
	})
  ]
})

Rather than currently where you need to create an extra level of nesting in the object to combine the code fields with other fields

defineType({
  name: 'codeBlock',
  title: 'Code',
  type: 'object',
  fields: [
	defineField({
		name: 'code',
		title: 'Code',
		type: 'code'
	}),
	defineField({
		name: 'caption',
		type: 'string',
		title: 'Caption',
	})
  ]
})

Although this works fine, you lose the built-in preview when using PortableText within the editor. Thanks

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