feat: 鼠标点击历史记录后退出插件并隐藏主输入框

This commit is contained in:
ZiuChen 2022-08-15 12:52:55 +08:00
parent 01d71a042e
commit 75ccc5f5f2

View File

@ -102,7 +102,7 @@ class DB {
} }
// inu1255: pbpaste & watchClipboard // inu1255: pbpaste & watchClipboard
function pbpaste() { const pbpaste = () => {
const files = utools.getCopyedFiles() // null | Array const files = utools.getCopyedFiles() // null | Array
if (files) { if (files) {
return { return {
@ -121,7 +121,7 @@ function pbpaste() {
if (text.trim()) return { type: 'text', data: text } if (text.trim()) return { type: 'text', data: text }
} }
function watchClipboard(db, fn) { const watchClipboard = (db, fn) => {
let prev = db.dataBase.data[0] || {} let prev = db.dataBase.data[0] || {}
setInterval(() => { setInterval(() => {
const item = pbpaste() const item = pbpaste()
@ -137,7 +137,7 @@ function watchClipboard(db, fn) {
}, 500) }, 500)
} }
function copy(item) { const copy = (item) => {
switch (item.type) { switch (item.type) {
case 'text': case 'text':
clipboard.writeText(item.data) clipboard.writeText(item.data)
@ -152,6 +152,7 @@ function copy(item) {
break break
} }
utools.outPlugin() utools.outPlugin()
utools.hideMainWindow()
} }
const path = `${home}\\${dbName}` const path = `${home}\\${dbName}`