import React, { Component } from "react"; import "../styles/editor.scss"; export type FunctionType = (...args: any) => any; export interface CONFIG_TYPE { div?: HTMLDivElement; debug?: boolean; i18n?: string; saveHandler: FunctionType | null; onCloseHandler?: FunctionType | null; debugPrefix?: string; } export interface MiniEditorProps { config: CONFIG_TYPE; svgContent: string; } declare class MiniEditor extends Component { /** * Creates an instance of Editor * @param {props} EditorProps - config: editor config, svgContent: svg in text format * @example * * */ containerRef: React.RefObject; config: CONFIG_TYPE; svgContent: string; constructor(props: MiniEditorProps); componentDidUpdate(): void; /** * Manage SVG update */ svgUpdate: (svgContent: string) => void; /** * Manage Close */ onClose: () => void; /** * Load svg * @async * @memberof Editor * @method load * @param {String} svgPath svg content * @returns {Promise} return the current editor instance after the SVG is loaded * @example * editor.load('./circle.svg') * .then((editorInstance) => { * console.log('loaded and ready') * }) */ /** * @deprecated Deprecated in favor of direct usage */ load(svgContent: string): void; /** * info displays a log to the console with information about the Editor version * as well as technical informations. * @memberof Editor * @method info * @returns an object containing current Editor configuration */ info(): { version: string; currentConfig: CONFIG_TYPE; container: HTMLDivElement | null; }; /** * getSVG returns the SVG as modified by Editor. * * @memberof Editor * @method getSvg * @returns the SVG that should be saved to keep animation parameters as a string */ getSvg(): string; /** * configure allow to edit the current configuration. * Use case example editor.configure(useCache, true). * Calling configure will put the animation to idle mode * @memberof Editor * @method configure * @param {string} name the setting name * @param {string} value the setting value * @returns {Object} the new configuration if succesful * @throws {Error} when the configuration does not exist * @example * // Toggle the debug mode, logging to the console each function call and its parameters * configure('debug', true) possible values: true|false, default: false * @example * configure('i18n', 'fr') */ configure(name: string, value: string): CONFIG_TYPE; /** * Log debug data to the console * @access private * @memberof Editor * @method logDebugData */ logDebugData: (functionName: string, args?: any) => void; render(): import("react/jsx-runtime").JSX.Element; } export default MiniEditor;