笙默考试管理系统-MyExamTest----codemirror(15)
目录
一、 笙默考试管理系统-MyExamTest----codemirror
二、 笙默考试管理系统-MyExamTest----codemirror
三、 笙默考试管理系统-MyExamTest----codemirror
四、 笙默考试管理系统-MyExamTest----codemirror
五、 笙默考试管理系统-MyExamTest----codemirror
function focusInput() {
if (!options.readOnly) input.focus();
}
function scrollEditorIntoView() {
if (!cursor.getBoundingClientRect) return;
var rect = cursor.getBoundingClientRect();
// IE returns bogus coordinates when the instance sits inside of an iframe and the cursor is hidden
if (ie && rect.top == rect.bottom) return;
var winH = window.innerHeight || Math.max(document.body.offsetHeight, document.documentElement.offsetHeight);
if (rect.top < 0 || rect.bottom > winH) cursor.scrollIntoView();
}
function scrollCursorIntoView() {
var cursor = localCoords(sel.inverted ? sel.from : sel.to);
var x = options.lineWrapping ? Math.min(cursor.x, lineSpace.offsetWidth) : cursor.x;
return scrollIntoView(x, cursor.y, x, cursor.yBot);
}
function scrollIntoView(x1, y1, x2, y2) {
var pl = paddingLeft(), pt = paddingTop(), lh = textHeight();
y1 += pt; y2 += pt; x1 += pl; x2 += pl;
var screen = scroller.clientHeight, screentop = scroller.scrollTop, scrolled = false, result = true;
if (y1 < screentop) {scroller.scrollTop = Math.max(0, y1 - 2*lh); scrolled = true;}
else if (y2 > screentop + screen) {scroller.scrollTop = y2 + lh - screen; scrolled = true;}
var screenw = scroller.clientWidth, screenleft = scroller.scrollLeft;
var gutterw = options.fixedGutter ? gutter.clientWidth : 0;
if (x1 < screenleft + gutterw) {
if (x1 < 50) x1 = 0;
scroller.scrollLeft = Math.max(0, x1 - 10 - gutterw);
scrolled = true;
}
else if (x2 > screenw + screenleft - 3) {
scroller.scrollLeft = x2 + 10 - screenw;
scrolled = true;
if (x2 > code.clientWidth) result = false;
}
if (scrolled && options.onScroll) options.onScroll(instance);
return result;
}
function visibleLines() {
var lh = textHeight(), top = scroller.scrollTop - paddingTop();
var from_height = Math.max(0, Math.floor(top / lh));
var to_height = Math.ceil((top + scroller.clientHeight) / lh);
return {from: lineAtHeight(doc, from_height),
to: lineAtHeight(doc, to_height)};
}