MCPcopy Create free account
hub / github.com/TruthHun/BookStack / gutterClicked

Function gutterClicked

static/mergely/lib/mergely.js:749–769  ·  view source on GitHub ↗
(side, line, ev)

Source from the content-addressed store, hash-verified

747
748 // scrollToDiff() from gutter
749 function gutterClicked(side, line, ev) {
750 // The "Merge left/right" buttons are also located in the gutter.
751 // Don't interfere with them:
752 if (ev.target && (jQuery(ev.target).closest('.merge-button').length > 0)) {
753 return;
754 }
755
756 // See if the user clicked the line number of a difference:
757 var i, change;
758 for (i = 0; i < this.changes.length; i++) {
759 change = this.changes[i];
760 if (line >= change[side+'-line-from'] && line <= change[side+'-line-to']) {
761 this._current_diff = i;
762 // I really don't like this here - something about gutterClick does not
763 // like mutating editor here. Need to trigger the scroll to diff from
764 // a timeout.
765 setTimeout(function() { this.scrollToDiff(); }.bind(this), 10);
766 break;
767 }
768 }
769 }
770
771 this.editor[this.id + '-lhs'].on('gutterClick', function(cm, n, gutterClass, ev) {
772 gutterClicked.call(this, 'lhs', n, ev);

Callers

nothing calls this directly

Calls 1

jQueryFunction · 0.50

Tested by

no test coverage detected