Ticket #3457: 3457_3.patch
File 3457_3.patch, 1.9 KB (added by , 13 years ago) |
---|
-
_source/core/htmlparser/fragment.js
67 67 pendingInline = [], 68 68 pendingBRs = [], 69 69 currentNode = fragment, 70 // Indicate we're inside a <textarea> element, spaces should be touched differently. 71 inTextarea = false, 70 72 // Indicate we're inside a <pre> element, spaces should be touched differently. 71 73 inPre = false; 72 74 … … 161 163 162 164 // Rtrim empty spaces on block end boundary. (#3585) 163 165 if ( element._.isBlockLike 164 && element.name != 'pre' )166 && element.name != 'pre' && element.name != 'textarea' ) 165 167 { 166 168 167 169 var length = element.children.length, … … 212 214 currentNode.add( new CKEDITOR.htmlParser.text( '\n' ) ); 213 215 return; 214 216 } 217 else if ( tagName == 'textarea' ) 218 inTextarea = true; 215 219 216 220 if ( tagName == 'br' ) 217 221 { … … 345 349 if ( currentNode.name == 'pre' ) 346 350 inPre = false; 347 351 352 if ( currentNode.name == 'textarea' ) 353 inTextarea = false; 354 348 355 if ( candidate._.isBlockLike ) 349 356 sendPendingBRs(); 350 357 … … 364 371 365 372 parser.onText = function( text ) 366 373 { 367 // Trim empty spaces at beginning of text contents except <pre> .368 if ( ( !currentNode._.hasInlineStarted || pendingBRs.length ) && !inPre )374 // Trim empty spaces at beginning of text contents except <pre> and <textarea>. 375 if ( ( !currentNode._.hasInlineStarted || pendingBRs.length ) && !inPre && !inTextarea ) 369 376 { 370 377 text = CKEDITOR.tools.ltrim( text ); 371 378 … … 385 392 386 393 // Shrinking consequential spaces into one single for all elements 387 394 // text contents. 388 if ( !inPre )395 if ( !inPre && !inTextarea ) 389 396 text = text.replace( /[\t\r\n ]{2,}|[\t\r\n]/g, ' ' ); 390 397 391 398 currentNode.add( new CKEDITOR.htmlParser.text( text ) );