mirror of
https://github.com/vale981/tridactyl
synced 2025-03-06 10:01:39 -05:00
Simplify mark/scroll function
This commit is contained in:
parent
630159eedc
commit
dff6e1aa84
1 changed files with 6 additions and 8 deletions
|
@ -1136,20 +1136,18 @@ export async function markjumpglobal(key: string) {
|
|||
const matchingTabs = await browserBg.tabs.query({url: mark.url})
|
||||
// If there are no matching tabs, open a new one and update the mark's tabId for future use in this session
|
||||
if (!matchingTabs.length) {
|
||||
return openInNewTab(mark.url).then(updateMarkAndScroll())
|
||||
return openInNewTab(mark.url).then(updateMarkAndScroll)
|
||||
}
|
||||
// If there are multiple tabs open with the same url, just pick the first one and update the mark's tabId
|
||||
// for future use in this session
|
||||
return goToTab(matchingTabs[0].id).then(updateMarkAndScroll())
|
||||
return goToTab(matchingTabs[0].id).then(updateMarkAndScroll)
|
||||
}
|
||||
|
||||
function updateMarkAndScroll() {
|
||||
return (tab) => {
|
||||
function updateMarkAndScroll(tab) {
|
||||
mark.tabId = tab.id
|
||||
state.globalMarks = globalMarks
|
||||
scrolltab(tab.id, mark.scrollX, mark.scrollY, `Jumped to mark '${key}'`)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue