AI image recognition supports pasting image from clipboard in desktop version

This commit is contained in:
MaysWind
2025-09-29 19:36:31 +08:00
parent 46dd2888a6
commit 5b37ea4d78
15 changed files with 37 additions and 16 deletions
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "AI Image Recognition",
"Unable to load image": "Unable to load image",
"Unable to recognize image": "Unable to recognize image",
"Drag and drop a receipt or transaction image here, or click to select one": "Drag and drop a receipt or transaction image here, or click to select one",
"You can drag and drop, paste or click to select a receipt or transaction image": "You can drag and drop, paste or click to select a receipt or transaction image",
"Release to load image": "Release to load image",
"Loading image...": "Loading image...",
"Click here to select a receipt or transaction image": "Click here to select a receipt or transaction image",
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "AI Image Recognition",
"Unable to load image": "Unable to load image",
"Unable to recognize image": "Unable to recognize image",
"Drag and drop a receipt or transaction image here, or click to select one": "Drag and drop a receipt or transaction image here, or click to select one",
"You can drag and drop, paste or click to select a receipt or transaction image": "You can drag and drop, paste or click to select a receipt or transaction image",
"Release to load image": "Release to load image",
"Loading image...": "Loading image...",
"Click here to select a receipt or transaction image": "Click here to select a receipt or transaction image",
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "AI Image Recognition",
"Unable to load image": "Unable to load image",
"Unable to recognize image": "Unable to recognize image",
"Drag and drop a receipt or transaction image here, or click to select one": "Drag and drop a receipt or transaction image here, or click to select one",
"You can drag and drop, paste or click to select a receipt or transaction image": "You can drag and drop, paste or click to select a receipt or transaction image",
"Release to load image": "Release to load image",
"Loading image...": "Loading image...",
"Click here to select a receipt or transaction image": "Click here to select a receipt or transaction image",
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "Reconnaissance d'image IA",
"Unable to load image": "Impossible de charger l'image",
"Unable to recognize image": "Impossible de reconnaître l'image",
"Drag and drop a receipt or transaction image here, or click to select one": "Glissez-déposez un reçu ou une image de transaction ici, ou cliquez pour en sélectionner une",
"You can drag and drop, paste or click to select a receipt or transaction image": "You can drag and drop, paste or click to select a receipt or transaction image",
"Release to load image": "Relâchez pour charger l'image",
"Loading image...": "Loading image...",
"Click here to select a receipt or transaction image": "Cliquez ici pour sélectionner un reçu ou une image de transaction",
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "AI Image Recognition",
"Unable to load image": "Unable to load image",
"Unable to recognize image": "Unable to recognize image",
"Drag and drop a receipt or transaction image here, or click to select one": "Drag and drop a receipt or transaction image here, or click to select one",
"You can drag and drop, paste or click to select a receipt or transaction image": "You can drag and drop, paste or click to select a receipt or transaction image",
"Release to load image": "Release to load image",
"Loading image...": "Loading image...",
"Click here to select a receipt or transaction image": "Click here to select a receipt or transaction image",
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "AI Image Recognition",
"Unable to load image": "Unable to load image",
"Unable to recognize image": "Unable to recognize image",
"Drag and drop a receipt or transaction image here, or click to select one": "Drag and drop a receipt or transaction image here, or click to select one",
"You can drag and drop, paste or click to select a receipt or transaction image": "You can drag and drop, paste or click to select a receipt or transaction image",
"Release to load image": "Release to load image",
"Loading image...": "Loading image...",
"Click here to select a receipt or transaction image": "Click here to select a receipt or transaction image",
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "AI Image Recognition",
"Unable to load image": "Unable to load image",
"Unable to recognize image": "Unable to recognize image",
"Drag and drop a receipt or transaction image here, or click to select one": "Drag and drop a receipt or transaction image here, or click to select one",
"You can drag and drop, paste or click to select a receipt or transaction image": "You can drag and drop, paste or click to select a receipt or transaction image",
"Release to load image": "Release to load image",
"Loading image...": "Loading image...",
"Click here to select a receipt or transaction image": "Click here to select a receipt or transaction image",
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "AI Image Recognition",
"Unable to load image": "Unable to load image",
"Unable to recognize image": "Unable to recognize image",
"Drag and drop a receipt or transaction image here, or click to select one": "Drag and drop a receipt or transaction image here, or click to select one",
"You can drag and drop, paste or click to select a receipt or transaction image": "You can drag and drop, paste or click to select a receipt or transaction image",
"Release to load image": "Release to load image",
"Loading image...": "Loading image...",
"Click here to select a receipt or transaction image": "Click here to select a receipt or transaction image",
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "AI Image Recognition",
"Unable to load image": "Unable to load image",
"Unable to recognize image": "Unable to recognize image",
"Drag and drop a receipt or transaction image here, or click to select one": "Drag and drop a receipt or transaction image here, or click to select one",
"You can drag and drop, paste or click to select a receipt or transaction image": "You can drag and drop, paste or click to select a receipt or transaction image",
"Release to load image": "Release to load image",
"Loading image...": "Loading image...",
"Click here to select a receipt or transaction image": "Click here to select a receipt or transaction image",
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "การจดจำภาพด้วย AI",
"Unable to load image": "ไม่สามารถโหลดรูปภาพได้",
"Unable to recognize image": "ไม่สามารถจดจำรูปภาพได้",
"Drag and drop a receipt or transaction image here, or click to select one": "ลากและวางใบเสร็จหรือรูปภาพรายการที่นี่ หรือคลิกเพื่อเลือก",
"You can drag and drop, paste or click to select a receipt or transaction image": "You can drag and drop, paste or click to select a receipt or transaction image",
"Release to load image": "ปล่อยเพื่อโหลดรูปภาพ",
"Loading image...": "Loading image...",
"Click here to select a receipt or transaction image": "คลิกที่นี่เพื่อเลือกใบเสร็จหรือรูปภาพรายการ",
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "AI Image Recognition",
"Unable to load image": "Unable to load image",
"Unable to recognize image": "Unable to recognize image",
"Drag and drop a receipt or transaction image here, or click to select one": "Drag and drop a receipt or transaction image here, or click to select one",
"You can drag and drop, paste or click to select a receipt or transaction image": "You can drag and drop, paste or click to select a receipt or transaction image",
"Release to load image": "Release to load image",
"Loading image...": "Loading image...",
"Click here to select a receipt or transaction image": "Click here to select a receipt or transaction image",
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "AI Image Recognition",
"Unable to load image": "Unable to load image",
"Unable to recognize image": "Unable to recognize image",
"Drag and drop a receipt or transaction image here, or click to select one": "Drag and drop a receipt or transaction image here, or click to select one",
"You can drag and drop, paste or click to select a receipt or transaction image": "You can drag and drop, paste or click to select a receipt or transaction image",
"Release to load image": "Release to load image",
"Loading image...": "Loading image...",
"Click here to select a receipt or transaction image": "Click here to select a receipt or transaction image",
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "AI识图",
"Unable to load image": "无法加载图片",
"Unable to recognize image": "无法识别图片",
"Drag and drop a receipt or transaction image here, or click to select one": "拖拽收据或交易图片到此处,或点击选择图片",
"You can drag and drop, paste or click to select a receipt or transaction image": "您可以拖拽、粘贴或点击选择收据或交易图片",
"Release to load image": "释放以加载图片",
"Loading image...": "正在加载图片...",
"Click here to select a receipt or transaction image": "点击这里选择收据或交易图片",
+1 -1
View File
@@ -1735,7 +1735,7 @@
"AI Image Recognition": "AI識圖",
"Unable to load image": "無法載入圖片",
"Unable to recognize image": "無法識別圖片",
"Drag and drop a receipt or transaction image here, or click to select one": "將收據或交易圖片拖放到此處,或點擊選擇圖片",
"You can drag and drop, paste or click to select a receipt or transaction image": "您可以拖放、貼上或點擊選擇收據或交易圖片",
"Release to load image": "放開以載入圖片",
"Loading image...": "正在載入圖片...",
"Click here to select a receipt or transaction image": "點擊這裡選擇收據或交易圖片",
@@ -1,5 +1,5 @@
<template>
<v-dialog width="800" :persistent="loading || recognizing || !!imageFile" v-model="showState">
<v-dialog width="800" :persistent="loading || recognizing || !!imageFile" v-model="showState" @paste="onPaste">
<v-card class="pa-2 pa-sm-4 pa-md-4">
<template #title>
<div class="d-flex align-center justify-center">
@@ -15,7 +15,7 @@
@drop.prevent="onDrop">
<div class="d-flex w-100 fill-height justify-center align-center justify-content-center px-4"
:class="{ 'dropzone': true, 'dropzone-dragover': isDragOver }" style="height: 480px">
<h3 class="pa-2 bg-grey-200" v-if="!loading && !imageFile && !isDragOver">{{ tt('Drag and drop a receipt or transaction image here, or click to select one') }}</h3>
<h3 class="pa-2 bg-grey-200" v-if="!loading && !imageFile && !isDragOver">{{ tt('You can drag and drop, paste or click to select a receipt or transaction image') }}</h3>
<h3 class="pa-2 bg-grey-200" v-if="!loading && isDragOver">{{ tt('Release to load image') }}</h3>
<h3 class="pa-2" v-if="loading">{{ tt('Loading image...') }}</h3>
</div>
@@ -219,6 +219,27 @@ function onDrop(event: DragEvent): void {
}
}
function onPaste(event: ClipboardEvent) {
if (!event.clipboardData) {
event.preventDefault();
return;
}
for (let i = 0; i < event.clipboardData.items.length; i++) {
const item = event.clipboardData.items[i];
if (item && item.type.startsWith('image/')) {
const file = item.getAsFile();
if (file) {
loadImage(file);
event.preventDefault();
return;
}
}
}
}
defineExpose({
open
});