fix #11349: Code Editor returns \n for blank content
This commit is contained in:
parent
c16809ab99
commit
e9fdab2bf5
1 changed files with 9 additions and 3 deletions
|
|
@ -163,10 +163,16 @@
|
|||
}
|
||||
html = html.replace(/( ){4}/g,"\t"); // TODO: make softtabs configurable
|
||||
html = html.replace(/ /g," ");
|
||||
html = html.replace(/ ?<br>/gi,'\n');
|
||||
html = html.replace(/<[^>]+>/g,'');
|
||||
// Remove spaces at end of lines
|
||||
html = html.replace(/ +(\r?)\n/g,"$1\n");
|
||||
html = html.replace(/\s ?<br>/gi,'\n');
|
||||
html = html.replace(/<[^>]+>/g,'');
|
||||
|
||||
// If, after all this, we are left with only a \n, user didn't add anything
|
||||
// (editor adds a <br> if it starts blank)
|
||||
if ( html == "\n" ) {
|
||||
html = "";
|
||||
}
|
||||
|
||||
return html;
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue