@parathantl/react-email-editor 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +23487 -1419
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +36 -22
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +23416 -1349
- package/dist/index.js.map +1 -1
- package/package.json +13 -13
package/dist/index.d.ts
CHANGED
|
@@ -78,6 +78,7 @@ interface SpacerBlockProperties {
|
|
|
78
78
|
height: string;
|
|
79
79
|
}
|
|
80
80
|
interface SocialElement {
|
|
81
|
+
id?: string;
|
|
81
82
|
name: string;
|
|
82
83
|
href: string;
|
|
83
84
|
src?: string;
|
|
@@ -131,6 +132,7 @@ interface CountdownBlockProperties {
|
|
|
131
132
|
align: 'left' | 'center' | 'right';
|
|
132
133
|
}
|
|
133
134
|
interface MenuItem {
|
|
135
|
+
id?: string;
|
|
134
136
|
text: string;
|
|
135
137
|
href: string;
|
|
136
138
|
}
|
|
@@ -407,6 +409,8 @@ interface EmailEditorProps {
|
|
|
407
409
|
initialTemplate?: EmailTemplate;
|
|
408
410
|
initialMJML?: string;
|
|
409
411
|
variables?: Variable[];
|
|
412
|
+
/** Initial custom variables to pre-populate (e.g. from a saved template). These appear as user-managed variables with delete buttons. */
|
|
413
|
+
initialCustomVariables?: Variable[];
|
|
410
414
|
imageUploadAdapter?: ImageUploadAdapter;
|
|
411
415
|
onChange?: (template: EmailTemplate) => void;
|
|
412
416
|
onSave?: (mjml: string, html: string) => void;
|
|
@@ -544,6 +548,7 @@ interface EditorProviderProps {
|
|
|
544
548
|
children: ReactNode;
|
|
545
549
|
initialTemplate?: EmailTemplate;
|
|
546
550
|
variables?: Variable[];
|
|
551
|
+
initialCustomVariables?: Variable[];
|
|
547
552
|
imageUploadAdapter?: ImageUploadAdapter;
|
|
548
553
|
onChange?: (template: EmailTemplate) => void;
|
|
549
554
|
onVariablesChange?: (customVariables: Variable[]) => void;
|
|
@@ -562,7 +567,7 @@ interface EditorProviderProps {
|
|
|
562
567
|
onTemplateLoad?: (template: EmailTemplate) => void;
|
|
563
568
|
onHistoryChange?: (canUndo: boolean, canRedo: boolean) => void;
|
|
564
569
|
}
|
|
565
|
-
declare function EditorProvider({ children, initialTemplate, variables: predefinedVariables, imageUploadAdapter, onChange, onVariablesChange, fontFamilies: fontFamiliesProp, fontSizes: fontSizesProp, persistenceKey, persistenceAdapter, onBlockAdd, onBlockRemove, onBlockUpdate, onBlockMove, onSectionAdd, onSectionRemove, onSectionMove, onSelectionChange, onTemplateLoad, onHistoryChange, }: EditorProviderProps): react_jsx_runtime.JSX.Element;
|
|
570
|
+
declare function EditorProvider({ children, initialTemplate, variables: predefinedVariables, initialCustomVariables, imageUploadAdapter, onChange, onVariablesChange, fontFamilies: fontFamiliesProp, fontSizes: fontSizesProp, persistenceKey, persistenceAdapter, onBlockAdd, onBlockRemove, onBlockUpdate, onBlockMove, onSectionAdd, onSectionRemove, onSectionMove, onSelectionChange, onTemplateLoad, onHistoryChange, }: EditorProviderProps): react_jsx_runtime.JSX.Element;
|
|
566
571
|
|
|
567
572
|
declare function parseMJML(mjmlString: string): EmailTemplate;
|
|
568
573
|
|
|
@@ -597,6 +602,18 @@ declare function generateColumnId(): string;
|
|
|
597
602
|
|
|
598
603
|
declare function extractVariableKeys(text: string): string[];
|
|
599
604
|
declare function replaceVariables(text: string, variables: Variable[], useSample?: boolean): string;
|
|
605
|
+
/**
|
|
606
|
+
* Convert plain `{{ key }}` text patterns into VariableNode chip HTML
|
|
607
|
+
* so TipTap parses them as atomic variable nodes instead of plain text.
|
|
608
|
+
*
|
|
609
|
+
* Converts: `{{ customer_name }}`
|
|
610
|
+
* To: `<span data-variable-key="customer_name" class="ee-variable-chip" contenteditable="false">{{ customer_name }}</span>`
|
|
611
|
+
*
|
|
612
|
+
* This is the reverse of `stripVariableChips()` in the MJML generator.
|
|
613
|
+
* Only matches `{{ }}` patterns that are NOT already inside a
|
|
614
|
+
* `data-variable-key` span (to avoid double-wrapping).
|
|
615
|
+
*/
|
|
616
|
+
declare function convertVariablesToChips(html: string): string;
|
|
600
617
|
declare function groupVariables(variables: Variable[]): Map<string, Variable[]>;
|
|
601
618
|
|
|
602
619
|
declare function sanitizeHTML(html: string): string;
|
|
@@ -657,4 +674,4 @@ declare function registerBlockParser(mjmlTag: string, parser: (el: Element) => B
|
|
|
657
674
|
/** Returns set of all registered block types (built-in + custom). */
|
|
658
675
|
declare function getRegisteredBlockTypes(): Set<string>;
|
|
659
676
|
|
|
660
|
-
export { type ActiveTab, BLOCK_DEFINITIONS, type Block, type BlockDefinition, type BlockProperties, type BlockPropertiesMap, type BlockType, type BrowseResult, type ButtonBlockProperties, COLOR_PRESETS, COLUMN_LAYOUTS, type Column, type CountdownBlockProperties, DEFAULT_BLOCK_PROPERTIES, DEFAULT_FONT_SIZES, DEFAULT_GLOBAL_STYLES, DEFAULT_HEAD_METADATA, DEFAULT_SECTION_PROPERTIES, DEFAULT_SOCIAL_PROPERTIES, DEFAULT_VARIABLE_CHIP_STYLE, type DividerBlockProperties, type EditorAction, EditorProvider, type EditorState, EmailEditor, type EmailEditorProps, type EmailEditorRef, type EmailTemplate, FONT_OPTIONS, type GlobalStyles, type HeadMetadata, type HeadingBlockProperties, type HeroBlockProperties, type HtmlBlockProperties, type ImageBlockProperties, type ImageUploadAdapter, type MenuBlockProperties, type MenuItem, type PersistenceAdapter, type Section, type SectionProperties, type SelectionState, type SocialBlockProperties, type SocialElement, type SpacerBlockProperties, type TextBlockProperties, type TransformOptions, type TypedBlock, type UploadOptions, type UploadResult, type ValidationResult, type Variable, type VariableChipStyle, VariableNode, type VideoBlockProperties, compileMJMLToHTML, escapeHTML, extractVariableKeys, generateBlockId, generateColumnId, generateId, generateMJML, generateSectionId, getExtensions, getRegisteredBlockTypes, groupVariables, isSafeURL, localStorageAdapter, narrowBlock, parseMJML, registerBlockGenerator, registerBlockParser, registerBlockProperties, registerBlockRenderer, replaceVariables, sanitizeHTML, sanitizeTemplate, useBlockIndexContext, useConfigContext, useDispatchContext, useEditorDispatch, useEditorFonts, useEditorState, useEditorVariables, useHistoryContext, useImageAdapter, useMethodsContext, useSelectedBlock, useSelectedSection, useSelectionContext, useTemplateContext, validateTemplate };
|
|
677
|
+
export { type ActiveTab, BLOCK_DEFINITIONS, type Block, type BlockDefinition, type BlockProperties, type BlockPropertiesMap, type BlockType, type BrowseResult, type ButtonBlockProperties, COLOR_PRESETS, COLUMN_LAYOUTS, type Column, type CountdownBlockProperties, DEFAULT_BLOCK_PROPERTIES, DEFAULT_FONT_SIZES, DEFAULT_GLOBAL_STYLES, DEFAULT_HEAD_METADATA, DEFAULT_SECTION_PROPERTIES, DEFAULT_SOCIAL_PROPERTIES, DEFAULT_VARIABLE_CHIP_STYLE, type DividerBlockProperties, type EditorAction, EditorProvider, type EditorState, EmailEditor, type EmailEditorProps, type EmailEditorRef, type EmailTemplate, FONT_OPTIONS, type GlobalStyles, type HeadMetadata, type HeadingBlockProperties, type HeroBlockProperties, type HtmlBlockProperties, type ImageBlockProperties, type ImageUploadAdapter, type MenuBlockProperties, type MenuItem, type PersistenceAdapter, type Section, type SectionProperties, type SelectionState, type SocialBlockProperties, type SocialElement, type SpacerBlockProperties, type TextBlockProperties, type TransformOptions, type TypedBlock, type UploadOptions, type UploadResult, type ValidationResult, type Variable, type VariableChipStyle, VariableNode, type VideoBlockProperties, compileMJMLToHTML, convertVariablesToChips, escapeHTML, extractVariableKeys, generateBlockId, generateColumnId, generateId, generateMJML, generateSectionId, getExtensions, getRegisteredBlockTypes, groupVariables, isSafeURL, localStorageAdapter, narrowBlock, parseMJML, registerBlockGenerator, registerBlockParser, registerBlockProperties, registerBlockRenderer, replaceVariables, sanitizeHTML, sanitizeTemplate, useBlockIndexContext, useConfigContext, useDispatchContext, useEditorDispatch, useEditorFonts, useEditorState, useEditorVariables, useHistoryContext, useImageAdapter, useMethodsContext, useSelectedBlock, useSelectedSection, useSelectionContext, useTemplateContext, validateTemplate };
|