Ticket #3820: 3820_2.patch
File 3820_2.patch, 7.1 KB (added by , 15 years ago) |
---|
-
_source/plugins/list/plugin.js
491 491 sibling.getName() == listCommand.type ) 492 492 { 493 493 sibling.remove(); 494 sibling.moveChildren( listNode ); 494 // Move children order by merge direction.(#3820) 495 sibling.moveChildren( listNode, rtl ? true : false ); 495 496 } 496 497 } )(); 497 498 mergeSibling( true ); -
_source/tests/plugins/list/list.html
1 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 3 <head> 4 <title>Plugin: toolbar</title>4 <title>Plugin: list</title> 5 5 <link rel="stylesheet" type="text/css" href="../../test.css" /> 6 6 <script type="text/javascript" src="../../../../ckeditor_source.js"></script> 7 7 <script type="text/javascript" src="../../test.js"></script> … … 26 26 document.getElementById( elementId ); 27 27 if ( isMe ) 28 28 { 29 callback.call( context, evt.editor ); 29 var editor = evt.editor; 30 // Force result data unformatted. 31 editor.dataProcessor.writer._.rules = {}; 32 callback.call( context, editor ); 30 33 } 31 34 }, this ); 32 35 … … 105 108 { 106 109 editor.focus(); 107 110 108 // Force result data unformatted.109 editor.dataProcessor.writer._.rules = {};110 111 111 var doc = editor.document, 112 112 range = new CKEDITOR.dom.range( doc ); 113 113 … … 119 119 this.wait( function(){ 120 120 // Remove list. 121 121 editor.execCommand( 'numberedlist' ); 122 assert.areSame( getTextAreaValue( 'test_ticket_3151_result Content' ),122 assert.areSame( getTextAreaValue( 'test_ticket_3151_result' ), 123 123 editor.getData(), 124 124 'Remove list result not correct.' ); 125 }, 1000 );125 }, 1000 ); 126 126 127 127 } ); 128 128 }, this ); 129 129 this.wait(); 130 130 }, 131 131 132 name :document.title 133 }; 134 } )() ); 135 //]]> 136 </script> 137 </head> 138 <body> 139 <textarea id="test_ticket_3151_editor"><ol><li>text</li></ol></textarea> 140 <textarea id="test_ticket_3151_resultContent">text</textarea> 141 </body> 142 </html> 143 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 144 <html xmlns="http://www.w3.org/1999/xhtml"> 145 <head> 146 <title>Plugin: toolbar</title> 147 <link rel="stylesheet" type="text/css" href="../../test.css" /> 148 <script type="text/javascript" src="../../../../ckeditor_source.js"></script> 149 <script type="text/javascript" src="../../test.js"></script> 150 <script type="text/javascript"> 151 //<![CDATA[ 152 /** 153 * Load the editor and wait for fully interactable. 154 * @param {Object} elementId 155 * @parma {Object} mode 156 * @param {Object} config 157 * @param {Object} callback Continuation with {@param editor}. 158 * @param {Object} context 159 */ 160 function prepareEditor( elementId, mode, config, callback, context ) 161 { 162 CKEDITOR.on( 'instanceReady', 163 function( evt ) 164 { 165 var isMe = mode == CKEDITOR.ELEMENT_MODE_REPLACE ? 166 evt.editor.name == elementId 167 : evt.editor.element.$ == 168 document.getElementById( elementId ); 169 if ( isMe ) 170 { 171 callback.call( context, evt.editor ); 172 } 173 }, this ); 174 175 mode = mode || CKEDITOR.ELEMENT_MODE_REPLACE; 176 switch( mode ) 177 { 178 case CKEDITOR.ELEMENT_MODE_REPLACE : 179 CKEDITOR.replace( elementId, config ); 180 break; 181 case CKEDITOR.ELEMENT_MODE_APPENDTO : 182 CKEDITOR.appendTo( elementId, config ); 183 break; 184 } 185 } 186 187 /** 188 * IE always returning CRLF for line-feed, so remove it when retrieving 189 * pre-formated text from text area. 190 */ 191 function getTextAreaValue( id ) 192 { 193 return CKEDITOR.document.getById( id ).getValue().replace( /\r/gi, '' ); 194 } 195 196 CKEDITOR.test.addTestCase( ( function() 197 { 198 199 // Local references. 200 var assert = CKEDITOR.test.assert, 201 doc = CKEDITOR.document, 202 action = YAHOO.util.UserAction, 203 selector = YAHOO.util.Selector; 204 205 /** 206 * Set the range with the start/end position specified by the locator, which in form of bookmark2. 207 * @param {Object} range 208 * @param {Array} startPosition range start path including offset 209 * @param {Array|Boolean} endPositoin range end path including offset or is collapsed 210 */ 211 function setRange( range, startPosition, endPositoin ) 212 { 213 var bm = { 214 end : null, 215 start : null, 216 is2: true, 217 startOffset : 0, 218 endoffset : 0 219 }; 220 bm.start = startPosition.slice( 0, startPosition.length - 1 ); 221 bm.startOffset = startPosition[ startPosition.length -1]; 222 if( endPositoin === true ) 223 { 224 bm.end = bm.start.slice(); 225 bm.endOffset = bm.startOffset; 226 } 227 else 228 { 229 bm.end = endPositoin.slice( 0, endPositoin.length - 1 ); 230 bm.endOffset = endPositoin[ endPositoin.length -1 ]; 231 } 232 range.moveToBookmark( bm ); 233 } 234 235 return { 236 237 /** 238 * Test remove numbered list with 'enterMode = BR'. 239 */ 240 test_ticket_3151 : function() 241 { 242 prepareEditor( 'test_ticket_3151_editor', null, 132 /** 133 * Test merge newlist with previous list. 134 */ 135 test_ticket_3820 : function() 136 { 137 prepareEditor( 'test_ticket_3820_editor', null, 243 138 { enterMode : CKEDITOR.ENTER_BR }, 244 139 function( editor ) 245 140 { … … 247 142 { 248 143 editor.focus(); 249 144 250 // Force result data unformatted.251 editor.dataProcessor.writer._.rules = {};252 253 145 var doc = editor.document, 254 146 range = new CKEDITOR.dom.range( doc ); 255 256 setRange( range, [ 1, 0, 0, 0, 0 ], true ); 147 setRange( range, [ 1, 1, 0 ], true ); 257 148 var sel = editor.getSelection(); 258 149 sel.selectRanges( [ range ] ); 259 150 260 151 // Waiting for 'comand state' effected. 261 152 this.wait( function(){ 262 153 // Remove list. 263 editor.execCommand( ' numberedlist' );264 assert.areSame( getTextAreaValue( 'test_ticket_3 151_resultContent' ),154 editor.execCommand( 'bulletedlist' ); 155 assert.areSame( getTextAreaValue( 'test_ticket_3820_result' ), 265 156 editor.getData(), 266 ' Remove list result not correct.' );267 }, 1000 );157 'Merge list result not correct.' ); 158 }, 1000 ); 268 159 269 160 } ); 270 161 }, this ); … … 277 168 //]]> 278 169 </script> 279 170 </head> 280 <body> 171 <body>? 281 172 <textarea id="test_ticket_3151_editor"><ol><li>text</li></ol></textarea> 282 <textarea id="test_ticket_3151_resultContent">text</textarea> 173 <textarea id="test_ticket_3151_result">text</textarea> 174 <textarea id="test_ticket_3820_editor"><ul><li>bullet line 1</li><li>bullet line 2</li></ul><p>Second line</p></textarea> 175 <textarea id="test_ticket_3820_result"><ul><li>bullet line 1</li><li>bullet line 2</li><li>Second line</li></ul></textarea> 283 176 </body> 284 177 </html>