Permalink
Browse files

Fixing "removing" (before bold text underlined and so on) necessary s…

…paces

when editor does format html to better shape (increase readability)
  • Loading branch information...
julmis
julmis committed Apr 28, 2005
1 parent 1da8c56 commit d3a144d3b64084990e1d3246c48a3e8a34165dad
Showing with 9 additions and 9 deletions.
  1. +9 −9 lib/editor/htmlarea.php
View
@@ -2466,27 +2466,27 @@ function hex(d) {
format.regex.unindent = /^<\/(HTML|HEAD|BODY|FORM|TABLE|TBODY|THEAD|TR|UL|OL)[ >]/i ;
format.regex.inremove = new RegExp( indentchar );
- var formatted = html.replace( format.regex.tagopen, '\n$&' );
- formatted = formatted.replace( format.regex.tagclose, '$&\n' );
- formatted = formatted.replace( format.regex.taglines, '$&\n' );
- formatted = formatted.replace( format.regex.tagsmain, '\n$&\n' );
+ //var formatted = html.replace( format.regex.tagopen, '\n$&' );
+ //formatted = formatted.replace( format.regex.tagclose, '$&\n' );
+ //formatted = formatted.replace( format.regex.taglines, '$&\n' );
+ //formatted = formatted.replace( format.regex.tagsmain, '\n$&\n' );
var indentation = '';
- var tolines = formatted.split(format.regex.splitter);
+ var tolines = html.split(format.regex.splitter);
var formatted = '';
for (var i = 0; i < tolines.length; i++) {
var line = tolines[i];
if (line.length < 1) {
continue;
}
- if (format.regex.unindent.test(line)) {
+ if (format.regex.unindent.test(line) && !format.regex.notouchy.test(line)) {
indentation = indentation.replace(format.regex.inremove, '') ;
}
- line = !format.regex.notouchy.test(line) ? line.replace(format.regex.tagopen, '\n$&') : line.replace(format.regex.tagopen, '$&');
- line = !format.regex.notouchy.test(line) ? line.replace(format.regex.tagclose, '$&\n'): line.replace(format.regex.tagclose, '$&');
- line = !format.regex.notouchy.test(line) ? line.replace(format.regex.tagsmain, '$&\n'): line.replace(format.regex.tagsmain, '$&');
+ line = !format.regex.notouchy.test(line) ? line.replace(format.regex.tagopen, '\n$&') : line;
+ line = !format.regex.notouchy.test(line) ? line.replace(format.regex.tagclose, '$&\n'): line;
+ line = !format.regex.notouchy.test(line) ? line.replace(format.regex.tagsmain, '$&\n'): line;
formatted += indentation + line;

0 comments on commit d3a144d

Please sign in to comment.