Skip to content
This plugin is new and currently in beta. For the stable version, please use the previous version of the plugin.

BaseModifierApi

Interface providing document modification capabilities for extension components within the Stripo Email Editor Extensions SDK.

typescript
interface BaseModifierApi

Description

The BaseModifierApi interface provides access to the template modification system, allowing extension components to make changes to email templates in a controlled, synchronized manner. It ensures all modifications are properly tracked, support undo/redo operations, and maintain consistency in collaborative editing sessions.

Import

typescript
import { BaseModifierApi } from '@stripoinc/ui-editor-extensions';

Properties

None (all functionality is provided through methods)

Methods

getDocumentModifier()

Retrieves a modifier instance for performing operations on the document's template.

typescript
getDocumentModifier(): TemplateModifier<HtmlNodeModifier, CssNodeModifier>

Returns

TemplateModifier - A TemplateModifier instance capable of modifying HTML and CSS nodes

Usage Notes

  • Modifications are batched until apply() is called
  • Supports method chaining for multiple modifications
  • Maintains proper synchronization in collaborative environments

Example

typescript
// Get a modifier instance
const modifier = this.api.getDocumentModifier();

// Chain multiple modifications
modifier
    .modifyHtml(htmlNode)
        .setAttribute('data-id', '123')
        .setStyle('color', 'blue')
    .modifyCss(cssNode)
        .setProperty('font-size', '16px')
        .setProperty('margin', '10px')
    .apply(new ModificationDescription('Updated block styling and content'));