(cm)
| 4248 | } |
| 4249 | |
| 4250 | function onFocus(cm) { |
| 4251 | if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false; |
| 4252 | |
| 4253 | if (cm.options.readOnly == "nocursor") return; |
| 4254 | if (!cm.state.focused) { |
| 4255 | signal(cm, "focus", cm); |
| 4256 | cm.state.focused = true; |
| 4257 | addClass(cm.display.wrapper, "CodeMirror-focused"); |
| 4258 | // This test prevents this from firing when a context |
| 4259 | // menu is closed (since the input reset would kill the |
| 4260 | // select-all detection hack) |
| 4261 | if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) { |
| 4262 | cm.display.input.reset(); |
| 4263 | if (webkit) setTimeout(function() { cm.display.input.reset(true); }, 20); // Issue #1730 |
| 4264 | } |
| 4265 | cm.display.input.receivedFocus(); |
| 4266 | } |
| 4267 | restartBlink(cm); |
| 4268 | } |
| 4269 | function onBlur(cm) { |
| 4270 | if (cm.state.delayingBlurEvent) return; |
| 4271 |
no test coverage detected