From e2a6b29b53e71461f05a3628e0bf267163404a3f Mon Sep 17 00:00:00 2001 From: yaojp123 <15989103230@163.com> Date: Sat, 14 Dec 2024 15:24:39 +0800 Subject: [PATCH] fix: lose `Copy As Curl` in `Dev Tools` (#33) Co-authored-by: yaojiping --- .../vendor/console/components/ConsoleMenu.tsx | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/web/src/components/vendor/console/components/ConsoleMenu.tsx b/web/src/components/vendor/console/components/ConsoleMenu.tsx index ae36bf08..f9979e8b 100644 --- a/web/src/components/vendor/console/components/ConsoleMenu.tsx +++ b/web/src/components/vendor/console/components/ConsoleMenu.tsx @@ -45,6 +45,7 @@ import { saveCommonCommand } from "../modules/es"; import { pushCommand } from "../modules/mappings/mappings"; import { formatMessage } from "umi/locale"; import { hasAuthority } from "@/utils/authority"; +import { CopyToClipboard } from "react-copy-to-clipboard"; interface Props { getCurl: () => Promise; @@ -177,21 +178,22 @@ export default class ConsoleMenu extends Component { {formatMessage({ id: "console.menu.save_as_command" })} ) } - if (window.navigator?.clipboard) { - items.unshift( + items.unshift( + { this.closePopover(); - this.copyAsCurl(); + notification.open({ + message: "Request copied as cURL", + placement: "bottomRight", + }); }} > {formatMessage({ id: "console.menu.copy_as_curl" })} - ); - } + + ); return (