mirror of https://github.com/zulip/zulip.git
hotkeys: Add '>' as a hotkey for quote and reply to message.
Tweaked by tabbott to fix a few minor issues. Fixes #8146.
This commit is contained in:
parent
79e731ec50
commit
f49d9d016f
|
@ -52,6 +52,7 @@ mentioned, even if they are not subscribed.
|
||||||
discoverable.
|
discoverable.
|
||||||
- Added a fast local echo to emoji reactions.
|
- Added a fast local echo to emoji reactions.
|
||||||
- Added new "basics" section to keyboard shortcuts documentation.
|
- Added new "basics" section to keyboard shortcuts documentation.
|
||||||
|
- Added a new keyboard shortcut for quote-and-reply.
|
||||||
- Renamed "Home" to "All messages", to avoid users clicking on it too
|
- Renamed "Home" to "All messages", to avoid users clicking on it too
|
||||||
early in using Zulip.
|
early in using Zulip.
|
||||||
- Messages containing just a link to an image (or an uploaded image)
|
- Messages containing just a link to an image (or an uploaded image)
|
||||||
|
|
|
@ -236,7 +236,7 @@ function stubbing(func_name_to_stub, test_function) {
|
||||||
assert_mapping('d', 'drafts.launch');
|
assert_mapping('d', 'drafts.launch');
|
||||||
|
|
||||||
// Next, test keys that only work on a selected message.
|
// Next, test keys that only work on a selected message.
|
||||||
var message_view_only_keys = '@*+RjJkKsSuvi:GM';
|
var message_view_only_keys = '@*+>RjJkKsSuvi:GM';
|
||||||
|
|
||||||
// Check that they do nothing without a selected message
|
// Check that they do nothing without a selected message
|
||||||
global.current_msg_list.empty = return_true;
|
global.current_msg_list.empty = return_true;
|
||||||
|
@ -246,7 +246,7 @@ function stubbing(func_name_to_stub, test_function) {
|
||||||
|
|
||||||
// Check that they do nothing while in the settings overlay
|
// Check that they do nothing while in the settings overlay
|
||||||
overlays.settings_open = return_true;
|
overlays.settings_open = return_true;
|
||||||
assert_unmapped('@*+-rRjJkKsSuvi:GM');
|
assert_unmapped('@*+->rRjJkKsSuvi:GM');
|
||||||
overlays.settings_open = return_false;
|
overlays.settings_open = return_false;
|
||||||
|
|
||||||
// TODO: Similar check for being in the subs page
|
// TODO: Similar check for being in the subs page
|
||||||
|
@ -266,6 +266,7 @@ function stubbing(func_name_to_stub, test_function) {
|
||||||
assert_mapping('u', 'popovers.show_sender_info');
|
assert_mapping('u', 'popovers.show_sender_info');
|
||||||
assert_mapping('i', 'popovers.open_message_menu');
|
assert_mapping('i', 'popovers.open_message_menu');
|
||||||
assert_mapping(':', 'reactions.open_reactions_popover', true);
|
assert_mapping(':', 'reactions.open_reactions_popover', true);
|
||||||
|
assert_mapping('>', 'compose_actions.quote_and_reply');
|
||||||
|
|
||||||
overlays.is_active = return_true;
|
overlays.is_active = return_true;
|
||||||
overlays.lightbox_open = return_true;
|
overlays.lightbox_open = return_true;
|
||||||
|
|
|
@ -365,6 +365,25 @@ exports.on_topic_narrow = function () {
|
||||||
$('#compose-textarea').focus().select();
|
$('#compose-textarea').focus().select();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
exports.quote_and_reply = function (opts) {
|
||||||
|
var textarea = $("#compose-textarea");
|
||||||
|
var message_id = current_msg_list.selected_id();
|
||||||
|
|
||||||
|
exports.respond_to_message(opts);
|
||||||
|
channel.get({
|
||||||
|
url: '/json/messages/' + message_id,
|
||||||
|
idempotent: true,
|
||||||
|
success: function (data) {
|
||||||
|
if (textarea.val() === "") {
|
||||||
|
textarea.val("```quote\n" + data.raw_content +"\n```\n");
|
||||||
|
} else {
|
||||||
|
textarea.val(textarea.val() + "\n```quote\n" + data.raw_content +"\n```\n");
|
||||||
|
}
|
||||||
|
$("#compose-textarea").trigger("autosize.resize");
|
||||||
|
},
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
exports.on_narrow = function () {
|
exports.on_narrow = function () {
|
||||||
if (narrow_state.narrowed_by_topic_reply()) {
|
if (narrow_state.narrowed_by_topic_reply()) {
|
||||||
exports.on_topic_narrow();
|
exports.on_topic_narrow();
|
||||||
|
|
|
@ -66,6 +66,7 @@ var keypress_mappings = {
|
||||||
45: {name: 'toggle_message_collapse', message_view_only: true}, // '-'
|
45: {name: 'toggle_message_collapse', message_view_only: true}, // '-'
|
||||||
47: {name: 'search', message_view_only: false}, // '/'
|
47: {name: 'search', message_view_only: false}, // '/'
|
||||||
58: {name: 'toggle_reactions_popover', message_view_only: true}, // ':'
|
58: {name: 'toggle_reactions_popover', message_view_only: true}, // ':'
|
||||||
|
62: {name: 'compose_quote_reply', message_view_only: true}, // '>'
|
||||||
63: {name: 'show_shortcuts', message_view_only: false}, // '?'
|
63: {name: 'show_shortcuts', message_view_only: false}, // '?'
|
||||||
64: {name: 'compose_reply_with_mention', message_view_only: true}, // '@'
|
64: {name: 'compose_reply_with_mention', message_view_only: true}, // '@'
|
||||||
65: {name: 'stream_cycle_backward', message_view_only: true}, // 'A'
|
65: {name: 'stream_cycle_backward', message_view_only: true}, // 'A'
|
||||||
|
@ -703,6 +704,9 @@ exports.process_hotkey = function (e, hotkey) {
|
||||||
case 'toggle_message_collapse':
|
case 'toggle_message_collapse':
|
||||||
condense.toggle_collapse(msg);
|
condense.toggle_collapse(msg);
|
||||||
return true;
|
return true;
|
||||||
|
case 'compose_quote_reply': // > : respond to selected message with quote
|
||||||
|
compose_actions.quote_and_reply({trigger: 'hotkey'});
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -577,22 +577,12 @@ exports.register_click_handlers = function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
$('body').on('click', '.respond_button', function (e) {
|
$('body').on('click', '.respond_button', function (e) {
|
||||||
var textarea = $("#compose-textarea");
|
// Arguably, we should fetch the message ID to respond to from
|
||||||
var msgid = $(e.currentTarget).data("message-id");
|
// e.target, but that should always be the current selected
|
||||||
|
// message in the current message list (and
|
||||||
compose_actions.respond_to_message({trigger: 'popover respond'});
|
// compose_actions.respond_to_message doesn't take a message
|
||||||
channel.get({
|
// argument).
|
||||||
url: '/json/messages/' + msgid,
|
compose_actions.quote_and_reply({trigger: 'popover respond'});
|
||||||
idempotent: true,
|
|
||||||
success: function (data) {
|
|
||||||
if (textarea.val() === "") {
|
|
||||||
textarea.val("```quote\n" + data.raw_content +"\n```\n");
|
|
||||||
} else {
|
|
||||||
textarea.val(textarea.val() + "\n```quote\n" + data.raw_content +"\n```\n");
|
|
||||||
}
|
|
||||||
$("#compose-textarea").trigger("autosize.resize");
|
|
||||||
},
|
|
||||||
});
|
|
||||||
popovers.hide_actions_popover();
|
popovers.hide_actions_popover();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
|
@ -85,6 +85,8 @@ below, and add more to your repertoire as needed.
|
||||||
|
|
||||||
* **Reply only to author**: `R`
|
* **Reply only to author**: `R`
|
||||||
|
|
||||||
|
* **Quote and reply to message**: `>`
|
||||||
|
|
||||||
* **New stream message**: `c` — For starting a new topic in a stream.
|
* **New stream message**: `c` — For starting a new topic in a stream.
|
||||||
|
|
||||||
* **New private message**: `C`
|
* **New private message**: `C`
|
||||||
|
|
|
@ -116,6 +116,10 @@
|
||||||
<td class="hotkey">R</td>
|
<td class="hotkey">R</td>
|
||||||
<td class="definition">{% trans %}Reply to author{% endtrans %}</td>
|
<td class="definition">{% trans %}Reply to author{% endtrans %}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="hotkey">></td>
|
||||||
|
<td class="definition">{% trans %}Quote and reply to message{% endtrans %}</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="hotkey">c</td>
|
<td class="hotkey">c</td>
|
||||||
<td class="definition">{% trans %}New stream message{% endtrans %}</td>
|
<td class="definition">{% trans %}New stream message{% endtrans %}</td>
|
||||||
|
|
Loading…
Reference in New Issue