Skip to content

Exports

The package provides 35+ named exports for advanced usage.

Component

ts
import { EmailEditor } from '@lab2view/vue-email-editor'

Labels & i18n

ts
import { DEFAULT_LABELS, FR_LABELS } from '@lab2view/vue-email-editor'
ExportTypeDescription
DEFAULT_LABELSEditorLabelsEnglish labels (all 175+ keys)
FR_LABELSEditorLabelsFrench translation

Serialization

ts
import { compileMjml, documentToMjml, mjmlToDocument } from '@lab2view/vue-email-editor'
ExportSignatureDescription
documentToMjml(doc: EmailDocument) => stringSerialize document to MJML string
mjmlToDocument(mjml: string) => EmailDocumentParse MJML string to document
compileMjml(mjml: string) => { html: string }Compile MJML to HTML

Node Factories

ts
import {
  createDefaultDocument,
  createSection,
  createColumn,
  createText,
  createImage,
  createButton,
  createDivider,
  createSpacer,
  createSocial,
  createHero,
  createWrapper,
} from '@lab2view/vue-email-editor'
FactoryDescription
createDefaultDocument()Empty document with body
createSection(children?, attrs?)mj-section with optional columns
createColumn(children?, attrs?)mj-column with optional content
createText(html?, attrs?)mj-text with optional content
createImage(attrs?)mj-image with src, alt, etc.
createButton(text?, attrs?)mj-button with label and link
createDivider(attrs?)mj-divider horizontal line
createSpacer(attrs?)mj-spacer vertical space
createSocial(elements?, attrs?)mj-social with social links
createHero(children?, attrs?)mj-hero full-width section
createWrapper(children?, attrs?)mj-wrapper section wrapper

Tree Utilities

ts
import { findNode, findParent, removeNode, moveNode, cloneSubtree } from '@lab2view/vue-email-editor'
UtilitySignatureDescription
findNode(root, id) => EmailNode | nullFind a node by ID in the tree
findParent(root, id) => EmailNode | nullFind the parent of a node
removeNode(root, id) => booleanRemove a node from the tree
moveNode(root, id, targetParentId, index) => booleanMove a node to a new position
cloneSubtree(node) => EmailNodeDeep clone a node and all children

Constants

ts
import {
  DEFAULT_THEME,
  STATIC_BLOCKS,
  CONTENT_NODE_TYPES,
  CONTAINER_NODE_TYPES,
  SELF_CLOSING_NODE_TYPES,
} from '@lab2view/vue-email-editor'
ConstantTypeDescription
DEFAULT_THEMERequired<ThemeConfig>All 25 theme defaults
STATIC_BLOCKSBlockDefinition[]All 43 built-in block definitions
CONTENT_NODE_TYPESEmailNodeType[]Types with htmlContent
CONTAINER_NODE_TYPESEmailNodeType[]Types with children
SELF_CLOSING_NODE_TYPESEmailNodeType[]Types without content/children

Type Guard

ts
import { isNewEditorJson } from '@lab2view/vue-email-editor'
ExportDescription
isNewEditorJson(data)Returns true if data is EmailDesignJson format

Types (TypeScript)

All types are importable with import type:

ts
import type {
  EmailDocument,
  EmailNode,
  EmailNodeType,
  NodeId,
  EmailHeadAttributes,
  EmailDesignJson,
  BlockDefinition,
  BlockCategory,
  BlockCategoryDefinition,
  PropertyDefinition,
  PropertyType,
  ThemeConfig,
  Plugin,
  PluginContext,
  EditorEventMap,
  EmailEditorAPI,
  ToolbarAction,
  SidebarPanel,
  DevicePreset,
  DragSource,
  DropTarget,
  DropPosition,
} from '@lab2view/vue-email-editor'

Released under the MIT License.