mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-07-06 09:42:46 +08:00
feat: 区分左右键点击 左键自动粘贴 右键仅复制
This commit is contained in:
parent
b8e03ec5da
commit
0034019189
@ -155,6 +155,14 @@ const copy = (item) => {
|
|||||||
utools.hideMainWindow()
|
utools.hideMainWindow()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const paste = () => {
|
||||||
|
if (utools.isMacOs()) {
|
||||||
|
utools.simulateKeyboardTap('v', 'command')
|
||||||
|
} else {
|
||||||
|
utools.simulateKeyboardTap('v', 'ctrl')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const path = `${home}\\${dbName}`
|
const path = `${home}\\${dbName}`
|
||||||
const db = new DB(path)
|
const db = new DB(path)
|
||||||
db.init()
|
db.init()
|
||||||
@ -174,5 +182,6 @@ watchClipboard(db, (item) => {
|
|||||||
|
|
||||||
window.db = db
|
window.db = db
|
||||||
window.copy = copy
|
window.copy = copy
|
||||||
|
window.paste = paste
|
||||||
window.openFile = utools.shellOpenPath
|
window.openFile = utools.shellOpenPath
|
||||||
window.getIcon = utools.getFileIcon
|
window.getIcon = utools.getFileIcon
|
||||||
|
@ -4,7 +4,8 @@
|
|||||||
class="clip-item"
|
class="clip-item"
|
||||||
v-for="(item, index) in showList"
|
v-for="(item, index) in showList"
|
||||||
:key="item.createTime"
|
:key="item.createTime"
|
||||||
@click="executeCopy(item)"
|
@click.left="handleItemClick($event, item)"
|
||||||
|
@click.right="handleItemClick($event, item)"
|
||||||
>
|
>
|
||||||
<div class="clip-info">
|
<div class="clip-info">
|
||||||
<div class="clip-time">
|
<div class="clip-time">
|
||||||
@ -48,9 +49,18 @@ const props = defineProps({
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
const emit = defineEmits(['onDataChange'])
|
const emit = defineEmits(['onDataChange'])
|
||||||
const executeCopy = (item) => window.copy(item)
|
const handleItemClick = (ev, item) => {
|
||||||
|
const { button } = ev
|
||||||
|
if (button === 0) {
|
||||||
|
// 左键 复制后粘贴
|
||||||
|
window.copy(item)
|
||||||
|
window.paste()
|
||||||
|
} else if (button === 2) {
|
||||||
|
// 右键 仅复制
|
||||||
|
window.copy(item)
|
||||||
|
}
|
||||||
|
}
|
||||||
const onDataChange = (item) => {
|
const onDataChange = (item) => {
|
||||||
console.log(item)
|
|
||||||
emit('onDataChange', item)
|
emit('onDataChange', item)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="clip-search">
|
<div class="clip-search">
|
||||||
<input v-model="filterText" autofocus type="text" placeholder="输入关键词检索" />
|
<input v-model="filterText" autofocus type="text" placeholder="🔍" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user