@@ -13,6 +13,8 @@ import { Section } from "../../../stage/stageObject/entity/Section";
1313import { TextNode } from "../../../stage/stageObject/entity/TextNode" ;
1414import { StageStyleManager } from "../../feedbackService/stageStyle/StageStyleManager" ;
1515import { ImageNode } from "../../../stage/stageObject/entity/ImageNode" ;
16+ import { Stage } from "../../../stage/Stage" ;
17+ import { PathString } from "../../../../utils/pathString" ;
1618
1719/**
1820 * 将舞台当前内容导出为SVG
@@ -60,7 +62,13 @@ export namespace StageExportSvg {
6062 export function dumpEdge ( edge : LineEdge ) : React . ReactNode {
6163 return EdgeRenderer . getEdgeSvg ( edge ) ;
6264 }
63- export function dumpImageNode ( node : ImageNode ) {
65+ /**
66+ *
67+ * @param node
68+ * @param absolutePath 是否使用绝对路径
69+ * @returns
70+ */
71+ export function dumpImageNode ( node : ImageNode , absolutePath : boolean = false ) {
6472 if ( node . isHiddenBySectionCollapse ) {
6573 return < > </ > ;
6674 }
@@ -73,7 +81,9 @@ export namespace StageExportSvg {
7381 2 ,
7482 ) }
7583 < image
76- href = { node . path }
84+ href = {
85+ absolutePath ? PathString . dirPath ( Stage . path . getFilePath ( ) ) + PathString . getSep ( ) + node . path : node . path
86+ }
7787 x = { node . rectangle . leftTop . x }
7888 y = { node . rectangle . leftTop . y }
7989 width = { node . rectangle . size . x }
@@ -137,7 +147,7 @@ export namespace StageExportSvg {
137147 } else if ( entity instanceof Section ) {
138148 return dumpSection ( entity ) ;
139149 } else if ( entity instanceof ImageNode ) {
140- return dumpImageNode ( entity ) ;
150+ return dumpImageNode ( entity ) ; // true 表示使用绝对路径
141151 }
142152 } ) }
143153 { /* 构建连线 */ }
0 commit comments