fix(llm): the document viewer ends its non-PDF paths by returning from one async flow instead of sentinel throws that surfaced as page errors
Some checks failed
CI / lint (push) Successful in 34s
CI / notebooks-smoke (push) Successful in 1m41s
Deploy / notebooks (push) Has been skipped
Deploy / zotero (push) Has been skipped
CI / test (push) Failing after 2m25s
Deploy / docs (push) Has been skipped
Deploy / api (push) Has been skipped
Deploy / llm (push) Has been skipped
Deploy / mc (push) Has been skipped
Infra CI / zotero (push) Successful in 14s
Infra CI / docs (push) Successful in 20s
Infra CI / notebooks (push) Successful in 49s
Infra CI / llm (push) Successful in 47s
Infra CI / api (push) Successful in 1m6s
Deploy / report (push) Successful in 12s
Infra CI / mc (push) Failing after 36s
Some checks failed
CI / lint (push) Successful in 34s
CI / notebooks-smoke (push) Successful in 1m41s
Deploy / notebooks (push) Has been skipped
Deploy / zotero (push) Has been skipped
CI / test (push) Failing after 2m25s
Deploy / docs (push) Has been skipped
Deploy / api (push) Has been skipped
Deploy / llm (push) Has been skipped
Deploy / mc (push) Has been skipped
Infra CI / zotero (push) Successful in 14s
Infra CI / docs (push) Successful in 20s
Infra CI / notebooks (push) Successful in 49s
Infra CI / llm (push) Successful in 47s
Infra CI / api (push) Successful in 1m6s
Deploy / report (push) Successful in 12s
Infra CI / mc (push) Failing after 36s
This commit is contained in:
@@ -186,6 +186,7 @@
|
|||||||
pdfjs = null;
|
pdfjs = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function show() {
|
||||||
// ── file list ──
|
// ── file list ──
|
||||||
let files = [];
|
let files = [];
|
||||||
try {
|
try {
|
||||||
@@ -211,11 +212,7 @@
|
|||||||
}
|
}
|
||||||
if (files.length > 1) sel.hidden = false;
|
if (files.length > 1) sel.hidden = false;
|
||||||
const current = files.find(f => f.name === wantFile) || files.find(f => f.renderable) || files[0];
|
const current = files.find(f => f.name === wantFile) || files.find(f => f.renderable) || files[0];
|
||||||
// the "done:" throws below end this module on purpose once a non-PDF
|
|
||||||
// pane is up; keep the console quiet about them
|
|
||||||
window.addEventListener('unhandledrejection', ev => {
|
|
||||||
if (ev.reason && /^done: /.test(String(ev.reason.message || ev.reason))) ev.preventDefault();
|
|
||||||
});
|
|
||||||
sel.value = current.name;
|
sel.value = current.name;
|
||||||
const fileUrl = '/pdf/' + encodeURIComponent(key) + '/file?name=' + encodeURIComponent(current.name);
|
const fileUrl = '/pdf/' + encodeURIComponent(key) + '/file?name=' + encodeURIComponent(current.name);
|
||||||
$('download').href = fileUrl;
|
$('download').href = fileUrl;
|
||||||
@@ -351,7 +348,7 @@
|
|||||||
const find = domFind(pre);
|
const find = domFind(pre);
|
||||||
nav.goTo(1, false);
|
nav.goTo(1, false);
|
||||||
seedFind(find);
|
seedFind(find);
|
||||||
throw new Error('done: text'); // the module's PDF path below must not run
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Word (.docx) via docx-preview: sections become pages; zoom scales
|
// ── Word (.docx) via docx-preview: sections become pages; zoom scales
|
||||||
@@ -414,7 +411,7 @@
|
|||||||
const hashPage = parseInt((location.hash.match(/page=(\d+)/) || [])[1] || '0', 10);
|
const hashPage = parseInt((location.hash.match(/page=(\d+)/) || [])[1] || '0', 10);
|
||||||
nav.goTo(hashPage || wantPage, false);
|
nav.goTo(hashPage || wantPage, false);
|
||||||
seedFind(find);
|
seedFind(find);
|
||||||
throw new Error('done: docx'); // stop before the PDF path
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pdfjs) {
|
if (!pdfjs) {
|
||||||
@@ -666,6 +663,8 @@
|
|||||||
$('find').value = probe;
|
$('find').value = probe;
|
||||||
runFind(probe);
|
runFind(probe);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
show().catch(e => console.warn('viewer:', e && e.message || e));
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user