Skip to content

Commit 84b74d4

Browse files
committed
Refactor text extraction logic in hasOwnText function and update output format in page map generation
1 parent cbc50d5 commit 84b74d4

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Apps/Web/aiplugin/page_map_extractor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function extractPageMapData() {
9898
}
9999

100100
function hasOwnText(el) {
101-
const full = norm(el.innerText, 200);
101+
const full = norm(getDirectText(el), 200);
102102
if (!full || full.length < 3) return false;
103103
if (actionEls.has(el)) return false;
104104
const nested = [...el.querySelectorAll(ACTION_SELECTOR)];
@@ -179,7 +179,7 @@ function extractPageMapData() {
179179
if (node.node_type === "text") {
180180
const kind = (node.kind || "text").toUpperCase();
181181
const vp = node.in_viewport ? "👁" : "↕";
182-
lines.push(` ${vp} [${kind}] "${node.text}"`);
182+
lines.push(` ${vp} [${node.idx}] [${kind}] "${node.text}"`);
183183
} else {
184184
const parts = [`[${node.idx}]`, (node.role || '').toUpperCase()];
185185
if (node.label) parts.push(`label='${node.label}'`);

0 commit comments

Comments
 (0)