Skip to content

Commit

Permalink
fix: 还是没删好(寄
Browse files Browse the repository at this point in the history
  • Loading branch information
Shua-github committed Dec 29, 2024
1 parent 5c68b56 commit 829b861
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { preloadFont } from "./utils/preload";
const { ClipboardItem } = window;

function App() {
const [rand, setRand] = useState(0);

useEffect(() => {
let controller;
try {
Expand Down Expand Up @@ -160,7 +162,8 @@ function App() {
link.style.display = "none";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);;
document.body.removeChild(link);
setRand(rand + 1);
};

function b64toBlob(b64Data, contentType = null, sliceSize = null) {
Expand All @@ -182,16 +185,18 @@ function App() {

const copy = async () => {
const canvas = document.getElementsByTagName("canvas")[0];
await navigator.clipboard.write([
await navigator.clipboard.write([
new ClipboardItem({
"image/png": b64toBlob(canvas.toDataURL().split(",")[1]),
}),
]);
setOpenCopySnackbar(true);
setRand(rand + 1);
};

return (
<div className="App">
<Info open={infoOpen} handleClose={handleClose} />
<div className="container">
<div className="vertical">
<div className="canvas">
Expand Down

0 comments on commit 829b861

Please sign in to comment.