feat: Expandable metadata drawer + transcription system (#175, #176) #178

Merged
marcel merged 47 commits from feat/issue-175-176-metadata-drawer-transcription into main 2026-04-06 11:31:11 +02:00
Showing only changes of commit 676d3cb6a7 - Show all commits

View File

@@ -218,9 +218,16 @@ $effect(() => {
});
// Scroll-sync: when activeAnnotationId changes, navigate to its page
let prevActiveAnnotationId: string | null = null;
$effect(() => {
if (!activeAnnotationId || !pdfDoc) return;
const ann = annotations.find((a) => a.id === activeAnnotationId);
const id = activeAnnotationId;
if (!id || id === prevActiveAnnotationId || !pdfDoc) {
prevActiveAnnotationId = id;
return;
}
prevActiveAnnotationId = id;
const ann = annotations.find((a) => a.id === id);
if (!ann) return;
if (ann.pageNumber !== currentPage) {
@@ -228,10 +235,9 @@ $effect(() => {
}
// After page renders, scroll the annotation into view (double-rAF for async render)
const targetId = activeAnnotationId;
requestAnimationFrame(() => {
requestAnimationFrame(() => {
const el = document.querySelector(`[data-testid="annotation-${targetId}"]`);
const el = document.querySelector(`[data-testid="annotation-${id}"]`);
el?.scrollIntoView({ behavior: 'smooth', block: 'center' });
});
});