mirror of https://github.com/zulip/zulip.git
parent
71d81371fc
commit
144d21494e
|
@ -70,12 +70,13 @@ run_test('mappings', () => {
|
|||
});
|
||||
}
|
||||
|
||||
function map_down(which, shiftKey, ctrlKey, metaKey) {
|
||||
function map_down(which, shiftKey, ctrlKey, metaKey, altKey) {
|
||||
return hotkey.get_keydown_hotkey({
|
||||
which: which,
|
||||
shiftKey: shiftKey,
|
||||
ctrlKey: ctrlKey,
|
||||
metaKey: metaKey,
|
||||
altKey: altKey,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -124,6 +125,7 @@ run_test('mappings', () => {
|
|||
assert.equal(map_down(75, true, true), undefined); // shift + ctrl + k
|
||||
assert.equal(map_down(83, true, true), undefined); // shift + ctrl + s
|
||||
assert.equal(map_down(219, true, true, false), undefined); // shift + ctrl + [
|
||||
assert.equal(map_down(83, false, false, false, true), undefined); // alt + s
|
||||
|
||||
// CMD tests for MacOS
|
||||
global.navigator.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.167 Safari/537.36";
|
||||
|
@ -135,6 +137,8 @@ run_test('mappings', () => {
|
|||
assert.equal(map_down(83, false, true, false), undefined); // ctrl + s
|
||||
// Reset userAgent
|
||||
global.navigator.userAgent = '';
|
||||
|
||||
assert.equal(map_down(83, false, true, false, true).name, 'narrow_starred'); // ctrl + alt + s
|
||||
});
|
||||
|
||||
run_test('basic_chars', () => {
|
||||
|
|
|
@ -111,13 +111,23 @@ var keypress_mappings = {
|
|||
120: {name: 'compose_private_message', message_view_only: true}, // 'x'
|
||||
};
|
||||
|
||||
var keydown_ctrl_alt_mappings = {
|
||||
83: {name: 'narrow_starred', message_view_only: true}, // 's'
|
||||
};
|
||||
|
||||
exports.get_keydown_hotkey = function (e) {
|
||||
var hotkey;
|
||||
|
||||
if (e.altKey) {
|
||||
if (e.ctrlKey) {
|
||||
hotkey = keydown_ctrl_alt_mappings[e.which];
|
||||
if (hotkey) {
|
||||
return hotkey;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
var hotkey;
|
||||
|
||||
if (e.ctrlKey && !e.shiftKey) {
|
||||
hotkey = keydown_ctrl_mappings[e.which];
|
||||
if (hotkey) {
|
||||
|
@ -626,6 +636,10 @@ exports.process_hotkey = function (e, hotkey) {
|
|||
return do_narrow_action(function (target, opts) {
|
||||
narrow.by('is', 'private', opts);
|
||||
});
|
||||
case 'narrow_starred':
|
||||
return do_narrow_action(function (target, opts) {
|
||||
narrow.by('is', 'starred', opts);
|
||||
});
|
||||
case 'query_streams':
|
||||
stream_list.initiate_search();
|
||||
return true;
|
||||
|
|
|
@ -170,6 +170,10 @@
|
|||
<td class="hotkey">P</td>
|
||||
<td class="definition">{% trans %}Narrow to all private messages{% endtrans %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="hotkey">Ctrl + Alt + s</td>
|
||||
<td class="definition">{% trans %}Narrow to starred messages{% endtrans %}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="hotkey">n</td>
|
||||
<td class="definition">{% trans %}Narrow to next unread topic{% endtrans %}</td>
|
||||
|
|
|
@ -76,6 +76,8 @@ below, and add more to your repertoire as needed.
|
|||
|
||||
* **Narrow to all private messages**: `P`
|
||||
|
||||
* **Narrow to starred messages**: `Ctrl + Alt + s`
|
||||
|
||||
* **Cycle between stream narrows**: `A` (previous) and `D` (next)
|
||||
|
||||
* **Narrow to all messages**: `Esc` or `Ctrl` + `[` — Shows all unmuted messages.
|
||||
|
|
Loading…
Reference in New Issue