preserve line breaks when editing comments, finally closes #77
This commit is contained in:
parent
13d979e290
commit
f09b6b9bdb
@ -194,7 +194,7 @@ define(["app/text/html", "app/dom", "app/utils", "app/config", "app/api", "app/m
|
||||
api.view(comment.id, 1).then(function(rv) {
|
||||
var textarea = lib.editorify($.new("div.textarea"));
|
||||
|
||||
textarea.textContent = rv.text;
|
||||
textarea.innerHTML = utils.detext(rv.text);
|
||||
textarea.focus();
|
||||
|
||||
text.classList.remove("text");
|
||||
|
@ -48,9 +48,15 @@ define(["app/markup"], function(Mark) {
|
||||
return _.textContent.trim();
|
||||
};
|
||||
|
||||
var detext = function(text) {
|
||||
return text.replace(/\n\n/gi, '<br><div><br></div>')
|
||||
.replace(/\n/gi, '<br>');
|
||||
};
|
||||
|
||||
return {
|
||||
cookie: cookie,
|
||||
ago: ago,
|
||||
text: text
|
||||
text: text,
|
||||
detext: detext
|
||||
};
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user