Skip to content

Commit

Permalink
svg deprectated
Browse files Browse the repository at this point in the history
  • Loading branch information
salgum1114 committed Nov 1, 2024
1 parent 8744fa4 commit a5ba6b6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
12 changes: 9 additions & 3 deletions src/canvas/objects/Svg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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<SvgObject>(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 }));
});
}
Expand Down

0 comments on commit a5ba6b6

Please sign in to comment.