resend-editor
Version:
A drag-and-drop email editor for React applications
33 lines (26 loc) • 1.3 kB
TypeScript
import * as react_jsx_runtime from 'react/jsx-runtime';
type EmailComponentType = 'text' | 'heading' | 'image' | 'button' | 'divider' | 'spacer' | 'container' | 'section' | 'grid' | 'social' | 'hero' | 'features' | 'header' | 'footer' | 'list' | 'code-inline' | 'code-block' | 'markdown' | 'link';
interface SocialNetwork {
name: string;
href: string;
}
interface EmailComponent {
id: string;
type: EmailComponentType;
props: Record<string, any>;
children?: EmailComponent[];
}
interface EmailTemplate {
components: EmailComponent[];
}
interface EmailEditorProps {
initialTemplate?: EmailTemplate;
onChange?: (template: EmailTemplate) => void;
onUpload?: (file: File) => Promise<string>;
imageUploadUrl?: string;
}
declare function EmailEditor({ initialTemplate, onChange, onUpload, imageUploadUrl }: EmailEditorProps): react_jsx_runtime.JSX.Element;
declare function renderToHtml(components: EmailComponent[]): string;
declare function renderToReactEmail(components: EmailComponent[]): Promise<string>;
declare function generateReactEmailCode(components: EmailComponent[]): string;
export { type EmailComponent, type EmailComponentType, EmailEditor, type EmailTemplate, type SocialNetwork, generateReactEmailCode, renderToHtml, renderToReactEmail };