feat: add evidence search and stabilize pdf previews
- add document evidence parsing/search/open routes, Hermes tool wiring, local index settings/status, and the document-evidence skill plus design notes - fix PDF resource tabs by rendering PDFs inline with pdf.js canvases instead of iframe preview pages, release PDF documents on close, and document the fourth-PDF stall bug - keep PDF preview at 2x rendering while removing the previous lazy-load/placeholder direction, and make dev:hot bind loopback defaults externally reachable Verification: - node --check rust/crates/mnote-web/browser/document-resource-tab-runtime.js - node scripts/task-dev-hot-plan-test.js - cargo test -p mnote-web --manifest-path rust/Cargo.toml pdf_preview_page_does_not_render_visible_toolbar - cargo test -p mnote-web --manifest-path rust/Cargo.toml document_shell_returns_page_aggregate_snapshot - cargo build -p mnote-web --manifest-path rust/Cargo.toml - browser smoke: sequentially opened the four tea_seed_oil_cosmetic PDFs; fourth PDF rendered 15/15 canvases, iframeCount=0, browser errors=0
This commit is contained in:
@@ -253,6 +253,29 @@ import {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
const cssSafe = (value) => {
|
||||
const text = String(value || '');
|
||||
if (window.CSS && typeof window.CSS.escape === 'function') return window.CSS.escape(text);
|
||||
return text.replace(/["\\]/g, '\\$&');
|
||||
};
|
||||
const applyDocumentEvidenceLocatorFromUrl = (root) => {
|
||||
if (!(root instanceof HTMLElement)) return;
|
||||
const url = currentUrl();
|
||||
const blockId = String(url.searchParams.get('blockId') || url.searchParams.get('evidenceBlockId') || '').trim();
|
||||
const lineRange = String(url.searchParams.get('lineRange') || '').trim();
|
||||
if (!blockId && !lineRange) return;
|
||||
root.setAttribute('data-mnote-evidence-open', 'true');
|
||||
if (blockId) root.setAttribute('data-mnote-evidence-block-id', blockId);
|
||||
if (lineRange) root.setAttribute('data-mnote-evidence-line-range', lineRange);
|
||||
const target = blockId ? root.querySelector(`[data-block-id="${cssSafe(blockId)}"]`) : null;
|
||||
if (target instanceof HTMLElement) {
|
||||
root.querySelectorAll('[data-mnote-evidence-text-highlight="true"]').forEach((node) => {
|
||||
if (node instanceof HTMLElement) node.removeAttribute('data-mnote-evidence-text-highlight');
|
||||
});
|
||||
target.setAttribute('data-mnote-evidence-text-highlight', 'true');
|
||||
target.scrollIntoView({ block: 'center', inline: 'nearest' });
|
||||
}
|
||||
};
|
||||
|
||||
const restoreResourceTabInputFromUrl = () => {
|
||||
const url = currentUrl();
|
||||
@@ -785,6 +808,7 @@ import {
|
||||
if (session.projectionSource) runtimeDescriptor.root.setAttribute('data-mnote-projection-source', session.projectionSource);
|
||||
if (session.blockProjectionVersion) runtimeDescriptor.root.setAttribute('data-mnote-block-projection-version', session.blockProjectionVersion);
|
||||
enhanceEditorAttachmentLinksSoon();
|
||||
applyDocumentEvidenceLocatorFromUrl(runtimeDescriptor.root);
|
||||
};
|
||||
view.onError = (event) => {
|
||||
const payload = normalizeEnvelopePayload(event);
|
||||
|
||||
Reference in New Issue
Block a user