mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 23:13:25 +00:00
Don't strip leading/trailing whitespace from the compose box
Fixes #719, "Indenting four spaces doesn't create a code block in the first paragraph". (imported from commit 697535b2d25d7191b565d26b601bb98722794978)
This commit is contained in:
@@ -216,23 +216,23 @@ exports.composing = function () {
|
|||||||
return is_composing_message;
|
return is_composing_message;
|
||||||
};
|
};
|
||||||
|
|
||||||
function get_or_set(fieldname) {
|
function get_or_set(fieldname, keep_outside_whitespace) {
|
||||||
// We can't hoist the assignment of 'elem' out of this lambda,
|
// We can't hoist the assignment of 'elem' out of this lambda,
|
||||||
// because the DOM element might not exist yet when get_or_set
|
// because the DOM element might not exist yet when get_or_set
|
||||||
// is called.
|
// is called.
|
||||||
return function (newval) {
|
return function (newval) {
|
||||||
var elem = $('#'+fieldname);
|
var elem = $('#'+fieldname);
|
||||||
var oldval = $.trim(elem.val());
|
var oldval = elem.val();
|
||||||
if (newval !== undefined) {
|
if (newval !== undefined) {
|
||||||
elem.val(newval);
|
elem.val(newval);
|
||||||
}
|
}
|
||||||
return oldval;
|
return keep_outside_whitespace ? oldval : $.trim(oldval);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.stream_name = get_or_set('stream');
|
exports.stream_name = get_or_set('stream');
|
||||||
exports.subject = get_or_set('subject');
|
exports.subject = get_or_set('subject');
|
||||||
exports.message_content = get_or_set('new_message_content');
|
exports.message_content = get_or_set('new_message_content', true);
|
||||||
exports.recipient = get_or_set('private_message_recipient');
|
exports.recipient = get_or_set('private_message_recipient');
|
||||||
|
|
||||||
function compose_error(error_text, bad_input) {
|
function compose_error(error_text, bad_input) {
|
||||||
|
|||||||
Reference in New Issue
Block a user