Ticket #3509: 3509.patch
File 3509.patch, 1.6 KB (added by , 15 years ago) |
---|
-
K:/Source/ckeditor/_source/plugins/styles/plugin.js
283 283 function applyInlineStyle( range ) 284 284 { 285 285 var document = range.document; 286 287 var wasCollapsed = range.collapsed; 286 288 287 if ( range.collapsed ) 289 // Get next element after range. If it's a Gecko-appended BR, 290 // we want to include it in the range, so that the style will 291 // be maintained in new text added at the end of the line. 292 var nextElement = range.endContainer.getNextSourceNode( false, CKEDITOR.NODE_ELEMENT ); 293 if ( CKEDITOR.env.gecko && nextElement && nextElement.is( 'br' )) 288 294 { 295 if (range.endContainer.type != CKEDITOR.NODE_TEXT || range.endOffset === range.endContainer.getLength() ) 296 range.setEndAfter(nextElement); 297 } 298 299 if ( wasCollapsed ) 300 { 289 301 // Create the element to be inserted in the DOM. 290 302 var collapsedElement = getElement( this, document ); 303 304 // Even though the range was collapsed, it may now contain a single BR. 305 var contents = range.extractContents(); 291 306 292 307 // Insert the empty element into the DOM at the range position. 293 308 range.insertNode( collapsedElement ); 309 contents.appendTo( collapsedElement ); 294 310 295 311 // Place the selection right inside the empty element. 296 range.moveToPosition( collapsedElement, CKEDITOR.POSITION_ BEFORE_END);312 range.moveToPosition( collapsedElement, CKEDITOR.POSITION_AFTER_START ); 297 313 298 314 return; 299 315 }