Skip to content

Customize the Embedded Template Editor

Customize the embedded template editor by passing options to DocSpring.createTemplateEditor. Top-level options control the iframe, theme, and Done button. The features object controls which editor controls are shown.

Feature overrides
DocSpring.createTemplateEditor('#template-editor', {
templateId: 'tpl_123',
token: 'EMBED_EDIT_TOKEN',
inline: true,
externalUser: {
name: 'Jane Editor',
external_id: 'user_123'
},
darkMode: true,
showDoneButton: true,
doneButtonLabel: 'Finish',
disableDoneButtonIfPredefinedFieldsMissing: true,
features: {
showSettings: false,
showVersions: true,
showSchema: false,
showFormLinks: false,
showHelp: false,
showInvert: true,
showPredefinedFields: true
}
})

Options are configured per embed. They are not saved on the template.

OptionTypeDefaultDescription
inlinebooleanDepends on selectorRender the editor inline. Defaults to true when a selector is provided; otherwise the editor opens as a modal.
selectorstringundefinedTarget element for an inline editor. You can pass this instead of passing a selector as the first argument.
externalUserobjectundefinedUser details from your application. Used for template change attribution and version publisher metadata.
darkModebooleanStored/system themePass true to force dark mode, or false to force light mode for the embedded editor iframe.
showDoneButtonbooleantrueShow the Done button in the editor header.
doneButtonLabelstringDoneText for the Done button.
disableDoneButtonIfPredefinedFieldsMissingbooleantrueDisable the Done button until every required_in_template predefined field has been added.
closeModalOnClickOverlaybooleantrueIn modal mode, close the editor when the user clicks the overlay behind the iframe.
fullScreenModalbooleanfalseIn modal mode, remove the default side margins and use the full viewport width.
modalMaxWidthstringundefinedIn modal mode, cap the iframe width with a CSS length such as 1200px or 80vw. Defaults to no max width.
iframeClassstringundefinedAdditional class names for the iframe.
iframeStylestringundefinedAdditional inline CSS for the iframe.
editorURLstringGenerated URLOverride the iframe URL. This is mainly useful for local development or custom routing.
regionstringUSUse a DocSpring region: US, EU, or AU.
hoststringundefinedUse one host for both app and API URLs, usually for single-domain enterprise deployments.
appHoststringundefinedOverride the app host used for the editor iframe, usually for split-domain enterprise deployments.
apiHoststringundefinedOverride the API host for consistency with other embedded libraries.
featuresobjectSee belowPer-embed editor UI feature overrides.

When externalUser is omitted, changes and published versions are attributed to Embedded Template User. Use externalUser.external_id for your application’s stable user ID; DocSpring keeps it separate from DocSpring user IDs in version responses as published_by_external_id.

onDone fires when the Done button is clicked after the editor is saved. The Done button is disabled while there are pending changes, while a save is in progress, or while a save error is present. Modal editors close automatically after onDone and onEvent run. See the main embed guide for the full callback list.

Only one embedded template editor should be active on a page. Creating a new editor closes the previous editor instance first.

FeatureDefaultDescription
showSettingstrueShow the template settings panel. Requires the embed_edit_allow_settings capability.
showVersionstrueShow version publishing, restore, and delete controls. Requires the embed_edit_allow_versioning capability.
showSchematrueShow the JSON schema button.
showFormLinkstrueShow links to hosted form and visual form pages.
allowPdfReplacementtrueAllow users to upload a replacement PDF. Requires the embed_edit_allow_document_replacement capability.
showHelptrueShow the help link.
showInverttrueShow the Invert button for PDF templates in dark mode. This option has no effect in light mode.
showNewFieldTypePickertrueShow the toolbar field type picker for adding new fields.
showPredefinedFieldstrueShow predefined field assignment controls.
showWelcomeModaltrueShow the welcome modal whenever the embedded editor loads.
showTemplateDefaultOptionstrueShow template default field settings.
showFieldDataTypetrueShow field data type controls.
showFieldRequiredtrueShow required field controls.
showFieldHiddentrueShow hidden field controls.
showFieldStatictrueShow static field controls.
showFieldDefaultValuetrueShow default value controls.
showFieldInfotrueShow field title and description controls.
showFieldRotationtrueShow field rotation controls.
showFieldOpacitytrueShow opacity controls.
showFieldConditionstrueShow conditional display controls.
showFieldQrBarcodetrueShow QR code and barcode display options.
showFieldDateOptionstrueShow date and time formatting controls.
showFieldMetadatatrueShow field metadata controls.
showFieldFontAdvancedtrueShow advanced font controls.
showFieldValidationtrueShow validation controls such as length limits.
showFieldCombOptionstrueShow comb field controls.
showFieldColorFromDatatrueAllow colors to come from submitted data.

Use simplifyUI as a shortcut when you want a simpler editor experience:

Simplified preset with override
DocSpring.createTemplateEditor('#template-editor', {
templateId: 'tpl_123',
token: 'EMBED_EDIT_TOKEN',
inline: true,
features: {
simplifyUI: true
}
})

simplifyUI expands into individual feature switches. Any explicit feature value in the same features object overrides the preset.

When embed_edit_allow_settings is disabled on the template, the embedded editor cannot view or edit sensitive template settings. The editor receives sanitized values for settings such as webhook URLs, Slack webhook URLs, redirect URLs, public access settings, expiration settings, and PDF encryption passwords. Enable embed_edit_allow_settings only when the embedded user should be allowed to see and change those settings.