Closed joegaudet closed 9 years ago
@joegaudet I'm modifying my local file to support this right now and could submit a pull request. Are you in favor of command-a
or cmd-a
?
I'm leaning towards the latter, since it's more like ctrl
.
cmd-a would be better I think, for consistency and brevity.
.joe
On Thu, Jan 30, 2014 at 4:17 PM, Matthew Brandly notifications@github.comwrote:
@joegaudet https://github.com/joegaudet I'm modifying my local file to support this right now and could submit a pull request. Are you in favor of command-a or cmd-a?
I'm leaning towards the latter, since it's more like ctrl.
Reply to this email directly or view it on GitHubhttps://github.com/angular-ui/ui-utils/issues/167#issuecomment-33750106 .
.joe out.
+1.778.994.4846
Unfortunately, adding this is more involved than I hoped. http://stackoverflow.com/a/3922353
I'll report back if I get something working.
Yeah I saw that in my research.
It's handled in SproutCore somehow - the iCloud apps all intercept command codes.
I couldn't really figure it out, I'd imagine you'd somehow have to intercept the keydown/keyup of the command key and tie it to the keys pressed afterward - and prevent default if there's a handler.
.joe
To fix my personal issue, I went from trying to bind like ui-keypress="{'cmd-enter': ...
to ui-keydown="{'meta-enter': ..."
, which works without modifying the library at all. :+1:
Apparently, at least in Chrome, keypress
doesn't fire when holding command
. keydown
does, however. Mousetrap is somehow handling this.
keydown
events do fire, however, and event.metaKey
is set, if you're holding down command
. Sounds like event.metaKey
also applies to the windows
key for Windows.
does appear to work for command + enter.
How might I intercept command + a ?
.joe
On Thu, Jan 30, 2014 at 6:04 PM, Matthew Brandly notifications@github.comwrote:
To fix my personal issue, I went from trying to bind like ui-keypress="{'cmd-enter': ... to ui-keydown="{'meta-enter': ...", which works without modifying the library at all. [image: :+1:]
Apparently, at least in Chrome, keypress doesn't fire when holding command. keydown does, however. Mousetrap is somehow handling this.https://github.com/ccampbell/mousetrap/blob/master/mousetrap.js#L354
keydown events do fire, however, and event.metaKey is set, if you're holding down command. Sounds like event.metaKey also applies to the windows key for Windows.
Reply to this email directly or view it on GitHubhttps://github.com/angular-ui/ui-utils/issues/167#issuecomment-33755955 .
.joe out.
+1.778.994.4846
Appears to work with the key code... meta-65
On Thu, Jan 30, 2014 at 8:16 PM, Joe Gaudet joe@joegaudet.com wrote:
does appear to work for command + enter.
How might I intercept command + a ?
.joe
On Thu, Jan 30, 2014 at 6:04 PM, Matthew Brandly <notifications@github.com
wrote:
To fix my personal issue, I went from trying to bind like ui-keypress="{'cmd-enter': ... to ui-keydown="{'meta-enter': ...", which works without modifying the library at all. [image: :+1:]
Apparently, at least in Chrome, keypress doesn't fire when holding command. keydown does, however. Mousetrap is somehow handling this.https://github.com/ccampbell/mousetrap/blob/master/mousetrap.js#L354
keydown events do fire, however, and event.metaKey is set, if you're holding down command. Sounds like event.metaKey also applies to the windows key for Windows.
Reply to this email directly or view it on GitHubhttps://github.com/angular-ui/ui-utils/issues/167#issuecomment-33755955 .
.joe out.
+1.778.994.4846
.joe out.
+1.778.994.4846
Yeah, they only have a pretty short list of characters that can be referenced by name, instead of key code.
I don't know if they want to grow this to a larger, full-featured keyboard library, but you could add your own characters to that list, if you want the readability of meta-a
over meta-65
.
Also, if you wanted to alias meta
as cmd
, you could change this line to
var metaRequired = !!combination.keys.meta || !!combination.keys.cmd;
and I think that'll work.
UI.Utils modules was split in individuals repositories. If still valid, please consider re-submitting the issue on its dedicated issue tracker.
See the README for details.
Can't seem to figure out how to capture apple command key.
eg: command+a