Ticket #6925: 6925.patch
File 6925.patch, 2.9 KB (added by , 13 years ago) |
---|
-
_source/plugins/htmldataprocessor/plugin.js
527 527 toDataFormat : function( html, fixForBody ) 528 528 { 529 529 var writer = this.writer, 530 fragment = CKEDITOR.htmlParser.fragment.fromHtml( html, fixForBody );530 fragment = CKEDITOR.htmlParser.fragment.fromHtml( html, fixForBody, 1 ); 531 531 532 532 writer.reset(); 533 533 -
_source/core/htmlparser/fragment.js
58 58 * alert( fragment.children[0].name ); "b" 59 59 * alert( fragment.children[1].value ); " Text" 60 60 */ 61 CKEDITOR.htmlParser.fragment.fromHtml = function( fragmentHtml, fixForBody )61 CKEDITOR.htmlParser.fragment.fromHtml = function( fragmentHtml, fixForBody, noSpacesFix ) 62 62 { 63 63 var parser = new CKEDITOR.htmlParser(), 64 64 html = [], … … 156 156 text; 157 157 if ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT ) 158 158 { 159 if ( !( text = CKEDITOR.tools.rtrim( lastChild.value ) ) )159 if ( !( text = noSpacesFix ? lastChild.value : CKEDITOR.tools.rtrim( lastChild.value ) ) ) 160 160 element.children.length = length -1; 161 161 else 162 162 lastChild.value = text; … … 176 176 { 177 177 var element = new CKEDITOR.htmlParser.element( tagName, attributes ); 178 178 179 element._.spacesFix = !noSpacesFix; 180 179 181 // "isEmpty" will be always "false" for unknown elements, so we 180 182 // must force it if the parser has identified it as a selfClosing tag. 181 183 if ( element.isUnknown && selfClosing ) … … 358 360 parser.onText = function( text ) 359 361 { 360 362 // Trim empty spaces at beginning of element contents except <pre>. 361 if ( ! currentNode._.hasInlineStarted&& !inPre )363 if ( !( noSpacesFix || currentNode._.hasInlineStarted ) && !inPre ) 362 364 { 363 365 text = CKEDITOR.tools.ltrim( text ); 364 366 … … 371 373 372 374 if ( fixForBody 373 375 && ( !currentNode.type || currentNode.name == 'body' ) 374 && CKEDITOR.tools.trim( text) )376 && ( noSpacesFix || CKEDITOR.tools.trim( text ) ) ) 375 377 { 376 378 this.onTagOpen( fixForBody, {} ); 377 379 } … … 439 441 var len = this.children.length, 440 442 previous = len > 0 && this.children[ len - 1 ] || null; 441 443 442 if ( previous )444 if ( this._.spacesFix && previous ) 443 445 { 444 446 // If the block to be appended is following text, trim spaces at 445 447 // the right of it. 446 448 if ( node._.isBlockLike && previous.type == CKEDITOR.NODE_TEXT ) 447 449 { 448 previous.value = CKEDITOR.tools.rtrim( previous.value );450 previous.value = previous.value; 449 451 450 452 // If we have completely cleared the previous node. 451 453 if ( previous.value.length === 0 )