mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 14:35:27 +00:00
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:
@@ -25,6 +25,10 @@ function clear_out_file_list(jq_file_list) {
|
|||||||
// $("#file_input").val("");
|
// $("#file_input").val("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function autosize_textarea() {
|
||||||
|
$("#new_message_content").trigger("autosize.resize");
|
||||||
|
}
|
||||||
|
|
||||||
// Show the compose box.
|
// Show the compose box.
|
||||||
function show_box(tabname, focus_area) {
|
function show_box(tabname, focus_area) {
|
||||||
if (tabname === "stream") {
|
if (tabname === "stream") {
|
||||||
@@ -40,7 +44,7 @@ function show_box(tabname, focus_area) {
|
|||||||
}
|
}
|
||||||
$("#send-status").removeClass(status_classes).hide();
|
$("#send-status").removeClass(status_classes).hide();
|
||||||
$('#compose').css({visibility: "visible"});
|
$('#compose').css({visibility: "visible"});
|
||||||
$("#new_message_content").trigger("autosize");
|
autosize_textarea();
|
||||||
$(".new_message_textarea").css("min-height", "3em");
|
$(".new_message_textarea").css("min-height", "3em");
|
||||||
|
|
||||||
if (focus_area !== undefined) {
|
if (focus_area !== undefined) {
|
||||||
@@ -68,7 +72,6 @@ function show_box(tabname, focus_area) {
|
|||||||
function clear_box() {
|
function clear_box() {
|
||||||
exports.snapshot_message();
|
exports.snapshot_message();
|
||||||
$("#compose").find('input[type=text], textarea').val('');
|
$("#compose").find('input[type=text], textarea').val('');
|
||||||
$("#new_message_content").trigger('autosize');
|
|
||||||
$("#send-status").hide(0);
|
$("#send-status").hide(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,6 +342,7 @@ function send_message() {
|
|||||||
data: request,
|
data: request,
|
||||||
success: function (resp, statusText, xhr) {
|
success: function (resp, statusText, xhr) {
|
||||||
$("#new_message_content").val('').focus();
|
$("#new_message_content").val('').focus();
|
||||||
|
autosize_textarea();
|
||||||
$("#send-status").hide(0);
|
$("#send-status").hide(0);
|
||||||
if (request.type === "private") {
|
if (request.type === "private") {
|
||||||
onboarding.mark_checklist_step("sent_private_message");
|
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
|
// This is a dropped file, so make the filename a link to the image
|
||||||
textbox.val(textbox.val() + "[" + filename + "](" + response.uri + ")" + " ");
|
textbox.val(textbox.val() + "[" + filename + "](" + response.uri + ")" + " ");
|
||||||
}
|
}
|
||||||
$("#new_message_content").trigger("autosize");
|
autosize_textarea();
|
||||||
$("#compose-send-button").removeAttr("disabled");
|
$("#compose-send-button").removeAttr("disabled");
|
||||||
$("#send-status").removeClass("alert-info")
|
$("#send-status").removeClass("alert-info")
|
||||||
.hide();
|
.hide();
|
||||||
|
|||||||
Reference in New Issue
Block a user