feat: 进入插件后自动滚动到顶部

This commit is contained in:
ZiuChen
2022-08-16 12:19:27 +08:00
parent 527d0518ba
commit 4a48da9612
2 changed files with 8 additions and 2 deletions

View File

@@ -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