File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change 66require 'browser/http'
77require 'browser/location'
88require 'browser/history'
9+ require 'browser/navigator'
Original file line number Diff line number Diff line change 1+ require 'dependencies'
2+
3+ class Helper
4+ @@navigator = $window&.navigator
5+
6+ def self . ios?
7+ @@navigator . user_agent &.match? ( /\b (iPad|iPhone|iPod)\b / ) || false
8+ end
9+
10+ def self . macos?
11+ @@navigator . user_agent &.match? ( /\b Mac\b / ) || false
12+ end
13+ end
Original file line number Diff line number Diff line change 44require 'editor'
55require 'lesson'
66require 'ruby_engine'
7+ require 'helper'
78
89# The TryRuby application
910class TryRuby
@@ -61,7 +62,8 @@ 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 . ctrl? && !Helper . ios? ) || ( ( Helper . macos? || Helper . ios? ) && e . meta? ) ) && e . key == "Enter"
66+ e . prevent
6567 do_run
6668 end
6769 end
You can’t perform that action at this time.
0 commit comments