mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-08 06:16:18 +08:00
feat: 进入插件后自动滚动到顶部
This commit is contained in:
parent
527d0518ba
commit
4a48da9612
@ -178,6 +178,8 @@ const paste = () => {
|
||||
|
||||
const focus = () => document.querySelector('.clip-search input')?.focus()
|
||||
|
||||
const toTop = () => (document.scrollingElement.scrollTop = 0)
|
||||
|
||||
const db = new DB(DBPath)
|
||||
db.init()
|
||||
|
||||
@ -194,7 +196,10 @@ watchClipboard(db, (item) => {
|
||||
db.addItem(item)
|
||||
})
|
||||
|
||||
utools.onPluginEnter(() => focus())
|
||||
utools.onPluginEnter(() => {
|
||||
focus()
|
||||
toTop()
|
||||
})
|
||||
|
||||
window.db = db
|
||||
window.copy = copy
|
||||
@ -202,3 +207,4 @@ window.paste = paste
|
||||
window.openFile = utools.shellOpenPath
|
||||
window.getIcon = utools.getFileIcon
|
||||
window.focus = focus
|
||||
window.toTop = toTop
|
||||
|
@ -56,7 +56,7 @@ const updateShowList = (type) => {
|
||||
.filter((item) => item.data.indexOf(filterText.value) !== -1)
|
||||
.slice(0, GAP)
|
||||
}
|
||||
document.scrollingElement.scrollTop = 0
|
||||
window.toTop()
|
||||
}
|
||||
|
||||
const fullData = ref({ type: 'text', data: '' })
|
||||
|
Loading…
x
Reference in New Issue
Block a user