-
Notifications
You must be signed in to change notification settings - Fork 156
Open links on click #198
Comments
@brrd How's it going? I'd like this feature too and am interested in working on it. Any pointers on where to start poking around? |
I would try to do this: 1. To get the cursor: pointer on a link when Ctrl is pressed Set event handler (probably in abrDocument): function ctrlKeyHandler (e) {
if (!e.metaKey) return;
var isKeydown = e.type === keydown;
$(document.body).toggleClass("ctrl-pressed", isKeydown);
}
$(window).keydown(ctrlKeyHandler).keyup(ctrlKeyHandler); LESS rule: .ctrl-pressed .cm-link:hover, .ctrl-pressed .cm-url:hover {
cursor: pointer;
} 2. To open the link when clicked Set event handler (probably in abrDocument): function openLinkHandler (e) {
if (!document.body.hasClass("ctrl-pressed")) return;
// Get the URL of the clicked link
// TODO: Here you will have to handle more specific situations where the url is actually stored in a sibbling element, e.g. [test](http://test.com)
var url = $(this).text();
// Then open url in browser
shell.openExternal(url);
}
$(window).on("click", ".cm-link, .cm-url", openLinkHandler); I didn't test this code, it is just an idea. PR is welcome. |
Ok, cool. PR should be incoming in a few days. Thanks! |
Hi! :) Is this feature on the 0.7.0 version ? I would like to use it. |
Normally you can open the link by clicking on it while pressing shift. But this feature look broken in 0.7.0. I will open a new issue. |
Ho! Thanks :) It's working for me with Windows 7. I tried just with Ctrl, that's why. |
Please create new issues for those requests if you want them to be took into account. |
Hello,
excuse me if this functionality is already possible, but I wasn't able to find it. In some editors http-links become clickable when they're valid URLs. Other editors use a key modifier to trigger this like ctrl/cmd on Windows,Linux/macOs. Perhaps even the multi-cursor feature could be kept in combination with ctrl/cmd?
Best regards,
Tim
The text was updated successfully, but these errors were encountered: