Improve local evidence search and AI capabilities
This commit is contained in:
@@ -267,7 +267,15 @@ import {
|
||||
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;
|
||||
let target = blockId ? root.querySelector(`[data-block-id="${cssSafe(blockId)}"]`) : null;
|
||||
if (!(target instanceof HTMLElement) && lineRange) {
|
||||
const start = Number(String(lineRange).split('-')[0] || 0);
|
||||
if (Number.isFinite(start) && start > 0) {
|
||||
const blocks = Array.from(root.querySelectorAll('.ProseMirror [data-block-id]'))
|
||||
.filter((node) => node instanceof HTMLElement);
|
||||
target = blocks[Math.max(0, Math.min(blocks.length - 1, start - 1))] || 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');
|
||||
@@ -302,6 +310,12 @@ import {
|
||||
title,
|
||||
fileName: title,
|
||||
openTarget: 'active-tab',
|
||||
page: url.searchParams.get('page') || undefined,
|
||||
bbox: url.searchParams.get('bbox') || undefined,
|
||||
sourceMapPath: String(url.searchParams.get('sourceMapPath') || '').trim(),
|
||||
blockId: String(url.searchParams.get('blockId') || '').trim(),
|
||||
lineRange: url.searchParams.get('lineRange') || null,
|
||||
charRange: url.searchParams.get('charRange') || null,
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user