mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-08 22:54:09 +08:00
fix: 键盘事件触发也会focus 搜索框聚焦统一调用window.focus方法
This commit is contained in:
parent
c1aac6553e
commit
f110bc5dda
@ -176,6 +176,8 @@ const paste = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const focus = () => document.querySelector('.clip-search input')?.focus()
|
||||||
|
|
||||||
const db = new DB(DBPath)
|
const db = new DB(DBPath)
|
||||||
db.init()
|
db.init()
|
||||||
|
|
||||||
@ -192,8 +194,11 @@ watchClipboard(db, (item) => {
|
|||||||
db.addItem(item)
|
db.addItem(item)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
utools.onPluginEnter(() => focus())
|
||||||
|
|
||||||
window.db = db
|
window.db = db
|
||||||
window.copy = copy
|
window.copy = copy
|
||||||
window.paste = paste
|
window.paste = paste
|
||||||
window.openFile = utools.shellOpenPath
|
window.openFile = utools.shellOpenPath
|
||||||
window.getIcon = utools.getFileIcon
|
window.getIcon = utools.getFileIcon
|
||||||
|
window.focus = focus
|
||||||
|
@ -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" type="text" placeholder="🔍 检索剪贴板历史" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -143,9 +143,11 @@ onMounted(() => {
|
|||||||
const target = index === list.length - 1 ? list[0] : list[index + 1]
|
const target = index === list.length - 1 ? list[0] : list[index + 1]
|
||||||
updateShowList(target)
|
updateShowList(target)
|
||||||
} else if (isSearch) {
|
} else if (isSearch) {
|
||||||
document.querySelector('input').focus()
|
window.focus()
|
||||||
} else if (isExit) {
|
} else if (isExit) {
|
||||||
filterText.value = ''
|
filterText.value = ''
|
||||||
|
} else {
|
||||||
|
window.focus() // 其他键盘事件 直接聚焦搜索框
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user