image-editor-canva
Version:
A Canva-like image editor plugin for React
37 lines (36 loc) • 1.11 kB
TypeScript
import { Template } from '../features/editor/services/template-service';
/**
* Utility function to load template data from a directory
* @param templatePath - Path to the template directory containing JSON files and images
* @param imagePath - Base path for template images
* @returns Promise<Template[]> - Array of prepared templates
*/
export declare const loadTemplates: (templatePath: string, imagePath?: string) => Promise<Template[]>;
/**
* Example usage:
*
* // In your project:
* import { loadTemplates } from 'image-editor-canva/utils';
*
* // Load templates from your project's public directory
* const templates = await loadTemplates('/templates');
*
* // Use in Editor component
* <Editor
* initialData={{
* json: "",
* name: "New Project",
* id: '123',
* userId: "anonymous",
* height: 720,
* width: 1280,
* thumbnailUrl: null,
* isTemplate: null,
* isPro: null,
* createdAt: new Date().toISOString(),
* updatedAt: new Date().toISOString(),
* }}
* templates={templates}
* templateImagePath="/templates"
* />
*/