Better return from PDF to library

This commit is contained in:
Jackson Harper
2024-06-13 16:11:42 +08:00
parent 900d4b696b
commit a8d1a8f6b3

View File

@ -35,8 +35,9 @@ export default function PdfArticleContainer(
const containerRef = useRef<HTMLDivElement | null>(null)
const [notebookKey, setNotebookKey] = useState<string>(uuidv4())
const [noteTarget, setNoteTarget] = useState<Highlight | undefined>(undefined)
const [noteTargetPageIndex, setNoteTargetPageIndex] =
useState<number | undefined>(undefined)
const [noteTargetPageIndex, setNoteTargetPageIndex] = useState<
number | undefined
>(undefined)
const highlightsRef = useRef<Highlight[]>([])
const annotationOmnivoreId = (annotation: Annotation): string | undefined => {
@ -448,6 +449,11 @@ export default function PdfArticleContainer(
document.dispatchEvent(new Event('openOriginalArticle'))
break
case 'u':
const navReturn = window.sessionStorage.getItem('nav-return')
if (navReturn) {
window.location.assign(navReturn)
return
}
const query = window.sessionStorage.getItem('q')
if (query) {
window.location.assign(`/home?${query}`)