mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-09-27 13:53:21 +08:00
feat: 进入插件后自动滚动到顶部
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user