Ticket #3783: 3783.patch
File 3783.patch, 5.2 KB (added by , 15 years ago) |
---|
-
_source/plugins/list/plugin.js
486 486 var mergeSibling, listCommand = this; 487 487 ( mergeSibling = function( rtl ){ 488 488 489 var sibling = listNode[ rtl ? 'getPrevious' : 'getNext' ].call( listNode, true ); 489 var sibling = listNode[ rtl ? 490 'getPrevious' : 'getNext' ]( CKEDITOR.dom.walker.whitespaces( true ) ); 490 491 if ( sibling && sibling.getName && 491 492 sibling.getName() == listCommand.type ) 492 493 { -
_source/plugins/wysiwygarea/plugin.js
166 166 var children = fixedBlock.getChildren(), 167 167 count = children.count(), 168 168 firstChild, 169 previousElement = fixedBlock.getPrevious( true ), 170 nextElement = fixedBlock.getNext( true ), 169 whitespaceGuard = CKEDITOR.dom.walker.whitespaces( true ), 170 previousElement = fixedBlock.getPrevious( whitespaceGuard ), 171 nextElement = fixedBlock.getNext( whitespaceGuard ), 171 172 enterBlock; 172 173 if ( previousElement && previousElement.getName 173 174 && !( previousElement.getName() in nonExitableElementNames ) ) -
_source/core/dom/node.js
350 350 return node; 351 351 }, 352 352 353 getPrevious : function( ignoreSpaces)353 getPrevious : function( guard ) 354 354 { 355 var previous = this.$ .previousSibling;356 while ( ignoreSpaces && previous && ( previous.nodeType == CKEDITOR.NODE_TEXT )357 && !CKEDITOR.tools.trim( previous.nodeValue ) )355 var previous = this.$; 356 do 357 { 358 358 previous = previous.previousSibling; 359 } 360 while ( previous && guard && !guard( new CKEDITOR.dom.element( previous ) ) ) 359 361 360 362 return previous ? new CKEDITOR.dom.node( previous ) : null; 361 363 }, 362 364 363 365 /** 364 366 * Gets the node that follows this element in its parent's child list. 365 * @param {Boolean} ignoreSpaces Whether should ignore empty text nodes. 366 * @returns {CKEDITOR.dom.node} The next node or null if not 367 * available. 367 * @returns {CKEDITOR.dom.node} The next node or null if not available. 368 368 * @example 369 369 * var element = CKEDITOR.dom.element.createFromHtml( '<div><b>Example</b> <i>next</i></div>' ); 370 370 * var first = <b>element.getFirst().getNext()</b>; 371 371 * alert( first.getName() ); // "i" 372 372 */ 373 getNext : function( ignoreSpaces)373 getNext : function( guard ) 374 374 { 375 var next = this.$ .nextSibling;376 while ( ignoreSpaces && next && ( next.nodeType == CKEDITOR.NODE_TEXT )377 && !CKEDITOR.tools.trim( next.nodeValue ) )375 var next = this.$; 376 do 377 { 378 378 next = next.nextSibling; 379 } 380 while ( next && guard && !guard( new CKEDITOR.dom.element( next ) ) ) 379 381 380 382 return next ? new CKEDITOR.dom.node( next ) : null; 381 383 }, -
_source/plugins/domiterator/plugin.js
287 287 288 288 if ( removeLastBr ) 289 289 { 290 // Ignore bookmark nodes.(#3783) 291 var bookmarkGuard = CKEDITOR.dom.walker.bookmark( false, true ); 292 290 293 var lastChild = block.getLast(); 291 294 if ( lastChild && lastChild.type == CKEDITOR.NODE_ELEMENT && lastChild.getName() == 'br' ) 292 295 { 293 296 // Take care not to remove the block expanding <br> in non-IE browsers. 294 if ( CKEDITOR.env.ie || lastChild.getPrevious() || lastChild.getNext() ) 297 if ( CKEDITOR.env.ie 298 || lastChild.getPrevious( bookmarkGuard ) 299 || lastChild.getNext( bookmarkGuard ) ) 295 300 lastChild.remove(); 296 301 } 297 302 } -
_source/core/dom/walker.js
379 379 380 380 return function( node ) 381 381 { 382 var retval, parent;382 var isBookmark, parent; 383 383 // Is bookmark inner text node? 384 retval= ( node && !node.getName && ( parent = node.getParent() )384 isBookmark = ( node && !node.getName && ( parent = node.getParent() ) 385 385 && isBookmarkNode( parent ) ); 386 386 // Is bookmark node? 387 retval = contentOnly ? retval : retval|| isBookmarkNode( node );388 return isReject ? !retval : !!retval;387 isBookmark = contentOnly ? isBookmark : isBookmark || isBookmarkNode( node ); 388 return isReject ^ isBookmark; 389 389 }; 390 390 }; 391 391 392 /** 393 * Whether the node contains only white-spaces characters. 394 * @param isReject 395 */ 396 CKEDITOR.dom.walker.whitespaces = function( isReject ) 397 { 398 return function( node ) 399 { 400 var isWhitespace = node && ( node.type == CKEDITOR.NODE_TEXT ) 401 && !CKEDITOR.tools.trim( node.getText() ) 402 return isReject ^ isWhitespace; 403 }; 404 } 405 392 406 })();