mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 08:56:10 +00:00
Additional always-visible-composebox fixups.
* Start a compose when we do a file upload * Restore the "Formatting" and "Feedback" links. * Dismiss composebox error messages when we defocus composebox Realistically, the "correct" way to do this is not to have to explicitly manage the composebox's state, as we do now -- it should just be 100% visible and ready to send any time you click 'send'; it shouldn't need to have first been composebox.start()ed. (imported from commit 7f1725c229ed968a9b5500b25d600306173182a0)
This commit is contained in:
@@ -232,10 +232,10 @@ function abort_xhr () {
|
||||
}
|
||||
|
||||
exports.cancel = function () {
|
||||
compose.clear();
|
||||
compose.hide();
|
||||
abort_xhr();
|
||||
is_composing_message = false;
|
||||
compose.clear();
|
||||
if (message_snapshot !== undefined) {
|
||||
$('#restore-draft').show();
|
||||
}
|
||||
@@ -381,7 +381,6 @@ $(function () {
|
||||
});
|
||||
|
||||
exports.hide = function () {
|
||||
exports.snapshot_message();
|
||||
$('.message_comp').find('input, textarea, button').blur();
|
||||
$('#stream-message').hide();
|
||||
$('#private-message').hide();
|
||||
@@ -390,8 +389,10 @@ exports.hide = function () {
|
||||
};
|
||||
|
||||
exports.clear = function () {
|
||||
exports.snapshot_message();
|
||||
$("#compose").find('input[type=text], textarea').val('');
|
||||
$("#new_message_content").trigger('autosize');
|
||||
$("#send-status").hide(0);
|
||||
};
|
||||
|
||||
// Set the mode of a compose already in progress.
|
||||
@@ -603,6 +604,11 @@ $(function () {
|
||||
var textbox = $("#new_message_content"),
|
||||
split_uri = response.uri.split("/"),
|
||||
filename = split_uri[split_uri.length - 1];
|
||||
// Urgh, yet another hack to make sure we're "composing"
|
||||
// when text gets added into the composebox.
|
||||
if (!compose.composing()) {
|
||||
respond_to_message();
|
||||
}
|
||||
if (i === -1) {
|
||||
// This is a paste, so there's no filename. Show the image directly
|
||||
textbox.val(textbox.val() + "[pasted image](" + response.uri + ") ");
|
||||
@@ -617,6 +623,9 @@ $(function () {
|
||||
},
|
||||
rawDrop: function (contents) {
|
||||
var textbox = $("#new_message_content");
|
||||
if (!compose.composing()) {
|
||||
respond_to_message();
|
||||
}
|
||||
textbox.val(textbox.val() + contents);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1057,7 +1057,6 @@ $(function () {
|
||||
return false;
|
||||
});
|
||||
|
||||
$('.composebox-close').click(function (e) { compose.cancel(); });
|
||||
$('.compose_stream_button').click(function (e) {
|
||||
compose.set_mode('stream');
|
||||
return false;
|
||||
@@ -1144,7 +1143,7 @@ $(function () {
|
||||
}
|
||||
|
||||
// Unfocus our compose area if we click out of it.
|
||||
if (compose.composing()) {
|
||||
if (compose.composing() && !$(e.target).is("a")) {
|
||||
compose.cancel();
|
||||
}
|
||||
});
|
||||
@@ -1154,7 +1153,10 @@ $(function () {
|
||||
// "unfocusing" our compose -- in other words, e.g.
|
||||
// clicking "Press enter to send" should not
|
||||
// trigger the composebox-closing code above.
|
||||
// But do allow our formatting link.
|
||||
if (!$(e.target).is("a")) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
});
|
||||
|
||||
// side-bar-related handlers
|
||||
|
||||
@@ -581,6 +581,7 @@ img.inline_profile_picture {
|
||||
width: 90%;
|
||||
padding: 8px 14px 8px 14px;
|
||||
line-height: 20px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Like .alert .close */
|
||||
|
||||
Reference in New Issue
Block a user