MCPcopy Create free account
hub / github.com/TextGeneratorio/text-generator.io / initScrollbars

Function initScrollbars

static/libs/codemirror.js:3684–3704  ·  view source on GitHub ↗
(cm)

Source from the content-addressed store, hash-verified

3682var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
3683
3684function initScrollbars(cm) {
3685 if (cm.display.scrollbars) {
3686 cm.display.scrollbars.clear();
3687 if (cm.display.scrollbars.addClass)
3688 { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
3689 }
3690
3691 cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
3692 cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
3693 // Prevent clicks in the scrollbars from killing focus
3694 on(node, "mousedown", function () {
3695 if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
3696 });
3697 node.setAttribute("cm-not-content", "true");
3698 }, function (pos, axis) {
3699 if (axis == "horizontal") { setScrollLeft(cm, pos); }
3700 else { updateScrollTop(cm, pos); }
3701 }, cm);
3702 if (cm.display.scrollbars.addClass)
3703 { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
3704}
3705
3706// Operations are used to wrap a series of changes to the editor
3707// state in such a way that each change won't have to update the

Callers 2

defineOptionsFunction · 0.85
CodeMirror$1Function · 0.85

Calls 7

rmClassFunction · 0.85
setTimeoutFunction · 0.85
setScrollLeftFunction · 0.85
updateScrollTopFunction · 0.85
addClassFunction · 0.85
clearMethod · 0.80
onFunction · 0.70

Tested by

no test coverage detected