General.Web/wwwroot/lib/codemirror-5.31.0/src/input/TextareaInput.js
(开头部分) 12KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
import { operation, runInOp } from "../display/operations"
import { prepareSelection } from "../display/selection"
import { applyTextInput, copyableRanges, handlePaste, hiddenTextarea, setLastCopied } from "./input"
import { cursorCoords, posFromMouse } from "../measurement/position_measurement"
import { eventInWidget } from "../measurement/widgets"
import { simpleSelection } from "../model/selection"
import { selectAll, setSelection } from "../model/selection_updates"
import { captureRightClick, ie, ie_version, ios, mac, mobile, presto, webkit } from "../util/browser"
import { activeElt, removeChildrenAndAdd, selectInput } from "../util/dom"
import { e_preventDefault, e_stop, off, on, signalDOMEvent } from "../util/event"
import { hasSelection } from "../util/feature_detection"
import { Delayed, sel_dontScroll } from "../util/misc"
// TEXTAREA INPUT STYLE
export default class TextareaInput {
constructor(cm) {
this.cm = cm
// See input.poll and input.reset
this.prevInput = ""
// Flag that indicates whether we expect input to appear real soon
// now (after some event like 'keypress' or 'input') and are
// polling intensively.
this.pollingFast = false
// Self-resetting timeout for the poller
this.polling = new Delayed()
// Used to work around IE issue with selection being forgotten when focus moves away from textarea
this.hasSelection = false
this.composing = null
}
init(display) {
let input = this, cm = this.cm
// Wraps and hides input textarea
let div = this.wrapper = hiddenTextarea()
// The semihidden textarea that is focused when the editor is
// focused, and receives input.
let te = this.textarea = div.firstChild
display.wrapper.insertBefore(div, display.wrapper.firstChild)
// Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
if (ios) te.style.width = "0px"
on(te, "input", () => {
if (ie && ie_version >= 9 && this.hasSelection) this.hasSelection = null
input.poll()
})
on(te, "paste", e => {
if (signalDOMEvent(cm, e) || handlePaste(e, cm)) return
cm.state.pasteIncoming = true
input.fastPoll()
})
function prepareCopyCut(e) {
if (signalDOMEvent(cm, e)) return
if (cm.somethingSelected()) {
后面还有 290 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
