MCPcopy Index your code
hub / github.com/027xiguapi/code-box / navigateElement

Function navigateElement

component/ui/customDomSelector.tsx:159–182  ·  view source on GitHub ↗
(direction: "parent" | "child" | "prev" | "next")

Source from the content-addressed store, hash-verified

157 }
158
159 const navigateElement = (direction: "parent" | "child" | "prev" | "next") => {
160 const selector = document.querySelector(".codebox-current")
161 if (!selector) return
162 let newElement: HTMLElement | null = null
163 switch (direction) {
164 case "parent":
165 newElement = selector.parentElement
166 break
167 case "child":
168 newElement = selector.firstElementChild as HTMLElement
169 break
170 case "prev":
171 newElement = selector.previousElementSibling as HTMLElement
172 break
173 case "next":
174 newElement = selector.nextElementSibling as HTMLElement
175 break
176 }
177
178 if (newElement) {
179 highlightElement(newElement)
180 updateTooltipPosition(newElement)
181 }
182 }
183
184 return (
185 <>

Callers

nothing calls this directly

Calls 2

highlightElementFunction · 0.85
updateTooltipPositionFunction · 0.85

Tested by

no test coverage detected