🔮 Sanity Create is here. Writing is reinvented. Try now, no developer setup

Clarification on the usage of the `editModal` option for object types in Sanity.io.

8 replies
Last updated: Dec 17, 2021
Hi all! Has anyone used the editModal option on Object type content? I was excited to see that
fullscreen
was an option, but I'm not seeing any difference in editing experience when setting it. I have a field on my document type that is an
array
of custom
object
types, and would love for the editing experience for each of the objects to go fullscreen.
Dec 16, 2021, 9:15 PM
Yup
user M
just installed the Sanity CLI and did my
sanity init
today, running
2.23.1
!
Dec 16, 2021, 10:17 PM
Thanks! Let me see if I can replicate and I'll report back!
Dec 16, 2021, 10:18 PM
I just realized there is a help channel, I apologize for dropping this in the wrong spot!
Dec 17, 2021, 2:58 PM
No worries, this is a great channel for questions, as well! I'm getting the same behavior as you, so I'm double checking usage with the team.
Dec 17, 2021, 5:58 PM
OK, I got clarity on this! The
editModal
property is intended to only work with an object inside of the Portable Text Editor. I'm afraid it won't have any effect in an array.
Dec 17, 2021, 6:27 PM
Ahh appreciate it
user M
, that's too bad! I submitted a comment to update the Object docs page with a clarifying note, linking this thread.
Dec 17, 2021, 6:33 PM
Thanks, Frank!
Dec 17, 2021, 6:41 PM
I just had a coworker mention that you can put the
editModal
option on the array instead of the object to get it to work. Ex:
export default {
  name: 'objectTesting',
  title: 'Object Testing',
  type: 'document',
  fields: [
    {
      name: 'title',
      title: 'Title',
      type: 'string',
    },
    {
      name: 'arrayDialog',
      type: 'array',
      options: {
        editModal: 'dialog',
      },
      of: [
        {
          name: 'objectDialog',
          title: 'Object Dialog',
          type: 'object',
          fields: [
            {
              name: 'title',
              title: 'Title',
              type: 'string',
            },
          ],
        },
      ]
    },
    {
      name: 'arrayPopover',
      type: 'array',
      options: {
        editModal: 'popover',
      },
      of: [
        {
          name: 'objectPopover',
          title: 'Object Popover',
          type: 'object',
          fields: [
            {
              name: 'title',
              title: 'Title',
              type: 'string',
            },
          ],
        },
      ]
    },
    {
      name: 'arrayFullscreen',
      type: 'array',
      options: {
        editModal: 'fullscreen',
      },
      of: [
        {
          name: 'objectFullscreen',
          title: 'Object Fullscreen',
          type: 'object',
          fields: [
            {
              name: 'title',
              title: 'Title',
              type: 'string',
            },
          ],
        },
      ]
    }
  ],
}
Either way, it should be clarified!
Dec 17, 2021, 6:45 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?