Skip to content

Commit 519f483

Browse files
committed
Setup contextmenu click action for inline markers
1 parent 19f9274 commit 519f483

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

addon/lint/lint.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
this.timeout = null;
7777
this.hasGutter = hasGutter;
7878
this.onMouseOver = function(e) { onMouseOver(cm, e); };
79+
this.onClick = function(e) { onClick(cm, e); };
7980
this.waitingFor = 0
8081
}
8182

@@ -235,7 +236,18 @@
235236
var ann = spans[i].__annotation;
236237
if (ann) annotations.push(ann);
237238
}
238-
if (annotations.length) popupTooltips(cm, annotations, e);
239+
240+
if (annotations.length) cb(cm, annotations, e)
241+
}
242+
243+
function onMouseOver(cm, e) {
244+
handleMarkerAction(cm, e, popupTooltips)
245+
}
246+
247+
function onClick (cm, e) {
248+
handleMarkerAction(cm, e, function popupContextMenu (cm, annotations, e) {
249+
console.log(`WIP: click action, ${JSON.stringify(annotations)}`)
250+
})
239251
}
240252

241253
CodeMirror.defineOption("lint", false, function(cm, val, old) {
@@ -256,6 +268,9 @@
256268
cm.on("change", onChange);
257269
if (state.options.tooltips != false && state.options.tooltips != "gutter")
258270
CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver);
271+
if (state.options.contextmenu) {
272+
CodeMirror.on(cm.getWrapperElement(), "click", state.onClick);
273+
}
259274

260275
startLinting(cm);
261276
}

0 commit comments

Comments
 (0)