Opening an extension in a dialog

I need a little guidance using the new dialog feature. I’m using it to open an existing extension we’ve been working on in full screen mode.

We have an extension we are using to edit text in an entry. We want to be able to open this extension in full screen with the dialog.

When we initialize the extension in the dialog, we get a different extension sdk than we expect. It is missing methods that the extension needs to run. Has anyone had experience with this?

Edit: I’ve spent a little more time on this and it looks like when I initialize the Contentful SDK in my extension from within the dialog I get the DialogExtensionSDK. The problem is that I need it to get the FieldExtensionSDK for it to behave the same as if it were embedded. How can I do this?

1 Like

I ended up getting my answer through the support channel. After working on it for a while I was basically able to boil my problem down to to not having the Field SDK available to me while reusing my embedded extension in a dialog.

// in the field location, where entry methods are available
extension.dialogs.openExtension({
  id: 'mydialog',
  width: 500,
  parameters: { entryId: extension.entry.getSys().id
})

// in the dialog location, where only space methods are available
const { entryId } = extension.parameters.invocation
const entry = await extension.space.getEntry(entryId)
await extension.space.updateEntry(changeSomething(entry))