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

Function onFocus

static/editor.md/lib/codemirror/lib/codemirror.js:4053–4069  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

4051 // FOCUS/BLUR EVENTS
4052
4053 function onFocus(cm) {
4054 if (cm.options.readOnly == "nocursor") return;
4055 if (!cm.state.focused) {
4056 signal(cm, "focus", cm);
4057 cm.state.focused = true;
4058 addClass(cm.display.wrapper, "CodeMirror-focused");
4059 // This test prevents this from firing when a context
4060 // menu is closed (since the input reset would kill the
4061 // select-all detection hack)
4062 if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
4063 cm.display.input.reset();
4064 if (webkit) setTimeout(function() { cm.display.input.reset(true); }, 20); // Issue #1730
4065 }
4066 cm.display.input.receivedFocus();
4067 }
4068 restartBlink(cm);
4069 }
4070 function onBlur(cm) {
4071 if (cm.state.focused) {
4072 signal(cm, "blur", cm);

Callers 1

ensureFocusFunction · 0.70

Calls 2

restartBlinkFunction · 0.70
addClassFunction · 0.50

Tested by

no test coverage detected