Fix handling of newlines in textarea input
This commit is contained in:

committed by
vitalets

parent
19f227f83c
commit
1159e26e34
@@ -53,7 +53,13 @@ $(function(){
|
||||
}
|
||||
var lines = html.split(/<br\s*\/?>/i);
|
||||
for (var i = 0; i < lines.length; i++) {
|
||||
lines[i] = $('<div>').html(lines[i]).text();
|
||||
var text = $('<div>').html(lines[i]).text();
|
||||
|
||||
// Remove newline characters (\n) to avoid them being converted by value2html() method
|
||||
// thus adding extra <br> tags
|
||||
text = text.replace(new RegExp(String.fromCharCode(10), 'g'), '');
|
||||
|
||||
lines[i] = text;
|
||||
}
|
||||
return lines.join("\n");
|
||||
},
|
||||
|
Reference in New Issue
Block a user