Restore the compose box's original size after hitting send.

This fix required upgrading to 1.1.17, but it's not squashed
with the upgrade, because that would complicate keeping the
copyright-fixing commit separate from the upgrading commit.

The new version of the plugin makes it so we can trigger a
resize event, but it's backward incompatible with our old
compose box code.

A minor cleanup here is that we also don't trigger a resize
right before hiding the compose box.

(imported from commit 6b0cb9ccd2ddef919fd375a80cfca535b5b74c0f)
This commit is contained in:
Steve Howell
2013-09-05 12:55:09 -04:00
parent c0d1481e83
commit b97c60b635

View File

@@ -25,6 +25,10 @@ function clear_out_file_list(jq_file_list) {
// $("#file_input").val("");
}
function autosize_textarea() {
$("#new_message_content").trigger("autosize.resize");
}
// Show the compose box.
function show_box(tabname, focus_area) {
if (tabname === "stream") {
@@ -40,7 +44,7 @@ function show_box(tabname, focus_area) {
}
$("#send-status").removeClass(status_classes).hide();
$('#compose').css({visibility: "visible"});
$("#new_message_content").trigger("autosize");
autosize_textarea();
$(".new_message_textarea").css("min-height", "3em");
if (focus_area !== undefined) {
@@ -68,7 +72,6 @@ function show_box(tabname, focus_area) {
function clear_box() {
exports.snapshot_message();
$("#compose").find('input[type=text], textarea').val('');
$("#new_message_content").trigger('autosize');
$("#send-status").hide(0);
}
@@ -339,6 +342,7 @@ function send_message() {
data: request,
success: function (resp, statusText, xhr) {
$("#new_message_content").val('').focus();
autosize_textarea();
$("#send-status").hide(0);
if (request.type === "private") {
onboarding.mark_checklist_step("sent_private_message");
@@ -643,7 +647,7 @@ $(function () {
// This is a dropped file, so make the filename a link to the image
textbox.val(textbox.val() + "[" + filename + "](" + response.uri + ")" + " ");
}
$("#new_message_content").trigger("autosize");
autosize_textarea();
$("#compose-send-button").removeAttr("disabled");
$("#send-status").removeClass("alert-info")
.hide();