MCPcopy Create free account
hub / github.com/TruthHun/BookStack / onFocus

Function onFocus

static/mergely/lib/codemirror.js:4227–4245  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

4225 }
4226
4227 function onFocus(cm) {
4228 if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false;
4229
4230 if (cm.options.readOnly == "nocursor") return;
4231 if (!cm.state.focused) {
4232 signal(cm, "focus", cm);
4233 cm.state.focused = true;
4234 addClass(cm.display.wrapper, "CodeMirror-focused");
4235 // This test prevents this from firing when a context
4236 // menu is closed (since the input reset would kill the
4237 // select-all detection hack)
4238 if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
4239 cm.display.input.reset();
4240 if (webkit) setTimeout(function() { cm.display.input.reset(true); }, 20); // Issue #1730
4241 }
4242 cm.display.input.receivedFocus();
4243 }
4244 restartBlink(cm);
4245 }
4246 function onBlur(cm) {
4247 if (cm.state.delayingBlurEvent) return;
4248

Callers 1

ensureFocusFunction · 0.70

Calls 2

restartBlinkFunction · 0.70
addClassFunction · 0.50

Tested by

no test coverage detected