Ticket #3836: 3836.patch
File 3836.patch, 3.2 KB (added by , 16 years ago) |
---|
-
_source/plugins/list/plugin.js
335 335 } 336 336 337 337 var newList = CKEDITOR.plugins.list.arrayToList( listArray, database, null, editor.config.enterMode ); 338 339 // Compensate a <br> before the first node if the previous node of list is a non-blocks.(#3836) 340 var docFragment = newList.listNode, firstNode, previousNode; 341 if ( ( firstNode = docFragment.getFirst() ) 342 && !( firstNode.is && firstNode.isBlockBoundary() ) 343 && ( previousNode = groupObj.root.getPrevious( true ) ) 344 && !( previousNode.is && previousNode.isBlockBoundary( { br : 1 } ) ) ) 345 editor.document.createElement( 'br' ).insertBefore( firstNode ); 346 338 347 // If groupObj.root is the last element in its parent, or its nextSibling is a <br>, then we should 339 348 // not add a <br> after the final item. So, check for the cases and trim the <br>. 340 349 if ( !groupObj.root.getNext() || groupObj.root.getNext().$.nodeName.toLowerCase() == 'br' ) … … 342 351 if ( newList.listNode.getLast().$.nodeName.toLowerCase() == 'br' ) 343 352 newList.listNode.getLast().remove(); 344 353 } 345 newList.listNode.replace( groupObj.root );354 docFragment.replace( groupObj.root ); 346 355 } 347 356 348 357 function listCommand( name, type ) -
_source/tests/plugins/list/list.html
161 161 this.wait(); 162 162 }, 163 163 164 /** 165 * Test remove list first list item not merging with previous text node. 166 */ 167 test_ticket_3836 : function() 168 { 169 prepareEditor( 'test_ticket_3836_editor', null, 170 { enterMode : CKEDITOR.ENTER_BR }, 171 function( editor ) 172 { 173 this.resume( function() 174 { 175 editor.focus(); 176 177 var doc = editor.document, 178 range = new CKEDITOR.dom.range( doc ); 179 setRange( range, [ 1, 1, 0, 0 ], [ 1, 1, 1, 1 ] ); 180 debugger; 181 var sel = editor.getSelection(); 182 sel.selectRanges( [ range ] ); 183 184 // Waiting for 'comand state' effected. 185 this.wait( function(){ 186 // Remove list. 187 editor.execCommand( 'bulletedlist' ); 188 assert.areSame( getTextAreaValue( 'test_ticket_3836_result' ), 189 editor.getData(), 190 'Remove list result not correct.' ); 191 }, 1000 ); 192 193 } ); 194 }, this ); 195 this.wait(); 196 }, 197 164 198 name :document.title 165 199 }; 166 200 } )() ); … … 174 208 <textarea id="test_ticket_3820_result"><ul><li>bullet line 1</li><li>bullet line 2</li><li>Second line</li></ul></textarea> 175 209 <textarea id="test_ticket_3773_editor"><ol><li>line1</li><li>line2</li></ol></textarea> 176 210 <textarea id="test_ticket_3773_result">line1<br />line2</textarea> 211 <textarea id="test_ticket_3836_editor">line1<ul><li>item1</li><li>item2</li></ul>line2</textarea> 212 <textarea id="test_ticket_3836_result">line1<br />item1<br />item2<br />line2</textarea> 177 213 </body> 178 214 </html>