"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/display/focus.js" between
CodeMirror-5.58.2.tar.gz and CodeMirror-5.58.3.tar.gz

About: CodeMirror is a text editor implemented in JavaScript for the browser and specialized for editing code.

focus.js  (CodeMirror-5.58.2):focus.js  (CodeMirror-5.58.3)
import { restartBlink } from "./selection.js" import { restartBlink } from "./selection.js"
import { webkit } from "../util/browser.js" import { webkit } from "../util/browser.js"
import { addClass, rmClass } from "../util/dom.js" import { addClass, rmClass } from "../util/dom.js"
import { signal } from "../util/event.js" import { signal } from "../util/event.js"
export function ensureFocus(cm) { export function ensureFocus(cm) {
if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm) } if (!cm.hasFocus()) {
cm.display.input.focus()
if (!cm.state.focused) onFocus(cm)
}
} }
export function delayBlurEvent(cm) { export function delayBlurEvent(cm) {
cm.state.delayingBlurEvent = true cm.state.delayingBlurEvent = true
setTimeout(() => { if (cm.state.delayingBlurEvent) { setTimeout(() => { if (cm.state.delayingBlurEvent) {
cm.state.delayingBlurEvent = false cm.state.delayingBlurEvent = false
onBlur(cm) if (cm.state.focused) onBlur(cm)
} }, 100) } }, 100)
} }
export function onFocus(cm, e) { export function onFocus(cm, e) {
if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false if (cm.state.delayingBlurEvent && !cm.state.draggingText) cm.state.delayingBlu rEvent = false
if (cm.options.readOnly == "nocursor") return if (cm.options.readOnly == "nocursor") return
if (!cm.state.focused) { if (!cm.state.focused) {
signal(cm, "focus", cm, e) signal(cm, "focus", cm, e)
cm.state.focused = true cm.state.focused = true
addClass(cm.display.wrapper, "CodeMirror-focused") addClass(cm.display.wrapper, "CodeMirror-focused")
// This test prevents this from firing when a context // This test prevents this from firing when a context
// menu is closed (since the input reset would kill the // menu is closed (since the input reset would kill the
// select-all detection hack) // select-all detection hack)
if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) { if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
 End of changes. 3 change blocks. 
3 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)