MCPcopy Create free account
hub / github.com/atomicdata-dev/atomic-data-browser / focusElement

Function focusElement

data-browser/src/views/DocumentPage.tsx:202–219  ·  view source on GitHub ↗
(goto: number)

Source from the content-addressed store, hash-verified

200 }
201
202 function focusElement(goto: number) {
203 if (goto > elements.length - 1) {
204 goto = elements.length - 1;
205 } else if (goto < 0) {
206 goto = 0;
207 }
208 setCurrent(goto);
209 let found =
210 ref?.current?.children[goto]?.getElementsByClassName('element')[0];
211 if (!found) {
212 found = ref?.current?.children[goto];
213 }
214 if (found) {
215 found.focus();
216 } else {
217 ref.current.focus();
218 }
219 }
220
221 async function deleteElement(number: number) {
222 elements.splice(number, 1);

Callers 6

DocumentPageEditFunction · 0.85
addElementFunction · 0.85
deleteElementFunction · 0.85
setElementFunction · 0.85
moveElementFunction · 0.85
handleNewLineMaybeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected