diff --git a/www/extras/yui-webgui/build/code-editor/code-editor.js b/www/extras/yui-webgui/build/code-editor/code-editor.js
index 701fb4439..74e661780 100755
--- a/www/extras/yui-webgui/build/code-editor/code-editor.js
+++ b/www/extras/yui-webgui/build/code-editor/code-editor.js
@@ -163,10 +163,16 @@
}
html = html.replace(/( ){4}/g,"\t"); // TODO: make softtabs configurable
html = html.replace(/ /g," ");
- html = html.replace(/ ?
/gi,'\n');
- html = html.replace(/<[^>]+>/g,'');
// Remove spaces at end of lines
- html = html.replace(/ +(\r?)\n/g,"$1\n");
+ html = html.replace(/\s ?
/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
if it starts blank)
+ if ( html == "\n" ) {
+ html = "";
+ }
+
return html;
};