try to hotfix the not autofocus
This commit is contained in:
@@ -26,26 +26,22 @@ export const useOverlay = (listen = true) => {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
const scrollToNote = (to: number, wait = false) => {
|
const scrollToNote = (to: number) => {
|
||||||
const go = () => {
|
const go = () => {
|
||||||
if (isMobile.value) {
|
const scrollOptions = isMobile.value
|
||||||
body.scroll({
|
? {
|
||||||
top: to
|
top: to
|
||||||
})
|
|
||||||
} else {
|
|
||||||
body.scroll({
|
|
||||||
left: to
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
: {
|
||||||
|
left: to
|
||||||
|
}
|
||||||
|
|
||||||
|
body.scroll(scrollOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wait) {
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
go()
|
go()
|
||||||
}, 100)
|
}, 80)
|
||||||
} else {
|
|
||||||
go()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -26,16 +26,14 @@ export const useRouteQueryStackedNotes = () => {
|
|||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const index = notes.findIndex((noteSHA) => noteSHA === sha)
|
const index = notes.findIndex((noteSHA) => noteSHA === sha)
|
||||||
|
|
||||||
const hasOneStackedNote = notes.length === 1
|
|
||||||
|
|
||||||
if (isMobile.value) {
|
if (isMobile.value) {
|
||||||
const element = document.querySelector(`.note-${sha}`) as HTMLElement
|
const element = document.querySelector(`.note-${sha}`) as HTMLElement
|
||||||
const top = (index + 1) * (element?.clientHeight ?? height.value)
|
const top = (index + 1) * (element?.clientHeight ?? height.value)
|
||||||
scrollToNote(top, hasOneStackedNote)
|
scrollToNote(top)
|
||||||
} else {
|
} else {
|
||||||
const margin = index * 44
|
const margin = index * 44
|
||||||
const left = (index + 1) * NOTE_WIDTH - margin
|
const left = (index + 1) * NOTE_WIDTH - margin
|
||||||
scrollToNote(left, hasOneStackedNote)
|
scrollToNote(left)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user