upload: Fix upload under message edit mode when edited using hotkeys.

This refactors the attachment of jQuery-filedrop handler into
`message_edit.start_edit_with_content`.
This commit is contained in:
Shubham Dhama 2018-03-05 13:40:05 +05:30 committed by Tim Abbott
parent 5ee6c608c0
commit 3fb862533f
2 changed files with 8 additions and 8 deletions

View File

@ -200,15 +200,8 @@ $(function () {
$('body').on('click', '.edit_content_button', function (e) {
var row = current_msg_list.get_row(rows.id($(this).closest(".message_row")));
var row_id = rows.id(row);
current_msg_list.select_id(row_id);
current_msg_list.select_id(rows.id(row));
message_edit.start(row);
$('#message_edit_content_' + row_id).closest('#message_edit_form').filedrop(
upload.options({
mode: 'edit',
row: row_id,
})
);
e.stopPropagation();
popovers.hide_all();
});

View File

@ -327,6 +327,13 @@ function start_edit_with_content(row, content, edit_box_open_callback) {
if (edit_box_open_callback) {
edit_box_open_callback();
}
row.find('#message_edit_form').filedrop(
upload.options({
mode: 'edit',
row: rows.id(row),
})
);
}
exports.start = function (row, edit_box_open_callback) {