Skip to content

Commit

Permalink
change path copy function. [skip CI]
Browse files Browse the repository at this point in the history
 due to browser forbid clipboard usage for non-https site.
  • Loading branch information
pigpigyyy committed Apr 12, 2024
1 parent 8fe4012 commit 0a0ff98
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Tools/dora-dora/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1211,11 +1211,19 @@ export default function PersistentDrawerLeft() {
break;
}
case "Copy Path": {
navigator.clipboard.writeText(data.key).then(() => {
addAlert(t("alert.copied", {title: data.title}), "success");
}).catch(() => {
addAlert(t("alert.copy"), "error");
});
if (navigator.clipboard.writeText) {
navigator.clipboard.writeText(data.key).then(() => {
addAlert(t("alert.copied", {title: data.title}), "success");
}).catch(() => {
addAlert(t("alert.copy"), "error");
});
} else {
setPopupInfo({
title: t("alert.tocopy", {title: data.title}),
msg: data.key,
raw: true
});
}
break;
}
}
Expand Down
2 changes: 2 additions & 0 deletions Tools/dora-dora/src/i18n.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ i18n
failedCompile: "not generated {{title}}",
copied: "copied path {{title}}",
copy: "failed to copy path",
tocopy: "Full path for {{title}}",
},
popup: {
goToFile: "Go to File",
Expand Down Expand Up @@ -182,6 +183,7 @@ i18n
failedCompile: "待生成 {{title}}",
copied: "已复制路径 {{title}}",
copy: "复制路径失败",
tocopy: "{{title}} 的完整路径",
},
popup: {
goToFile: "跳转到文件",
Expand Down

0 comments on commit 0a0ff98

Please sign in to comment.