Skip to content

Commit 98dc9b2

Browse files
committed
🐛 当内容为空时,禁止渲染PNG
1 parent 4fe1bf6 commit 98dc9b2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

app/src/pages/_fixed_panel/_export_png_panel.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Stage } from "../../core/stage/Stage";
99
import { isExportPNGPanelOpenAtom } from "../../state";
1010
import { cn } from "../../utils/cn";
1111
import { PathString } from "../../utils/pathString";
12+
import { StageManager } from "../../core/stage/stageManager/StageManager";
1213

1314
/**
1415
* 导出png的面板
@@ -112,6 +113,14 @@ export default function ExportPNGPanel() {
112113
<div className="my-2 flex justify-center gap-2">
113114
<Button
114115
onClick={() => {
116+
// 如果当前舞台没有内容,则不能渲染
117+
if (StageManager.isEmpty()) {
118+
Dialog.show({
119+
title: "舞台没有内容",
120+
content: "请先添加内容到舞台",
121+
});
122+
return;
123+
}
115124
// 先清空box内部的内容
116125
const exportPngImageBox = document.getElementById("export-png-image-box");
117126
if (exportPngImageBox) {

0 commit comments

Comments
 (0)