diff --git a/package.json b/package.json index a2b9e244..804d318e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-design-editor", - "version": "0.0.59", + "version": "0.0.60", "description": "Design Editor Tools with React.js + ant.design + fabric.js", "main": "dist/react-design-editor.min.js", "typings": "lib/index.d.ts", diff --git a/src/canvas/objects/Svg.ts b/src/canvas/objects/Svg.ts index edc27cee..711f9832 100644 --- a/src/canvas/objects/Svg.ts +++ b/src/canvas/objects/Svg.ts @@ -9,6 +9,12 @@ export type SvgObject = (FabricGroup | FabricObject) & { export interface SvgOption extends FabricObjectOption { src?: string; + /** + * + * @deprecated + * @type {*} + */ + svg?: any; loadType?: 'file' | 'svg'; keepSize?: boolean; } @@ -66,14 +72,14 @@ const Svg = fabric.util.createClass(fabric.Group, { return this; }, loadSvg(option: SvgOption) { - const { src, loadType, fill, stroke } = option; + const { src, svg, loadType, fill, stroke } = option; return new Promise(resolve => { if (loadType === 'svg') { - fabric.loadSVGFromString(src, (objects, options) => { + fabric.loadSVGFromString(svg || src, (objects, options) => { resolve(this.addSvgElements(objects, { ...options, fill, stroke })); }); } else { - fabric.loadSVGFromURL(src, (objects, options) => { + fabric.loadSVGFromURL(svg || src, (objects, options) => { resolve(this.addSvgElements(objects, { ...options, fill, stroke })); }); }