mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 21:43:21 +00:00
Turn newlines into linebreaks.
(imported from commit 67999641a8cff471be1430e421f259b1c558444d)
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
{% endif %}
|
||||
|
||||
<span onclick="prepare_personal('{{ zephyr.sender.user.username }}')" class="label zephyr_sender">{{ zephyr.sender.user.username }}</span><br />
|
||||
{{ zephyr.content }}
|
||||
{{ zephyr.content|linebreaksbr }}
|
||||
</p></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
||||
@@ -183,6 +183,10 @@ $(function() {
|
||||
setInterval(get_updates, 1000);
|
||||
});
|
||||
|
||||
function newline2br(content) {
|
||||
return content.replace(/\n/g, '<br />');
|
||||
}
|
||||
|
||||
function add_message(index, zephyr) {
|
||||
var new_str = "<tr id=" + zephyr.id + ">" +
|
||||
"<td class='pointer'><p></p></td>" +
|
||||
@@ -200,7 +204,7 @@ function add_message(index, zephyr) {
|
||||
}
|
||||
new_str += "<span onclick=\"prepare_personal('" + zephyr.sender + "')\" class='label zephyr_sender'>"
|
||||
+ zephyr.sender + "</span><br />"
|
||||
+ zephyr.content +
|
||||
+ newline2br(zephyr.content) +
|
||||
"</p></td>" +
|
||||
"</tr>";
|
||||
$("#table tr:last").after(new_str);
|
||||
|
||||
Reference in New Issue
Block a user