mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-29 09:20:03 +02:00
almost done
This commit is contained in:
parent
0d6f2516cb
commit
69235f4b37
6 changed files with 10 additions and 32 deletions
|
@ -23,7 +23,6 @@ var init = function(){
|
|||
|
||||
// we always want to focus the text area to collect input
|
||||
var focusTextArea = function() {
|
||||
console.log('focusing text area');
|
||||
$('#commandTextField').focus();
|
||||
};
|
||||
focusTextArea();
|
||||
|
@ -74,15 +73,8 @@ function UI() {
|
|||
el: $('#commandLineHistory'),
|
||||
collection: this.commandCollection
|
||||
});
|
||||
|
||||
$('#commandTextField').focus();
|
||||
eventBaton.stealBaton('windowFocus', this.onWindowFocus, this);
|
||||
}
|
||||
|
||||
UI.prototype.onWindowFocus = function() {
|
||||
this.commandPromptView.focus();
|
||||
};
|
||||
|
||||
exports.getEvents = function() {
|
||||
return events;
|
||||
};
|
||||
|
|
|
@ -54,7 +54,7 @@ EventBaton.prototype.releaseBaton = function(name, func, context) {
|
|||
}, this);
|
||||
|
||||
if (!found) {
|
||||
throw new Error('did not find that function');
|
||||
throw new Error('did not find that function', func, context, name, arguments);
|
||||
}
|
||||
this.eventMap[name] = newListeners;
|
||||
};
|
||||
|
|
|
@ -126,11 +126,19 @@ var ModalView = Backbone.View.extend({
|
|||
console.warn('stealing keyboard');
|
||||
Main.getEventBaton().stealBaton('keydown', this.onKeyDown, this);
|
||||
Main.getEventBaton().stealBaton('keyup', this.onKeyUp, this);
|
||||
Main.getEventBaton().stealBaton('windowFocus', this.onWindowFocus, this);
|
||||
|
||||
$('#commandTextField').blur();
|
||||
},
|
||||
|
||||
releaseKeyboard: function() {
|
||||
Main.getEventBaton().releaseBaton('keydown', this.onKeyDown, this);
|
||||
Main.getEventBaton().releaseBaton('keyup', this.onKeyUp, this);
|
||||
Main.getEventBaton().releaseBaton('windowFocus', this.onWindowFocus, this);
|
||||
},
|
||||
|
||||
onWindowFocus: function(e) {
|
||||
console.log('window focus doing nothing', e);
|
||||
},
|
||||
|
||||
onKeyDown: function(e) {
|
||||
|
|
|
@ -124,7 +124,6 @@ var MultiView = Backbone.View.extend({
|
|||
// first we stop listening to keyboard and give that back to UI, which
|
||||
// other views will take if they need to
|
||||
this.keyboardListener.mute();
|
||||
require('../app').getEventBaton().releaseBaton('windowFocus', this.onWindowFocus, this);
|
||||
|
||||
setTimeout(_.bind(function() {
|
||||
_.each(this.childViews, function(childView) {
|
||||
|
@ -137,7 +136,6 @@ var MultiView = Backbone.View.extend({
|
|||
|
||||
start: function() {
|
||||
// steal the window focus baton
|
||||
require('../app').getEventBaton().stealBaton('windowFocus', this.onWindowFocus, this);
|
||||
this.showViewIndex(this.currentIndex);
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue