MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / cursorState

Function cursorState

tooling/scripts/sidebar-vim-smoke.mjs:158–166  ·  view source on GitHub ↗

The data-sidebar-idx of the currently vim-highlighted sidebar row (or null).

(client)

Source from the content-addressed store, hash-verified

156}
157/** The data-sidebar-idx of the currently vim-highlighted sidebar row (or null). */
158function cursorState(client) {
159 return evaluate(client, `(() => {
160 const el = [...document.querySelectorAll('[data-sidebar-idx]')].find(e => /(^|\\s)vim-cursor/.test(e.className));
161 if (!el) return null;
162 const r = el.getBoundingClientRect();
163 return { idx: Number(el.getAttribute('data-sidebar-idx')), tag: el.tagName, type: el.dataset.sidebarType,
164 text: (el.textContent || '').trim().length, inView: r.top >= -40 && r.bottom <= window.innerHeight + 40 };
165 })()`)
166}
167
168async function main() {
169 await prepareBuild()

Callers 1

mainFunction · 0.85

Calls 1

evaluateFunction · 0.70

Tested by

no test coverage detected