MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / onFocus

Function onFocus

lib/web/CodeMirror/src/display/focus.js:21–39  ·  view source on GitHub ↗
(cm, e)

Source from the content-addressed store, hash-verified

19}
20
21export function onFocus(cm, e) {
22 if (cm.state.delayingBlurEvent && !cm.state.draggingText) cm.state.delayingBlurEvent = false
23
24 if (cm.options.readOnly == "nocursor") return
25 if (!cm.state.focused) {
26 signal(cm, "focus", cm, e)
27 cm.state.focused = true
28 addClass(cm.display.wrapper, "CodeMirror-focused")
29 // This test prevents this from firing when a context
30 // menu is closed (since the input reset would kill the
31 // select-all detection hack)
32 if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
33 cm.display.input.reset()
34 if (webkit) setTimeout(() => cm.display.input.reset(true), 20) // Issue #1730
35 }
36 cm.display.input.receivedFocus()
37 }
38 restartBlink(cm)
39}
40export function onBlur(cm, e) {
41 if (cm.state.delayingBlurEvent) return
42

Callers 3

CodeMirrorFunction · 0.90
registerEventHandlersFunction · 0.90
ensureFocusFunction · 0.70

Calls 5

signalFunction · 0.90
addClassFunction · 0.90
restartBlinkFunction · 0.90
resetMethod · 0.65
receivedFocusMethod · 0.45

Tested by

no test coverage detected