File size: 635 Bytes
f909d7c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
export const searchQuery = (param: string) => {
return document.querySelectorAll(param);
};
export const cleanupHighlight = () => {
const nodes = document.querySelectorAll("foreignObject.searched, .highlight");
nodes.forEach(node => {
node.classList.remove("highlight", "searched");
});
};
export const highlightMatchedNodes = (nodes: NodeListOf<Element>, selectedNode: number) => {
nodes.forEach(node => {
const foreignObject = node.parentElement?.closest("foreignObject");
if (foreignObject) {
foreignObject.classList.add("searched");
}
});
nodes[selectedNode].classList.add("highlight");
};
|