Changeset 2087 for MediaWiki/trunk

Show
Ignore:
Timestamp:
2008-06-18 12:08:57 (6 months ago)
Author:
wwalc
Message:

#1785 - removed one more extra line at the end of formatted text with left space

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • MediaWiki/trunk/plugins/mediawiki/fckplugin.js

    r2076 r2087  
    570570                                                                this._AppendChildNodes( htmlNode, stringBuilder, prefix ) ; 
    571571                                                                this._inLSpace = false ; 
    572                                                                 if ( !stringBuilder[stringBuilder.length-1].EndsWith("\n") ) 
     572                                                                var len = stringBuilder.length ; 
     573                                                                if ( !stringBuilder[len-1].EndsWith("\n") && !stringBuilder[len-1].EndsWith(" ") && !stringBuilder[len-2].EndsWith("\n")) { 
    573574                                                                        stringBuilder.push( "\n" ) ; 
     575                                                                        len++; 
     576                                                                } 
     577                                                                if (stringBuilder[len-1].EndsWith(" ") && stringBuilder[len-2].EndsWith("\n")) { 
     578                                                                        stringBuilder[len-1] = ""; 
     579                                                                } 
    574580                                                        } 
    575581                                                        else 
     
    646652                                        if ( this._inLSpace && textValue.length == 1 && textValue.charCodeAt(0) == 13 ) 
    647653                                                textValue = textValue + " " ; 
     654 
     655                                        //1785 - remove extra line 
     656                                        if ( !this._inLSpace && !this._inPre && textValue == " " ) { 
     657                                                var len = stringBuilder.length; 
     658                                                if (len > 1) { 
     659                                                        var tail = stringBuilder[len-2] + stringBuilder[len-1]; 
     660                                                        if ( tail.toString().EndsWith( "\n" ) ) 
     661                                                                textValue = ""; 
     662                                                } 
     663                                        } 
     664 
    648665                                        if ( this._IsInsideCell ) 
    649666                                                textValue = textValue.replace( /\|/g, '|' ) ;