File modules/editor/codemirror/src/display/focus.min.js

Last commit: Tue May 22 22:39:49 2018 +0200	Jan Dankert	Fix für PHP 7.2: 'Object' darf nun nicht mehr als Klassennamen verwendet werden. AUCH NICHT IN EINEM NAMESPACE! WTF, wozu habe ich das in einen verfickten Namespace gepackt? Wozu soll der sonst da sein??? Amateure. Daher nun notgedrungen unbenannt in 'BaseObject'.
1 import { restartBlink } from "./selection.js" 2 import { webkit } from "../util/browser.js" 3 import { addClass, rmClass } from "../util/dom.js" 4 import { signal } from "../util/event.js" 5 6 export function ensureFocus(cm) { 7 if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm) } 8 } 9 10 export function delayBlurEvent(cm) { 11 cm.state.delayingBlurEvent = true 12 setTimeout(() => { if (cm.state.delayingBlurEvent) { 13 cm.state.delayingBlurEvent = false 14 onBlur(cm) 15 } }, 100) 16 } 17 18 export function onFocus(cm, e) { 19 if (cm.state.delayingBlurEvent) cm.state.delayingBlurEvent = false 20 21 if (cm.options.readOnly == "nocursor") return 22 if (!cm.state.focused) { 23 signal(cm, "focus", cm, e) 24 cm.state.focused = true 25 addClass(cm.display.wrapper, "CodeMirror-focused") 26 // This test prevents this from firing when a context 27 // menu is closed (since the input reset would kill the 28 // select-all detection hack) 29 if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) { 30 cm.display.input.reset() 31 if (webkit) setTimeout(() => cm.display.input.reset(true), 20) // Issue #1730 32 } 33 cm.display.input.receivedFocus() 34 } 35 restartBlink(cm) 36 } 37 export function onBlur(cm, e) { 38 if (cm.state.delayingBlurEvent) return 39 40 if (cm.state.focused) { 41 signal(cm, "blur", cm, e) 42 cm.state.focused = false 43 rmClass(cm.display.wrapper, "CodeMirror-focused") 44 } 45 clearInterval(cm.display.blinker) 46 setTimeout(() => { if (!cm.state.focused) cm.display.shift = false }, 150) 47 }
Download modules/editor/codemirror/src/display/focus.min.js
History Tue, 22 May 2018 22:39:49 +0200 Jan Dankert Fix für PHP 7.2: 'Object' darf nun nicht mehr als Klassennamen verwendet werden. AUCH NICHT IN EINEM NAMESPACE! WTF, wozu habe ich das in einen verfickten Namespace gepackt? Wozu soll der sonst da sein??? Amateure. Daher nun notgedrungen unbenannt in 'BaseObject'.