mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 17:07:07 +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 () {
|
exports.cancel = function () {
|
||||||
|
compose.clear();
|
||||||
compose.hide();
|
compose.hide();
|
||||||
abort_xhr();
|
abort_xhr();
|
||||||
is_composing_message = false;
|
is_composing_message = false;
|
||||||
compose.clear();
|
|
||||||
if (message_snapshot !== undefined) {
|
if (message_snapshot !== undefined) {
|
||||||
$('#restore-draft').show();
|
$('#restore-draft').show();
|
||||||
}
|
}
|
||||||
@@ -381,7 +381,6 @@ $(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
exports.hide = function () {
|
exports.hide = function () {
|
||||||
exports.snapshot_message();
|
|
||||||
$('.message_comp').find('input, textarea, button').blur();
|
$('.message_comp').find('input, textarea, button').blur();
|
||||||
$('#stream-message').hide();
|
$('#stream-message').hide();
|
||||||
$('#private-message').hide();
|
$('#private-message').hide();
|
||||||
@@ -390,8 +389,10 @@ exports.hide = function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
exports.clear = function () {
|
exports.clear = function () {
|
||||||
|
exports.snapshot_message();
|
||||||
$("#compose").find('input[type=text], textarea').val('');
|
$("#compose").find('input[type=text], textarea').val('');
|
||||||
$("#new_message_content").trigger('autosize');
|
$("#new_message_content").trigger('autosize');
|
||||||
|
$("#send-status").hide(0);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set the mode of a compose already in progress.
|
// Set the mode of a compose already in progress.
|
||||||
@@ -603,6 +604,11 @@ $(function () {
|
|||||||
var textbox = $("#new_message_content"),
|
var textbox = $("#new_message_content"),
|
||||||
split_uri = response.uri.split("/"),
|
split_uri = response.uri.split("/"),
|
||||||
filename = split_uri[split_uri.length - 1];
|
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) {
|
if (i === -1) {
|
||||||
// This is a paste, so there's no filename. Show the image directly
|
// This is a paste, so there's no filename. Show the image directly
|
||||||
textbox.val(textbox.val() + "[pasted image](" + response.uri + ") ");
|
textbox.val(textbox.val() + "[pasted image](" + response.uri + ") ");
|
||||||
@@ -617,6 +623,9 @@ $(function () {
|
|||||||
},
|
},
|
||||||
rawDrop: function (contents) {
|
rawDrop: function (contents) {
|
||||||
var textbox = $("#new_message_content");
|
var textbox = $("#new_message_content");
|
||||||
|
if (!compose.composing()) {
|
||||||
|
respond_to_message();
|
||||||
|
}
|
||||||
textbox.val(textbox.val() + contents);
|
textbox.val(textbox.val() + contents);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1057,7 +1057,6 @@ $(function () {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.composebox-close').click(function (e) { compose.cancel(); });
|
|
||||||
$('.compose_stream_button').click(function (e) {
|
$('.compose_stream_button').click(function (e) {
|
||||||
compose.set_mode('stream');
|
compose.set_mode('stream');
|
||||||
return false;
|
return false;
|
||||||
@@ -1144,7 +1143,7 @@ $(function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Unfocus our compose area if we click out of it.
|
// Unfocus our compose area if we click out of it.
|
||||||
if (compose.composing()) {
|
if (compose.composing() && !$(e.target).is("a")) {
|
||||||
compose.cancel();
|
compose.cancel();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -1154,7 +1153,10 @@ $(function () {
|
|||||||
// "unfocusing" our compose -- in other words, e.g.
|
// "unfocusing" our compose -- in other words, e.g.
|
||||||
// clicking "Press enter to send" should not
|
// clicking "Press enter to send" should not
|
||||||
// trigger the composebox-closing code above.
|
// trigger the composebox-closing code above.
|
||||||
|
// But do allow our formatting link.
|
||||||
|
if (!$(e.target).is("a")) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// side-bar-related handlers
|
// side-bar-related handlers
|
||||||
|
|||||||
@@ -581,6 +581,7 @@ img.inline_profile_picture {
|
|||||||
width: 90%;
|
width: 90%;
|
||||||
padding: 8px 14px 8px 14px;
|
padding: 8px 14px 8px 14px;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Like .alert .close */
|
/* Like .alert .close */
|
||||||
|
|||||||
Reference in New Issue
Block a user