Ticket #5479: 5479_10.patch
File 5479_10.patch, 4.7 KB (added by , 13 years ago) |
---|
-
_source/core/dom/element.js
234 234 this.append( new CKEDITOR.dom.text( text ) ); 235 235 }, 236 236 237 appendBogus : function()238 {239 var lastChild = this.getLast() ;240 241 // Ignore empty/spaces text.242 while ( lastChild && lastChild.type == CKEDITOR.NODE_TEXT && !CKEDITOR.tools.rtrim( lastChild.getText() ) )243 lastChild = lastChild.getPrevious();244 if ( !lastChild || !lastChild.is || !lastChild.is( 'br' ) )245 {246 var bogus = CKEDITOR.env.opera ?247 this.getDocument().createText('') :248 this.getDocument().createElement( 'br' );249 250 CKEDITOR.env.gecko && bogus.setAttribute( 'type', '_moz' );251 252 this.append( bogus );253 }254 },255 256 237 /** 257 238 * Retrieve block element's filler node if existed. 258 239 */ -
_source/core/dom/walker.js
449 449 return false; 450 450 }; 451 451 452 // Append a filler node at the end of an element if not exists. 453 CKEDITOR.dom.element.prototype.appendBogus = function() 454 { 455 var lastChild = this.getLast( fillerEvaluator ) ; 456 if ( !lastChild || !lastChild.is || !lastChild.is( 'br' ) ) 457 { 458 var bogus = CKEDITOR.env.opera ? 459 this.getDocument().createText('') : 460 this.getDocument().createElement( 'br' ); 461 462 CKEDITOR.env.gecko && bogus.setAttribute( 'type', '_moz' ); 463 464 this.append( bogus ); 465 } 466 }; 467 468 452 469 })(); -
_source/plugins/wysiwygarea/plugin.js
304 304 return block.getOuterHtml().match( emptyParagraphRegexp ); 305 305 } 306 306 307 isNotWhitespace = CKEDITOR.dom.walker.whitespaces( true );308 309 307 // Gecko need a key event to 'wake up' the editing 310 308 // ability when document is empty.(#3864, #5781) 311 309 function activateEditing( editor ) … … 359 357 360 358 CKEDITOR.env.gecko && activateEditing( editor ); 361 359 360 // Remove the padding body node used in IE. 361 if ( CKEDITOR.env.ie ) 362 { 363 var start = range.collapsed && range.startContainer; 364 if ( start.type == CKEDITOR.NODE_ELEMENT && start.is( 'span') && start.data( 'cke-bogus') ) 365 { 366 range.moveToPosition( start, CKEDITOR.POSITION_BEFORE_START ); 367 start.remove(); 368 range.select(); 369 return; 370 } 371 } 372 362 373 // When enterMode set to block, we'll establing new paragraph only if we're 363 374 // selecting inline contents right under body. (#3657) 364 375 if ( enterMode != CKEDITOR.ENTER_BR … … 396 407 { 397 408 element = fixedBlock.getPrevious( isNotWhitespace ); 398 409 if ( element && 399 element.type == CKEDITOR.NODE_ELEMENT && 400 !nonExitable( element ) ) 410 element.type == CKEDITOR.NODE_ELEMENT ) 401 411 { 402 range.moveToElementEditEnd( element ); 403 fixedBlock.remove(); 404 } 405 } 406 } 412 if ( !nonExitable( element ) ) 413 { 414 range.moveToElementEditEnd( element ); 415 fixedBlock.remove(); 416 } 417 else if ( element.getDirection() ) 418 fixedBlock.setAttribute( 'dir', element.getDirection() ); 419 } 420 } 421 } 407 422 408 423 range.select(); 409 424 // Notify non-IE that selection has changed. … … 423 438 walkerRange.selectNodeContents( body ); 424 439 walker.evaluator = function( node ) 425 440 { 426 return node.type == CKEDITOR.NODE_ELEMENT && ( node.getName() in nonExitableElementNames);441 return node.type == CKEDITOR.NODE_ELEMENT && nonExitable( node ); 427 442 }; 428 443 walker.guard = function( node, isMoveout ) 429 444 { … … 444 459 445 460 if ( !CKEDITOR.env.ie ) 446 461 paddingBlock.appendBogus(); 447 } 448 } 462 else if ( paddingBlock.is( 'body' ) ) 463 { 464 // IE need at least a node to show the cursor, use a zero height br 465 // to fly under the radar, additionally wrap the br element with an extra span , 466 // so selection change event could be easily captured when cursor move inside of it. 467 var paddingNode = CKEDITOR.dom.element.createFromHtml( '<span data-cke-bogus=1>' + 468 '<br data-cke-temp=1 style="line-height:0"/></span>', editor.document ); 469 paddingBlock.append( paddingNode ); 470 } 471 } 472 } 449 473 450 474 CKEDITOR.plugins.add( 'wysiwygarea', 451 475 { … … 1167 1191 } 1168 1192 }); 1169 1193 1170 }1171 });1194 } 1195 }); 1172 1196 1173 1197 // Fixing Firefox 'Back-Forward Cache' break design mode. (#4514) 1174 1198 if ( CKEDITOR.env.gecko )