mirror of
https://github.com/discourse/discourse.git
synced 2025-03-24 01:10:24 +08:00
FEATURE: HOME/END should always take you to the correct spot
This commit is contained in:
parent
8adb08a9ca
commit
759c18d9f5
@ -41,6 +41,8 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
|
|||||||
},
|
},
|
||||||
|
|
||||||
FUNCTION_BINDINGS: {
|
FUNCTION_BINDINGS: {
|
||||||
|
'home': 'goToFirstPost',
|
||||||
|
'end': 'goToLastPost',
|
||||||
'j': 'selectDown',
|
'j': 'selectDown',
|
||||||
'k': 'selectUp',
|
'k': 'selectUp',
|
||||||
'u': 'goBack',
|
'u': 'goBack',
|
||||||
@ -56,6 +58,14 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
|
|||||||
_.each(this.FUNCTION_BINDINGS, this._bindToFunction, this);
|
_.each(this.FUNCTION_BINDINGS, this._bindToFunction, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
goToFirstPost: function() {
|
||||||
|
Discourse.__container__.lookup('controller:topic').send('jumpTop');
|
||||||
|
},
|
||||||
|
|
||||||
|
goToLastPost: function() {
|
||||||
|
Discourse.__container__.lookup('controller:topic').send('jumpBottom');
|
||||||
|
},
|
||||||
|
|
||||||
selectDown: function() {
|
selectDown: function() {
|
||||||
this._moveSelection(1);
|
this._moveSelection(1);
|
||||||
},
|
},
|
||||||
@ -77,7 +87,7 @@ Discourse.KeyboardShortcuts = Ember.Object.createWithMixins({
|
|||||||
},
|
},
|
||||||
|
|
||||||
showHelpModal: function() {
|
showHelpModal: function() {
|
||||||
Discourse.__container__.lookup('controller:application').send("showKeyboardShortcutsHelp");
|
Discourse.__container__.lookup('controller:application').send('showKeyboardShortcutsHelp');
|
||||||
},
|
},
|
||||||
|
|
||||||
_bindToPath: function(path, binding) {
|
_bindToPath: function(path, binding) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user