How to Add a Custom Document Editable
Overview
This example adds a custom markdown document editable type to Pimcore Studio. Custom editables
appear inline in the document editor alongside built-in types like input, textarea, and wysiwyg.
Details
Adding a custom document editable requires both a PHP backend and a Pimcore Studio frontend plugin:
Backend (PHP):
- An editable model class extending
Pimcore\Model\Document\Editableand implementingEditmodeDataInterface - Registration via
pimcore.documents.editables.mapconfiguration
Frontend (Studio Plugin):
- A
DynamicTypeDocumentEditableAbstractsubclass withgetEditableDataComponent()returning a React component - The component receives
valueandonChangeprops injected by the framework viaReact.cloneElementon the root element - Registration in the
DynamicTypeDocumentEditableRegistryvia a module InheritanceOverlayfrom the SDK to support document inheritance- Theme-aware styling via
createStylesfromantd-style
Service Configuration:
- The bundle's
WebpackEntryPointProvidermust be tagged with bothpimcore_studio_ui.webpack_entry_point_providerandpimcore_studio_ui.webpack_entry_point_provider.document_editor_iframe, since document editables render inside an iframe with its own plugin bootstrap
The example implements the markdown type as a plain <textarea> with monospace font,
demonstrating the full pattern without external dependencies.
For the full backend + frontend guide, see the Adding Document Editables documentation in the Pimcore core.
Code Example on GitHub
- Plugin entry (index.ts) - binds the dynamic type and registers the module
- Module (markdown-editable-module.tsx) - registers the type in the
DynamicTypeDocumentEditableRegistry - Dynamic type (dynamic-type-document-editable-markdown.tsx) - extends
DynamicTypeDocumentEditableAbstractwith a<textarea>component - Styles (dynamic-type-document-editable-markdown.styles.ts) - theme-aware styling via
createStyles