-
Notifications
You must be signed in to change notification settings - Fork 783
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add hotkey support for saving via Ctrl+S #739
Comments
I do like the idea and adding shortcuts in JS is not too difficult. I played a bit with some examples, trying to switch them to CTRL+S. Many other combinations work, but CTRL+S and many other sequences seem to be reserved, at least in Firefox on Linux. Basically open the menus (if hidden on your OS, press ALT to enable the menu bar) and all those sequences listed in the menus will not work in JS, but trigger those functions instead. I can see that the don't want to let scammers override standard keypresses. Would another CTRL combination work for you? If so, which one? PS: Alternatively, an even simpler to implement way would be the accesskey-HTML-attribute: It would let us set "s" as the accesskey on the send-button and then you'd be able to trigger it with ALT+S or ALT+SHIFT+S or CTRL+ALT+S, depending on your browser or OS. |
Ok I understand the problem. :) |
Yeah on hastebin it seems to work… I also have in mind that Ctrl+S is one of the keypresses that can actually be overwritten. But we need to investigate that further… |
They use the method of key detection I had found as well: I think the bit I didn't do properly was hooking the event to keydown instead of keypress: Let's see: https://jsfiddle.net/c1vzsg40/ - I tested several browsers and OS combinations using browserstack and it seemed to work fine in all Windows browsers (as well as on Linux for Firefox and Chromium). On the Mac, Ctrl is recognized as a Meta key press instead - AFAIK Mac users would expect the combination to be Cmd+S (that's the button with the ⌘ they have instead of an Alt-key) instead of Ctrl+S - we could just accept both combinations for that action. The Cmd key seems to be detected as Alt key, so we would just trigger the send on both Ctrl+S and Alt+S. And yes, the keypress event doesn't show up at all, probably the preventdefault() on the keyup and -down events suppresses that event as well. |
@simonrupf I agree, I think it is the best solution for both. |
Hello !
I propose the addition of a new feature allowing to publish a paste faster than with the "Upload" button simply by using the CTRL+S keys. :)
What do you think of this idea?
Thanks ;)
The text was updated successfully, but these errors were encountered: