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:
Balaji2198
2018-01-31 08:53:02 +05:30
committed by Tim Abbott
parent 79e731ec50
commit f49d9d016f
8 changed files with 40 additions and 19 deletions

View File

@@ -365,6 +365,25 @@ exports.on_topic_narrow = function () {
$('#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 () {
if (narrow_state.narrowed_by_topic_reply()) {
exports.on_topic_narrow();