@@ -9,6 +9,12 @@ export type SvgObject = (FabricGroup | FabricObject) & {
99
1010export interface SvgOption extends FabricObjectOption {
1111 src ?: string ;
12+ /**
13+ *
14+ * @deprecated
15+ * @type {* }
16+ */
17+ svg ?: any ;
1218 loadType ?: 'file' | 'svg' ;
1319 keepSize ?: boolean ;
1420}
@@ -66,14 +72,14 @@ const Svg = fabric.util.createClass(fabric.Group, {
6672 return this ;
6773 } ,
6874 loadSvg ( option : SvgOption ) {
69- const { src, loadType, fill, stroke } = option ;
75+ const { src, svg , loadType, fill, stroke } = option ;
7076 return new Promise < SvgObject > ( resolve => {
7177 if ( loadType === 'svg' ) {
72- fabric . loadSVGFromString ( src , ( objects , options ) => {
78+ fabric . loadSVGFromString ( svg || src , ( objects , options ) => {
7379 resolve ( this . addSvgElements ( objects , { ...options , fill, stroke } ) ) ;
7480 } ) ;
7581 } else {
76- fabric . loadSVGFromURL ( src , ( objects , options ) => {
82+ fabric . loadSVGFromURL ( svg || src , ( objects , options ) => {
7783 resolve ( this . addSvgElements ( objects , { ...options , fill, stroke } ) ) ;
7884 } ) ;
7985 }
0 commit comments