Skip to content

Commit 4762179

Browse files
SelfMadeSystemcrutchcorn
authored andcommitted
fix: streamline image paste handling in clipboard event
1 parent 3ff42d7 commit 4762179

File tree

1 file changed

+5
-6
lines changed
  • website/src/page-components/index

1 file changed

+5
-6
lines changed

website/src/page-components/index/App.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ const App = () => {
1919
if (!event.clipboardData) return;
2020
const items = event.clipboardData.items;
2121
for (const item of items) {
22-
if (item.type.indexOf("image") !== -1) {
23-
const blob = item.getAsFile();
24-
const fileURL = URL.createObjectURL(blob!);
25-
setImage(fileURL);
26-
break;
27-
}
22+
if (item.type.indexOf("image") === -1) continue;
23+
const blob = item.getAsFile();
24+
const fileURL = URL.createObjectURL(blob!);
25+
setImage(fileURL);
26+
return;
2827
}
2928
};
3029

0 commit comments

Comments
 (0)