Browse Source

Fixes Helios keydown events

Nicolas Petton 10 years ago
parent
commit
2a4c987f5d
2 changed files with 3 additions and 42 deletions
  1. 2 29
      js/Helios-Core.js
  2. 1 13
      st/Helios-Core.st

+ 2 - 29
js/Helios-Core.js

@@ -3797,32 +3797,6 @@ smalltalk.HLManager);
 
 
 smalltalk.HLManager.klass.iVarNames = ['current'];
-smalltalk.addMethod(
-smalltalk.method({
-selector: "clearKeydownEvent",
-category: 'private',
-fn: function (){
-var self=this;
-return smalltalk.withContext(function($ctx1) { 
-var $1;
-_st("body"._asJQuery())._keydown_((function(e){
-return smalltalk.withContext(function($ctx2) {
-$1=_st(_st(_st(e)._keyCode()).__gt_eq((37)))._and_((function(){
-return smalltalk.withContext(function($ctx3) {
-return _st(_st(e)._keyCode()).__lt_eq((40));
-}, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)})}));
-if(smalltalk.assert($1)){
-return false;
-};
-}, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,1)})}));
-return self}, function($ctx1) {$ctx1.fill(self,"clearKeydownEvent",{},smalltalk.HLManager.klass)})},
-args: [],
-source: "clearKeydownEvent\x0a\x09\x22Prevent default keydown event with arrow key from scrolling the parent page\x0a\x09when helios is run inside a frame.\x22\x0a\x09\x0a\x09'body' asJQuery keydown: [ :e | \x0a\x09\x09(e keyCode >= 37 and: [ e keyCode <= 40 ])\x0a\x09\x09\x09ifTrue: [ false ] ]",
-messageSends: ["keydown:", "asJQuery", "ifTrue:", "and:", ">=", "keyCode", "<="],
-referencedClasses: []
-}),
-smalltalk.HLManager.klass);
-
 smalltalk.addMethod(
 smalltalk.method({
 selector: "current",
@@ -3855,11 +3829,10 @@ fn: function (){
 var self=this;
 return smalltalk.withContext(function($ctx1) { 
 _st(self._current())._appendToJQuery_("body"._asJQuery());
-self._clearKeydownEvent();
 return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.HLManager.klass)})},
 args: [],
-source: "initialize\x0a\x09self current appendToJQuery: 'body' asJQuery.\x0a\x09self clearKeydownEvent",
-messageSends: ["appendToJQuery:", "current", "asJQuery", "clearKeydownEvent"],
+source: "initialize\x0a\x09self current appendToJQuery: 'body' asJQuery",
+messageSends: ["appendToJQuery:", "current", "asJQuery"],
 referencedClasses: []
 }),
 smalltalk.HLManager.klass);

+ 1 - 13
st/Helios-Core.st

@@ -1345,8 +1345,7 @@ current
 !HLManager class methodsFor: 'initialization'!
 
 initialize
-	self current appendToJQuery: 'body' asJQuery.
-	self clearKeydownEvent
+	self current appendToJQuery: 'body' asJQuery
 ! !
 
 !HLManager class methodsFor: 'instance creation'!
@@ -1357,17 +1356,6 @@ new
 	self shouldNotImplement
 ! !
 
-!HLManager class methodsFor: 'private'!
-
-clearKeydownEvent
-	"Prevent default keydown event with arrow key from scrolling the parent page
-	when helios is run inside a frame."
-	
-	'body' asJQuery keydown: [ :e | 
-		(e keyCode >= 37 and: [ e keyCode <= 40 ])
-			ifTrue: [ false ] ]
-! !
-
 HLWidget subclass: #HLModalWidget
 	instanceVariableNames: ''
 	package: 'Helios-Core'!