Fixed hotkeys not resetting on presenter change

This commit is contained in:
Marcin Kurczewski 2014-09-29 18:11:21 +02:00
parent 169d5f7068
commit 5dfa011d5a
3 changed files with 8 additions and 3 deletions

1
TODO
View file

@ -109,7 +109,6 @@ refactors:
miscellaneous: miscellaneous:
- use 1 token for logins, so that session isn't killed - use 1 token for logins, so that session isn't killed
- endless pager should include information about page number - endless pager should include information about page number
- fix mouse trap hotkeys when leaving page
- add hotkeys for focusing items in top navigation - add hotkeys for focusing items in top navigation
- add ability to select tags text in tag input - add ability to select tags text in tag input
- pasting tags should "soft-add" latest word in clipboard to input - pasting tags should "soft-add" latest word in clipboard to input

View file

@ -18,9 +18,14 @@ App.Keyboard = function(mousetrap) {
}; };
} }
function reset() {
mousetrap.reset();
}
return { return {
keydown: keydown, keydown: keydown,
keyup: keyup, keyup: keyup,
reset: reset,
}; };
}; };

View file

@ -1,6 +1,6 @@
var App = App || {}; var App = App || {};
App.PresenterManager = function(jQuery, topNavigationPresenter) { App.PresenterManager = function(jQuery, topNavigationPresenter, keyboard) {
var lastContentPresenter = null; var lastContentPresenter = null;
var $spinner; var $spinner;
@ -34,6 +34,7 @@ App.PresenterManager = function(jQuery, topNavigationPresenter) {
}, 100); }, 100);
if (lastContentPresenter === null || lastContentPresenter.name !== presenter.name) { if (lastContentPresenter === null || lastContentPresenter.name !== presenter.name) {
keyboard.reset();
topNavigationPresenter.changeTitle(null); topNavigationPresenter.changeTitle(null);
presenter.init.call(presenter, args, contentPresenterLoaded); presenter.init.call(presenter, args, contentPresenterLoaded);
lastContentPresenter = presenter; lastContentPresenter = presenter;
@ -67,4 +68,4 @@ App.PresenterManager = function(jQuery, topNavigationPresenter) {
}; };
App.DI.registerSingleton('presenterManager', ['jQuery', 'topNavigationPresenter'], App.PresenterManager); App.DI.registerSingleton('presenterManager', ['jQuery', 'topNavigationPresenter', 'keyboard'], App.PresenterManager);