Callback on mouse click events?


#1

can anyone help me out with the syntax for getting a callback for a right-click in an editor window?

regards,
tony.


#2

I think is what you need.

{$} = require 'atom'

$('.editor:not(.mini)').on 'mousedown', (event) ->
  if event.which is 3
    console.log 'right click'

#3

Things are a little different for 1.0 APIs:

{$} = require 'atom-space-pen-views'

editorView = atom.views.getView(editor)
$(editorView).on 'mouseup', (event) ->
    if event.which is 3
        console.log 'right click'