image-editor-canva
Version:
A Canva-like image editor plugin for React
46 lines (45 loc) • 1.52 kB
TypeScript
import { fabric } from 'fabric';
/**
* Checks if the given type is a text type
*/
export declare const isTextType: (type?: string) => type is "text" | "textbox" | "i-text";
/**
* Downloads a file with the given data URL and format
*/
export declare const downloadFile: (dataUrl: string, format: string) => void;
/**
* Transforms text objects in preparation for export
*/
export declare const transformText: (objects: any[]) => Promise<void>;
/**
* Creates a filter based on the given type
*/
export declare const createFilter: (type: string) => fabric.IBaseFilter | undefined;
/**
* Centers an object in the canvas
*/
export declare const centerObjectInCanvas: (canvas: fabric.Canvas, object: fabric.Object) => void;
/**
* Generates a random ID
*/
export declare const generateRandomId: () => string;
/**
* Gets a property value from an object
*/
export declare const getPropertyValue: (object: fabric.Object, property: string) => any;
/**
* Merges two objects deeply
*/
export declare const deepMerge: (target: any, source: any) => any;
/**
* Creates a debounced version of a function
*/
export declare const debounce: <F extends (...args: any[]) => any>(func: F, waitFor: number) => (...args: Parameters<F>) => ReturnType<F>;
/**
* Loads a font using the FontFace API if available
*/
export declare const loadFont: (fontFamily: string, url: string) => Promise<boolean>;
/**
* Converts a Base64 string to a Blob
*/
export declare const base64ToBlob: (base64: string, mimeType: string) => Blob;