broaden anchor detection (not just anchor_N but anchor_anything)
This commit is contained in:
parent
8b0e1c0fa8
commit
4c42baf268
1 changed files with 8 additions and 12 deletions
|
@ -294,18 +294,14 @@ export default defineComponent({
|
|||
});
|
||||
|
||||
function processAnchors(document: XMLDocument): SVGRectElement[] {
|
||||
let result = [];
|
||||
let i = 1;
|
||||
while (true) {
|
||||
let anchor = document.getElementById(`anchor_${i}`) as SVGRectElement | null;
|
||||
if (anchor === null) {
|
||||
break;
|
||||
}
|
||||
console.debug(`[SVG/ANCHORS] Found anchor #${anchor.id}.`);
|
||||
anchor.classList.add("internal");
|
||||
result.push(anchor);
|
||||
i++;
|
||||
}
|
||||
const result: SVGRectElement[] = [];
|
||||
Array.from(document.getElementsByTagName("rect"))
|
||||
.filter((el) => el.id.startsWith("anchor"))
|
||||
.forEach((anchor) => {
|
||||
console.debug(`[SVG/ANCHORS] Found anchor #${anchor.id}.`);
|
||||
anchor.classList.add("internal");
|
||||
result.push(anchor);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue