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

Function run

packages/app-core/src/lib/editor-focus.ts:29–45  ·  view source on GitHub ↗
(remaining: number)

Source from the content-addressed store, hash-verified

27 }
28
29 const run = (remaining: number): void => {
30 const state = useStore.getState()
31 const view = state.editorViewRef
32 state.setFocusedPanel('editor')
33 if (!view) {
34 scheduleRetry(remaining)
35 return
36 }
37 view.focus()
38 if (state.vimMode) {
39 const cm = getCM(view)
40 if (cm?.state.vim?.insertMode) {
41 Vim.exitInsertMode(cm as Parameters<typeof Vim.exitInsertMode>[0], true)
42 }
43 }
44 if (!containsFocus(view)) scheduleRetry(remaining)
45 }
46
47 requestAnimationFrame(() => run(attempts))
48}

Callers 3

withPlatformFunction · 0.70
scheduleRetryFunction · 0.70
focusEditorNormalModeFunction · 0.70

Calls 2

scheduleRetryFunction · 0.85
containsFocusFunction · 0.85

Tested by 1

withPlatformFunction · 0.56