Ticket #4344: 4344.patch
File 4344.patch, 2.4 KB (added by , 15 years ago) |
---|
-
_tests/dt/plugins/htmldataprocessor/htmldataprocessor.html
224 224 assert.areSame( expected, dataProcessor.toHtml( '<p>Some text<br></p>' )); 225 225 }, 226 226 227 test_toHtml_ticket_2886_5 : function() 228 { 229 var dataProcessor = CKEDITOR.instances.editor1.dataProcessor; 230 assert.areSame( '<p>\n\t<br />\n\t </p>\n', 231 dataProcessor.toDataFormat( dataProcessor.toHtml( '<p><br />\n<br /></p>' ) ) ); 232 }, 233 227 234 test_ticket_3407 : function() 228 235 { 229 236 var editor = CKEDITOR.instances.editor1, -
_source/plugins/htmldataprocessor/plugin.js
11 11 12 12 var protectedSourceMarker = '{cke_protected}'; 13 13 14 15 // Return the last non-space child node of the block (#4344). 16 function lastNoneSpaceChild( block ) 17 { 18 var lastIndex = block.children.length, 19 last = block.children[ lastIndex - 1 ]; 20 while( last && last.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.trim( last.value ) ) 21 last = block.children[ --lastIndex ]; 22 return last || null; 23 } 24 14 25 function trimFillers( block, fromSource ) 15 26 { 16 27 // If the current node is a block, and if we're converting from source or … … 18 29 // 19 30 // Also, any at the end of blocks are fillers, remove them as well. 20 31 // (#2886) 21 var children = block.children; 22 var lastChild = children[ children.length - 1 ]; 32 var children = block.children, lastChild = lastNoneSpaceChild( block ); 23 33 if ( lastChild ) 24 34 { 25 35 if ( ( fromSource || !CKEDITOR.env.ie ) && lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br' ) … … 31 41 32 42 function blockNeedsExtension( block ) 33 43 { 34 if ( block.children.length < 1 ) 35 return true; 36 37 var lastChild = block.children[ block.children.length - 1 ]; 38 return lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br'; 44 var lastChild = lastNoneSpaceChild( block ); 45 return !lastChild || lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.name == 'br'; 39 46 } 40 47 41 48 function extendBlockForDisplay( block )