mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 00:18:56 +02:00
window focus back
This commit is contained in:
parent
93f6f3c6ca
commit
3664ad8b65
5 changed files with 177 additions and 15 deletions
|
@ -28,11 +28,11 @@ var init = function(){
|
|||
$(document).ready(init);
|
||||
|
||||
function UI() {
|
||||
this.active = true;
|
||||
var Collections = require('../models/collections');
|
||||
var CommandViews = require('../views/commandViews');
|
||||
|
||||
this.commandCollection = new Collections.CommandCollection();
|
||||
|
||||
this.commandBuffer = new Collections.CommandBuffer({
|
||||
collection: this.commandCollection
|
||||
});
|
||||
|
@ -47,8 +47,25 @@ function UI() {
|
|||
});
|
||||
|
||||
$('#commandTextField').focus();
|
||||
$(window).focus(_.bind(this.onWindowFocus, this));
|
||||
}
|
||||
|
||||
UI.prototype.onWindowFocus = function() {
|
||||
if (this.active) {
|
||||
this.commandPromptView.focus();
|
||||
}
|
||||
};
|
||||
|
||||
UI.prototype.modalStart = function() {
|
||||
this.active = false;
|
||||
this.commandPromptView.blur();
|
||||
};
|
||||
|
||||
UI.prototype.modalEnd = function() {
|
||||
this.commandPromptView.focus();
|
||||
this.active = true;
|
||||
};
|
||||
|
||||
exports.getEvents = function() {
|
||||
return events;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue