MCPcopy Index your code
hub / github.com/TruthHun/BookStack / gutterEvent

Function gutterEvent

static/editor.md/lib/codemirror/lib/codemirror.js:3678–3699  ·  view source on GitHub ↗
(cm, e, type, prevent, signalfn)

Source from the content-addressed store, hash-verified

3676 // Determines whether an event happened in the gutter, and fires the
3677 // handlers for the corresponding event.
3678 function gutterEvent(cm, e, type, prevent, signalfn) {
3679 try { var mX = e.clientX, mY = e.clientY; }
3680 catch(e) { return false; }
3681 if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false;
3682 if (prevent) e_preventDefault(e);
3683
3684 var display = cm.display;
3685 var lineBox = display.lineDiv.getBoundingClientRect();
3686
3687 if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e);
3688 mY -= lineBox.top - display.viewOffset;
3689
3690 for (var i = 0; i < cm.options.gutters.length; ++i) {
3691 var g = display.gutters.childNodes[i];
3692 if (g && g.getBoundingClientRect().right >= mX) {
3693 var line = lineAtHeight(cm.doc, mY);
3694 var gutter = cm.options.gutters[i];
3695 signalfn(cm, type, cm, line, gutter, e);
3696 return e_defaultPrevented(e);
3697 }
3698 }
3699 }
3700
3701 function clickInGutter(cm, e) {
3702 return gutterEvent(cm, e, "gutterClick", true, signalLater);

Callers 2

clickInGutterFunction · 0.70
contextMenuInGutterFunction · 0.70

Calls 3

hasHandlerFunction · 0.70
e_defaultPreventedFunction · 0.70
lineAtHeightFunction · 0.70

Tested by

no test coverage detected