diff --git a/src/components/svg-icon.vue b/src/components/svg-icon.vue
index e3b27ff..f429e8a 100644
--- a/src/components/svg-icon.vue
+++ b/src/components/svg-icon.vue
@@ -19,6 +19,7 @@
+
@@ -48,7 +49,8 @@
'photo_sample',
'reset_slide',
'zoom_to',
- 'reset_zoom'
+ 'reset_zoom',
+ 'clipboard'
]
return iconList.includes(value)
}
diff --git a/src/pages/detect.vue b/src/pages/detect.vue
index 419d4e9..9d6c690 100644
--- a/src/pages/detect.vue
+++ b/src/pages/detect.vue
@@ -116,6 +116,9 @@
+
+
+
@@ -170,6 +173,7 @@
serverSettings: {},
otherSettings: {},
isCordova: !!window.cordova,
+ secureProtocol: location.protocol == 'https:',
uploadUid: null,
uploadDirty: false,
modelLocation: '',
@@ -312,7 +316,7 @@
if (!this.getInfoUrl) return ''
let structure = this.showResults.find( r => r.resultIndex == this.selectedChip)
return structure ? this.getInfoUrl + structure.label.replaceAll(' ','_') : ''
- }
+ },
},
methods: {
chipGradient (confVal) {
@@ -433,6 +437,22 @@
}).open()
return
}
+ if (mode == 'clipboard') {
+ navigator.clipboard.read().then(clip => {
+ if (!clip[0].types.includes("image/png")) {
+ throw new Error("Clipboard does not contain valid image data.");
+ }
+ return clip[0].getType("image/png");
+ }).then(blob => {
+ let clipImage = URL.createObjectURL(blob);
+ console.log(clipImage)
+ this.getImage(clipImage)
+ }).catch(e => {
+ console.log(e)
+ f7.dialog.alert(`Error pasting image: ${e.message}`)
+ })
+ return
+ }
this.$refs.image_chooser.click()
},
onFail (message) {
@@ -532,6 +552,10 @@
this.detecting = true
resolve('data:image/jpg;base64,' + searchImage)
}
+ if (this.imageLoadMode == 'clipboard') {
+ this.detecting = true
+ resolve(searchImage)
+ }
const reader = new FileReader()
reader.addEventListener("load", () => {
this.detecting = true