How to capture CTRL+Click


#1

I asked in the IRC the other day and a folk suggested me atom-space-pen-views. I am not sure what it is :smile: , Any human friendly idea how to get notified each time the user holds ctrl and clicks something in the editor? Thanks!


#2

Atom fully supports the normal DOM access. To subscribe to a click just do what you do in a web browser. With jquery it looks like

$('#someID').click -> console.log 'clicked'

To use jQuery you need to put {$} = require "atom-space-pen-views" at the top of your file. Then use the chrome inspector to find the IDs and Classes.

Edit: And to detect the ctrl key you use the normal event object …

$('#someID').click (e) -> console.log 'clicked with ctrl?', e.ctrlKey

#3

Thank You! You are awesome!


#4

Hi Steel :wink: if you remember we spoke a bit on IRC i was looking for you few hours after we spoke. Here is another example https://github.com/yongkangchen/atom-ctags/commit/970ca17630e1dd4eee04f82ab98baf5e08562c17


#5

Trudko: Thanks for the Example! Today must be my lucky day! :thumbsup: