Ticket #1015: 1015.patch
File 1015.patch, 3.1 KB (added by , 16 years ago) |
---|
-
fckplugin.js
56 56 { 57 57 _inPre : false, 58 58 _inLSpace : false, 59 _appendSpace : false, 59 60 60 61 /* 61 62 * Returns a string representing the HTML format of "data". The returned … … 190 191 var basicElement = this._BasicElements[ sNodeName ] ; 191 192 if ( basicElement ) 192 193 { 194 193 195 if ( basicElement[0] ) 194 stringBuilder.push( basicElement[0] ) ; 196 { 197 var pNode = htmlNode.previousSibling; 195 198 199 if ( pNode != null && pNode.nodeType == 3 && ( pNode.nodeValue == " " || pNode.nodeValue == "" ) ) 200 { 201 pNode = pNode.previousSibling; 202 } 203 204 if ( pNode == null || !pNode.tagName || pNode.tagName.toLowerCase() != sNodeName || pNode.nodeValue == "" ) 205 { 206 stringBuilder.push( basicElement[0] ); 207 } 208 209 } 210 196 211 if ( !basicElement[2] ) 197 212 this._AppendChildNodes( htmlNode, stringBuilder ) ; 198 213 199 214 if ( basicElement[1] ) 200 stringBuilder.push( basicElement[1] ) ; 215 { 216 var nNode = htmlNode.nextSibling; 217 218 if ( nNode != null && nNode.nodeType == 3 && ( nNode.nodeValue == " " || nNode.nodeValue == "" ) ) 219 { 220 nNode = nNode.previousSibling; 221 } 222 223 if ( nNode == null || !nNode.tagName || nNode.tagName.toLowerCase() != sNodeName || nNode.nodeValue == "" ) 224 { 225 stringBuilder.push( basicElement[1] ); 226 } 227 228 } 229 230 if ( this._appendSpace == true ) 231 { 232 stringBuilder.push( " " ); 233 this._appendSpace = false; 234 } 235 201 236 } 202 237 else 203 238 { 239 this._appendSpace = false; 204 240 switch ( sNodeName ) 205 241 { 206 242 case 'ol' : … … 498 534 textValue = FCKTools.HTMLEncode( textValue ) ; 499 535 textValue = textValue.replace( /\u00A0/g, ' ' ) ; 500 536 501 if ( !htmlNode.previousSibling ||502 ( stringBuilder.length > 0 && stringBuilder[ stringBuilder.length - 1 ].EndsWith( '\n' ) ) && !this._inLSpace ) 537 if ( textValue != "" && ( !htmlNode.previousSibling || 538 ( stringBuilder.length > 0 && stringBuilder[ stringBuilder.length - 1 ].EndsWith( '\n' ) ) && !this._inLSpace ) ) 503 539 { 504 textValue = textValue.LTrim() ; 540 var newTextValue = textValue.LTrim() ; 541 if ( newTextValue != textValue ) 542 { 543 var old = stringBuilder[ stringBuilder.length - 1 ]; 544 stringBuilder[ stringBuilder.length - 1 ] = " "; 545 stringBuilder.push( old ); 546 } 547 548 textValue = newTextValue; 505 549 } 506 550 507 551 if ( !htmlNode.nextSibling && !this._inLSpace ) 508 textValue = textValue.RTrim() ; 552 { 553 var newTextValue = textValue.RTrim() ; 554 if ( newTextValue != textValue ) 555 { 556 this._appendSpace = true; 557 } 509 558 559 textValue = newTextValue; 560 } 561 510 562 textValue = textValue.replace( / {2,}/g, ' ' ) ; 511 563 512 564 if ( this._inLSpace && textValue.length == 1 && textValue.charCodeAt(0) == 13 ) … … 514 566 515 567 if ( this._IsInsideCell ) 516 568 textValue = textValue.replace( /\|/g, '|' ) ; 517 569 518 570 } 519 571 else 520 572 { … … 692 744 } 693 745 } 694 746 } 695 }) ; 696 No newline at end of file 747 }) ;