mirror of
https://github.com/jech/galene.git
synced 2024-11-22 08:35:57 +01:00
Revert "Don't break lines manually in chat messages."
This reverts commit 2eca0e44d5
.
This commit is contained in:
parent
dd4ab058ef
commit
547ff1e6c4
1 changed files with 18 additions and 2 deletions
|
@ -2959,6 +2959,23 @@ function formatLine(line) {
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string[]} lines
|
||||
* @returns {HTMLElement}
|
||||
*/
|
||||
function formatLines(lines) {
|
||||
let elts = [];
|
||||
if(lines.length > 0)
|
||||
elts = formatLine(lines[0]);
|
||||
for(let i = 1; i < lines.length; i++) {
|
||||
elts.push(document.createElement('br'));
|
||||
elts = elts.concat(formatLine(lines[i]));
|
||||
}
|
||||
let elt = document.createElement('p');
|
||||
elts.forEach(e => elt.appendChild(e));
|
||||
return elt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {number} time
|
||||
* @returns {string}
|
||||
|
@ -3009,8 +3026,7 @@ function addToChatbox(peerId, dest, nick, time, privileged, history, kind, messa
|
|||
container.classList.add('message-private');
|
||||
|
||||
if(kind !== 'me') {
|
||||
let p = document.createElement('p');
|
||||
p.textContent = message.toString();
|
||||
let p = formatLines(message.toString().split('\n'));
|
||||
let doHeader = true;
|
||||
if(!peerId && !dest && !nick) {
|
||||
doHeader = false;
|
||||
|
|
Loading…
Reference in a new issue