Skip to content

Commit

Permalink
🐛 关闭地球仪按钮点击前的保护
Browse files Browse the repository at this point in the history
  • Loading branch information
Littlefean committed Jan 4, 2025
1 parent fbf4d9a commit 0ba2e4e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion docs-pg/ProjectGraph开发进程图.json
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@
"text": "可以自定义的颜色管理面板",
"uuid": "eed8a19b-962b-4387-91b7-45390c214a0d",
"details": "",
"color": [0, 0, 0, 0],
"color": [22, 163, 74, 1],
"type": "core:text_node"
},
{
Expand Down
45 changes: 24 additions & 21 deletions src/pages/_toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ import { ViewFlashEffect } from "../core/effect/concrete/ViewFlashEffect";
import { Stage } from "../core/stage/Stage";
import { StageDumper } from "../core/stage/StageDumper";
import { StageDumperSvg } from "../core/stage/StageDumperSvg";
import { StageSaveManager } from "../core/stage/StageSaveManager";
// import { StageSaveManager } from "../core/stage/StageSaveManager";
import { Dialog } from "../utils/dialog";
import { exists, writeTextFile } from "../utils/fs";
import { writeTextFile } from "../utils/fs";
import { Popup } from "../utils/popup";
import { PathString } from "../utils/pathString";
// import { PathString } from "../utils/pathString";
import ColorManagerPanel from "./_color_manager_panel";
import { ColorManager } from "../core/ColorManager";

Expand Down Expand Up @@ -378,11 +378,11 @@ export default function Toolbar({ className = "" }: { className?: string }) {
icon={<Globe />}
handleFunction={async () => {
// 先保存一下
if (!StageSaveManager.isSaved()) {
await StageSaveManager.saveHandleWithoutCurrentPath(
StageDumper.dump(),
);
}
// if (!StageSaveManager.isSaved()) {
// await StageSaveManager.saveHandleWithoutCurrentPath(
// StageDumper.dump(),
// );
// }
// 打开文件或网页
openBrowserOrFile();
}}
Expand Down Expand Up @@ -519,19 +519,22 @@ async function openBrowserOrFile() {
// 去除前后的引号
nodeText = nodeText.slice(1, -1);
}
if (PathString.isValidURL(nodeText)) {
// 是网址
myOpen(nodeText);
} else {
const isExists = await exists(nodeText);
if (isExists) {
// 是文件
myOpen(nodeText);
} else {
// 不是网址也不是文件,不做处理
Stage.effects.push(new TextRiseEffect("非法文件路径: " + nodeText));
}
}
myOpen(nodeText);
// 2025年1月4日——有自动备份功能了,好像不需要再加验证了

// if (PathString.isValidURL(nodeText)) {
// // 是网址
// myOpen(nodeText);
// } else {
// const isExists = await exists(nodeText);
// if (isExists) {
// // 是文件
// myOpen(nodeText);
// } else {
// // 不是网址也不是文件,不做处理
// Stage.effects.push(new TextRiseEffect("非法文件路径: " + nodeText));
// }
// }
}
}
}
Expand Down

0 comments on commit 0ba2e4e

Please sign in to comment.