Skip to content

Commit

Permalink
fix: streamline image paste handling in clipboard event
Browse files Browse the repository at this point in the history
  • Loading branch information
SelfMadeSystem authored and crutchcorn committed Jan 14, 2025
1 parent 3ff42d7 commit 4762179
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions website/src/page-components/index/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ const App = () => {
if (!event.clipboardData) return;
const items = event.clipboardData.items;
for (const item of items) {
if (item.type.indexOf("image") !== -1) {
const blob = item.getAsFile();
const fileURL = URL.createObjectURL(blob!);
setImage(fileURL);
break;
}
if (item.type.indexOf("image") === -1) continue;
const blob = item.getAsFile();
const fileURL = URL.createObjectURL(blob!);
setImage(fileURL);
return;
}
};

Expand Down

0 comments on commit 4762179

Please sign in to comment.