DocumentationSDK on GitHub

Documentation Guides

Configure the editor

Set appearance, language, editing modes and available features.

On this page

Set defaults in the dashboard

Save defaults in the dashboard. Top-level mount options override editorConfig; settings you omit use the dashboard values. SDK preferences cannot enable features blocked by the service, subscription or dashboard.

Change appearance and language

theme styles the editor interface. Use the email’s own settings to change its design. locale accepts en, fr or es. Changing locale preserves authored text; timer labels follow the interface language.

typescript
import { mount } from '@weavour/editor';

const editor = mount('#email-editor', {
  editorKey: 'YOUR_PUBLIC_EDITOR_KEY',
  userId: 'user-123',
  locale: 'en',
  theme: {
    mode: 'light',
    primaryColor: '#6b59d0',
    shellColor: '#f7f8fc',
    inputColor: '#ffffff',
    fontFamily: 'Inter',
    cornerRadius: 8,
    density: 'compact',
  },
  onError: console.error,
});

await editor.ready;
editor.updateConfig({ theme: { mode: 'dark' }, locale: 'fr' });

Switch between editing and preview

Set mode at mount or call updateConfig({ mode: 'preview' }). Use edit to return to editing. Mode changes preserve the email and undo history; non-edit modes pause autosave. These modes require SDK 0.1.7 and a compatible hosted editor.

typescript
// Call these from your application's preview and edit actions.
function showPreview() {
  editor.updateConfig({ mode: 'preview' });
}

function resumeEditing() {
  editor.updateConfig({ mode: 'edit' });
}

Choose blocks and features

allowedBlocks filters the insertion palette. An empty array hides all entries; existing email content is retained. Feature flags can be set at mount or through updateConfig().

Organization blocks need both userId and organizationId. Disable enableOrganizationBlocks to hide saving and reuse while retaining saved blocks. Before disabling autosave, flush any changes you want saved.

typescript
// Run on your mounted editor instance.
editor.updateConfig({
  allowedBlocks: ['text', 'heading', 'image', 'button', 'section', 'columns'],
  enableTemplates: true,
  enableEmailAudit: true,
  enableTestEmail: false,
  enableOrganizationBlocks: false, // Hide organization block saving and reuse.
});

// Opt out of hosted drafts when your application manages persistence.
editor.updateConfig({ enableAutosave: false });

Custom blocks

Pass customBlocks to register blocks defined by your application. Each definition provides JSON defaults, field controls and an HTML renderer. They appear after standard blocks in the same grid. Use custom:<id> in an explicit allowedBlocks list.

Enable AI

Configure managed credits or your own OpenAI key in the dashboard. Never pass a provider key through the SDK. AI requires paid access with either option.

Need help? Contact us