mirror of
https://github.com/jech/galene.git
synced 2024-11-10 02:35:58 +01:00
Don't break lines manually in chat messages.
This is no longer necessary since we use "pre-wrap" in the CSS.
This commit is contained in:
parent
a7ccfba407
commit
2eca0e44d5
1 changed files with 2 additions and 18 deletions
|
@ -2955,23 +2955,6 @@ function formatLine(line) {
|
||||||
return result;
|
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
|
* @param {number} time
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
|
@ -3022,7 +3005,8 @@ function addToChatbox(peerId, dest, nick, time, privileged, history, kind, messa
|
||||||
container.classList.add('message-private');
|
container.classList.add('message-private');
|
||||||
|
|
||||||
if(kind !== 'me') {
|
if(kind !== 'me') {
|
||||||
let p = formatLines(message.toString().split('\n'));
|
let p = document.createElement('p');
|
||||||
|
p.textContent = message.toString();
|
||||||
let doHeader = true;
|
let doHeader = true;
|
||||||
if(!peerId && !dest && !nick) {
|
if(!peerId && !dest && !nick) {
|
||||||
doHeader = false;
|
doHeader = false;
|
||||||
|
|
Loading…
Reference in a new issue