Template Permissions
The builder includes an Editor Mode for developers and administrators who create templates for end-users. This mode allows you to lock or restrict certain parts of a template so that end-users cannot modify them, ensuring critical design elements remain intact while allowing flexibility in other areas.
Enable Editor Mode
To enable this mode, initialize the builder with the designMode set to 'edit'. This activates additional controls within the builder, specifically in a new “Admin” section at the bottom of the editor panel, which provides granular control over content elements.
unlayer.init({
designMode: 'edit' // default value is 'live'
});
Admin Section Controls
When editor mode is enabled, the “Admin” section in the editor panel provides the following options to control how rows and content blocks behave for end-users:
Selectable: Allows you to control whether the end-user can select the content block for editing.
Draggable: Determines if the end-user can drag the content to reposition it.
Duplicatable: Controls whether the end-user can duplicate the content block.
Deletable: Determines if the end-user can delete the content block.
Hideable: Lets you control whether the end-user can hide the content on specific devices (e.g., mobile or desktop).
These controls allow developers or administrators to lock specific parts of the template, ensuring that the end-user cannot accidentally modify or delete essential elements of the design.
Use Case Example
Imagine a scenario where a company has a standard email template with a header, body, and footer. To maintain brand consistency, the header and footer should remain locked and uneditable for end-users, while the body section can be customized with different content.
By creating the template in editor mode, the administrators can:
- Lock the header and footer by disabling Selectable, Deletable, and Draggable options.
- Allow the end-user to only edit the body content, ensuring the core design elements remain intact.
Notes
- The admin section is only available in editor mode. When the builder is running in live mode, end-users will not see these options.
- This feature is ideal for ensuring that essential design elements remain unchanged while still giving end-users the flexibility to customize other areas of the template.
- These settings provide granular control, allowing administrators to create templates with different levels of flexibility for end-users.
Updated 17 days ago