Skip to main content

Easy Email Pro core

Methods

EditorCore

export class EditorCore {
static toMJML(options: JsonToMjmlOption): string;

static elementToMjml(
node: NodeElement,
options: Omit<JsonToMjmlOption, "element"> & {
pageElement: NodeElement;
}
): string;

static renderWithData(html: string, data: Record<string, any>): string;

static isPageDataVariable(text: string): string;
static getPageDataVariables(
page: PageElement,
attributesVariables: Record<string, any>
): Record<string, any>;

static renderWithPageVariables<T extends Object | string>(
obj: T,
data?: Record<string, any>
): T;

static mjmlToBlockElement(mjml: string): Element;

static getUniversalElements(data: { content: Element }): Record<
string,
{
idx: string;
blockData: Element;
}[]
>;

static transformUniversalElements<
T extends {
content: Element;
universalElements: Record<string, Element>;
}
>(data: T): T["content"];

// static mjmlToJson see easy-email-pro-theme
}

BlockManager

export class BlockManager {
public static registerBlocks(blocks: Array<ElementDefinition<any>>): void;

public static getBlockByType<T extends Element["type"]>(type: T): Element;

public static getBlocks(): Array<Element>;

public static getBlockTitle(blockData: Element): string;
}

NodeUtils

export class NodeUtils {
static isVoidBlockElement(node: TextNode | Node): boolean;

static isUnsetElement(node: TextNode | Node): boolean;

static isTextNode(node: TextNode | Node): boolean;

static isElement(node: TextNode | Node): boolean;

static isBlockElement(node: TextNode | Node): boolean;

static isUniversalElement(node: TextNode | Node): boolean;

static isInlineElement(node: TextNode | Node): boolean;

static isMergetagElement(node: TextNode | Node): boolean;

static isContentElementCategory(type: ElementCategoryType): boolean;

static isPageElement(node: Node | TextNode): boolean;

static isSectionElement(node: TextNode | Node): boolean;

static isWrapperElement(node: TextNode | Node): boolean;

static isGroupElement(node: TextNode | Node): boolean;

static isColumnElement(node: TextNode | Node): boolean;

static isContentElement(node: TextNode | Node): boolean;

static isTextElement(node: TextNode | Node): boolean;

static isPlaceholderElement(node: TextNode | Node): boolean;

static isTextListElement(node: TextNode | Node): boolean;

static isTextListItemElement(node: TextNode | Node): boolean;

static isMergeTag(value: string): boolean;

static isParentCategory(
cat: ElementCategoryType,
parentCat: ElementCategoryType
): boolean;

static isParentCategoryType(
childType: Element["type"],
parentType: Element["type"]
): boolean;
}

TemplateEngineManager

export class TemplateEngineManager {
private static tags = {
iteration: generateIterationTemplate,
condition: generateConditionTemplate,
variable: generateVariable,
};

public static setTag(option: IterationTemplate | ConditionTemplate): void;

public static generateTagTemplate<
T extends keyof (typeof TemplateEngineManager)["tags"]
>(name: T): (typeof TemplateEngineManager)["tags"][T] {
return this.tags[name];
}
}

Components

  • BlockRenderer

  • BasicBlock

  • ContentLeaf

  • ContentEditableBlock

Elements

export {
Wrapper,
Section,
Column,
Text,
Button,
Image,
Raw,
Spacer,
Group,
Divider,
Navbar,
NavbarLink,
Social,
SocialElement,
Hero,
ForEach,
Show,
};