braintripping / cljs-live

dependency bundling for the self-hosted ClojureScript compiler.
https://cljs-live.firebaseapp.com
Mozilla Public License 2.0
23 stars 1 forks source link

Evaluate examples on ctrl-enter #3

Closed daiyi closed 7 years ago

daiyi commented 7 years ago

Making the examples friendly to non-Mac non-Chrome users (:

I propose changing the evaluate keybinding to ctrl-enter rather than cmd-enter because the KeyboardEvent.metaKey is not available on Firefox 48+ for non-Mac users:

Note: On Macintosh keyboards, this is the ⌘ Command key. On Windows keyboards, this is the Windows key (⊞ Windows).

At least as of Firefox 48, the ⊞ Windows key is not considered the "Meta" key. KeyboardEvent.metaKey is false when the ⊞ Windows is pressed.

(source)

mhuebert commented 7 years ago

Thanks! and good catch.

I was actually just working on a related issue yesterday in Maria, and found a helpful google closure function that normalizes keycodes across browsers:

https://github.com/google/closure-library/blob/master/closure/goog/events/keycodes.js#L393

I used it here:

https://github.com/mhuebert/maria/blob/master/src/maria/commands/registry.cljs#L113

daiyi commented 7 years ago

Ohh this is great, I was looking for something like this the other day! Thanks!