Skip to content

Commit 4a06cc9

Browse files
committed
Make Cmd+Return behave like Ctrl+Enter
1 parent a995cf3 commit 4a06cc9

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

app/dependencies.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
require 'browser/http'
77
require 'browser/location'
88
require 'browser/history'
9+
require 'browser/navigator'

app/try_ruby.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def initialize
3232
@current_item = nil
3333
@current_copycode = nil
3434
@updating = false
35+
@navigator = $window.navigator
3536

3637
initialize_menu
3738

@@ -61,7 +62,7 @@ def initialize
6162

6263
#If hold down the control and the Enter key goes down, run
6364
$document.on :keydown, '#editor' do |e|
64-
if e.key == "Enter" && e.ctrl?
65+
if e.key == "Enter" && (e.ctrl? || (@navigator.user_agent&.match?(/\b(Mac|iPad|iPhone|iPod)\b/) && e.meta?))
6566
e.prevent
6667
do_run
6768
end

0 commit comments

Comments
 (0)