Ticket #3091: 3091.patch
File 3091.patch, 2.3 KB (added by , 15 years ago) |
---|
-
_source/plugins/styles/plugin.js
277 277 278 278 // Get the first node to be processed and the last, which concludes the 279 279 // processing. 280 var boundaryNodes = range.getBoundaryNodes(); 281 var firstNode = boundaryNodes.startNode; 282 var lastNode = boundaryNodes.endNode;280 var enLargedBookmark = range.createBookmark(), 281 firstNode = enLargedBookmark.startNode, 282 lastNode = enLargedBookmark.endNode; 283 283 284 // The detection algorithm below skips the contents inside bookmark nodes, so285 // we'll need to make sure lastNode isn't the inside a bookmark node.286 var lastParent = lastNode.getParent();287 if ( lastParent && lastParent.getAttribute( '_fck_bookmark' ) )288 lastNode = lastParent;289 284 290 if ( lastNode.equals( firstNode ) ) 291 { 292 // If the last node is the same as the the first one, we must move 293 // it to the next one, otherwise the first one will not be 294 // processed. 295 lastNode = lastNode.getNextSourceNode( true ); 296 297 // It may happen that there are no more nodes after it (the end of 298 // the document), so we must add something there to make our code 299 // simpler. 300 if ( !lastNode ) 301 { 302 lastNode = document.createText( '' ); 303 lastNode.insertAfter( firstNode ); 304 } 305 } 306 307 var currentNode = firstNode; 285 var currentNode = firstNode.getNextSourceNode( true ); 308 286 309 287 var styleRange; 310 288 … … 356 334 if ( nodeType == CKEDITOR.NODE_TEXT || ( nodeType == CKEDITOR.NODE_ELEMENT && !currentNode.getChildCount() && currentNode.$.offsetWidth ) ) 357 335 { 358 336 var includedNode = currentNode; 359 var parentNode; 337 var parentNode, nextNode; 338 339 // Bypass bookmark nodes. 340 if( ( nextNode = includedNode.getNext() ) && 341 nextNode.getAttribute( '_fck_bookmark' ) ) 342 includedNode = nextNode; 360 343 361 344 // This node is about to be included completelly, but, 362 345 // if this is the last node in its parent, we must also … … 460 443 } 461 444 } 462 445 463 // this._FixBookmarkStart( startNode ); 464 446 range.moveToBookmark( enLargedBookmark ); 465 447 range.moveToBookmark( bookmark ); 466 448 } 467 449