Ticket #2763: 2763.2.patch
File 2763.2.patch, 12.2 KB (added by , 14 years ago) |
---|
-
_source/plugins/editingblock/plugin.js
### Eclipse Workspace Patch 1.0 #P ckeditor3.0
190 190 modeEditor.load( holderElement, data || this.getData() ); 191 191 192 192 this.mode = mode; 193 this.fire( 'mode' );193 this.fire( 'mode' , mode); 194 194 }; 195 195 196 196 /** -
_source/core/dom/range.js
424 424 return docFrag; 425 425 }, 426 426 427 // This is an "intrusive" way to create a bookmark. It includes <span> tags 428 // in the range boundaries. The advantage of it is that it is possible to 429 // handle DOM mutations when moving back to the bookmark. 430 // Attention: the inclusion of nodes in the DOM is a design choice and 431 // should not be changed as there are other points in the code that may be 432 // using those nodes to perform operations. See GetBookmarkNode. 433 createBookmark : function() 427 /** 428 * This is an "intrusive" way to create a bookmark. It includes <span> 429 * tags in the range boundaries. The advantage of it is that it is 430 * possible to handle DOM mutations when moving back to the bookmark. 431 * Attention: the inclusion of nodes in the DOM is a design choice. 432 * 433 * @param serializeable {Boolean} If set to true will record the bookmark with startNode/endNode IDs for serializing purpose. 434 */ 435 createBookmark : function(serializeable) 434 436 { 435 var startNode , endNode;437 var startNode , endNode; 436 438 var clone; 437 439 438 440 startNode = this.document.createElement( 'span' ); 439 startNode.setAttribute( '_fck_bookmark' , 1 );440 startNode.setStyle( 'display' , 'none' );441 startNode.setAttribute( '_fck_bookmark' , 1 ); 442 startNode.setStyle( 'display' , 'none' ); 441 443 442 444 // For IE, it must have something inside, otherwise it may be 443 445 // removed during DOM operations. … … 451 453 452 454 clone = this.clone(); 453 455 clone.collapse(); 454 clone.insertNode( endNode ); 456 clone.insertNode( endNode ); // CONFUSE: This insert will not influence current selection. 455 457 } 456 458 457 459 clone = this.clone(); 458 460 clone.collapse( true ); 459 clone.insertNode( startNode ); 461 clone.insertNode( startNode ); // CONFUSE: This insert will fade current selection out. 460 462 461 463 // Update the range position. 462 464 if ( endNode ) … … 465 467 this.setEndBefore( endNode ); 466 468 } 467 469 else 468 this.moveToPosition( startNode , CKEDITOR.POSITION_AFTER_END );470 this.moveToPosition( startNode , CKEDITOR.POSITION_AFTER_END ); 469 471 472 if ( serializeable ) 473 { 474 startNode.setAttribute( 'id' , ( new Date() ).valueOf() 475 + Math.floor( Math.random() * 1000 ) + 'S' ); 476 if ( endNode ) 477 endNode.setAttribute( 'id' , ( new Date() ).valueOf() 478 + Math.floor( Math.random() * 1000 ) + 'E' ); 479 } 470 480 return { 471 startNode : startNode, 472 endNode : endNode 481 startNode :serializeable ? startNode.getAttribute( 'id' ) 482 : startNode, 483 endNode :endNode ? ( serializeable ? endNode 484 .getAttribute( 'id' ) : endNode ) : null 473 485 }; 474 486 }, 475 487 488 /** 489 * Move the range boundaries to where the bookmarks indicated. 490 * 491 * @see CKEDITOR.dom.range::createBookmark 492 * @param bookmark 493 * {Object} 494 */ 476 495 moveToBookmark : function( bookmark ) 477 496 { 497 var st = bookmark.startNode , ed = bookmark.endNode; 498 478 499 // Set the range start at the bookmark start node position. 479 this.setStartBefore( bookmark.startNode ); 500 this.setStartBefore( typeof st === 'string' ? ( st = this.document 501 .getById( st ) ) : st ); 480 502 481 503 // Remove it, because it may interfere in the setEndBefore call. 482 bookmark.startNode.remove();504 st.remove(); 483 505 484 506 // Set the range end at the bookmark end node position, or simply 485 507 // collapse it if it is not available. 486 var endNode = bookmark.endNode; 487 if ( endNode ) 508 if ( ed ) 488 509 { 489 this.setEndBefore( endNode ); 490 endNode.remove(); 510 this.setEndBefore( typeof ed === 'string' ? 511 ( ed = this.document.getById( ed ) ) 512 : ed ); 513 ed.remove(); 491 514 } 492 515 else 493 516 this.collapse( true ); -
_source/core/editor.js
361 361 execCommand : function( commandName, data ) 362 362 { 363 363 var command = this.getCommand( commandName ); 364 var cp = 365 /** 366 * Name-command pair to trace commands behavious 367 * 368 * @type FCKEDITOR.command.Pair 369 */ 370 { 371 name :commandName, 372 command :command 373 }; 364 374 if ( command && command.state != CKEDITOR.TRISTATE_DISABLED ) 365 return command.exec( this, data ); 366 375 { 376 this.fire( 'beforeCommandExec' , cp ); 377 command.exec( this , data ); 378 this.fire( 'afterCommandExec' , cp ); 379 } 380 367 381 // throw 'Unknown command name "' + commandName + '"'; 368 382 return false; 369 383 }, 370 384 371 385 /** 372 * Gets one of the registered commands. Note that, after registering a 373 * command definition with addCommand, it is transformed internally374 * into an instance of {@link CKEDITOR.command}, which will be then375 * returned by this function.376 * @param {String} commandName The name of the command to be returned.377 * This is the same used to register the command with addCommand.378 * @returns {CKEDITOR.command} The command object identified by the379 * provided name.386 * Gets one of the registered commands. Note that, after registering a command definition with addCommand, it is 387 * transformed internally into an instance of {@link CKEDITOR.command}, which will be then returned by this 388 * function. 389 * 390 * @param {String} 391 * commandName The name of the command to be returned. This is the same used to register the command 392 * with addCommand. 393 * @returns {CKEDITOR.command} The command object identified by the provided name. 380 394 */ 381 395 getCommand : function( commandName ) 382 396 { -
_source/plugins/selection/plugin.js
630 630 sel.addRange( nativeRange ); 631 631 } 632 632 }, 633 634 createBookmarks : function() 633 /** 634 * This method is a delegate to ceate bookmark for every ranges in this selection. 635 * 636 * @see CKEDITOR.dom.range::createBookmark 637 */ 638 createBookmarks : function ( serializable ) 635 639 { 636 var retval = [], 637 ranges = this.getRanges(); 640 var retval = [] , ranges = this.getRanges(); 638 641 for ( var i = 0 ; i < ranges.length ; i++ ) 639 retval.push( ranges[ i].createBookmark() );642 retval.push( ranges[ i ].createBookmark( serializable ) ); 640 643 return retval; 641 644 }, 642 645 -
_source/core/commanddefinition.js
34 34 * @example 35 35 */ 36 36 37 37 /** 38 38 * Executes the command. 39 39 * @name CKEDITOR.commandDefinition.prototype.exec 40 40 * @function … … 49 49 * } 50 50 * }); 51 51 */ 52 53 /** 54 * Whether the command need to be hooked into the redo/undo system. 55 * @name CKEDITOR.commandDefinition.supportUndoRedo 56 * @type {Boolean} If not defined or 'true' both hook into undo system, set it to 'false' explicitly keep it out. 57 * @field 58 * @example 59 * editorInstance.addCommand( 'sample', 60 * { 61 * CKEDITOR.commandDefinition.supportUndoRedo : false //declare this command does not support undo/redo 62 * }); 63 */ 64 -
_source/tests/core/dom/range.html
1507 1507 assert.areSame( 3, range.endOffset, 'range.endOffset' ); 1508 1508 assert.isFalse( range.collapsed, 'range.collapsed' ); 1509 1509 }, 1510 1511 1512 //Test serializable bookmark create and apply 1513 test_bookmark_single_1 : function ( ) 1514 { 1510 1515 1511 ///////////// 1516 var range = new CKEDITOR.dom.range( doc ); 1517 range.setStartBefore( doc.getById( '_Span' ) ); 1518 range.setEndAfter( doc.getById( '_P' ) ); 1519 bm = range.createBookmark( true ); 1520 range.setStartBefore( doc.getById( '_P2' ) ); 1521 range.setEndAfter( doc.getById( '_P2' ) ); 1522 range.moveToBookmark( bm ); 1512 1523 1513 setUp : function() 1514 { 1515 document.getElementById( 'playground' ).innerHTML = html1; 1516 document.getElementById( 'playground2' ).innerHTML = html2; 1517 }, 1524 assert.areSame( document.getElementById( '_P' ) , 1525 range.startContainer.$ , 'range.startContainer' ); 1526 assert .areSame( 1 , range.startOffset,'range.startOffset' ); 1527 assert.areSame( document.getElementById( 'playground2' ) , 1528 range.endContainer.$ , 'range.endContainer' ); 1529 assert.areSame( 4 , range.endOffset , 'range.endOffset' ); 1530 assert.isNull( document.getElementById( bm.startNode ) , 1531 'bookmark.startNode' ); 1532 assert.isNull( document.getElementById( bm.endNode ) , 1533 'bookmark.endNode' ); 1518 1534 1519 name : document.title 1520 }; 1521 })() ); 1535 }, 1522 1536 1523 //window.onload = function() 1524 //{ 1525 // // Local references. 1526 // var assert = CKEDITOR.test.assert; 1527 // var getInnerHtml = CKEDITOR.test.getInnerHtml; 1537 ///////////// 1528 1538 1529 // var doc = new CKEDITOR.dom.document( document ); 1539 setUp : function ( ) 1540 { 1541 document.getElementById( 'playground' ).innerHTML = html1; 1542 document.getElementById( 'playground2' ).innerHTML = html2; 1543 }, 1530 1544 1531 // doc.getById( '_EnlargeP' ).setHtml( 'this <i>is some </i>sample text' ); 1545 name :document.title 1546 }; 1547 } )() ); 1532 1548 1533 // var range = new CKEDITOR.dom.range( doc ); 1534 // range.setStart( doc.getById( '_EnlargeP' ), 0 ); 1535 // range.setEnd( doc.getById( '_EnlargeP' ).getChild( 1 ), 0 ); 1549 //window.onload = function() 1550 //{ 1551 // // Local references. 1552 // var assert = CKEDITOR.test.assert; 1553 // var getInnerHtml = CKEDITOR.test.getInnerHtml; 1536 1554 1537 // range.enlarge( CKEDITOR.ENLARGE_ELEMENT ); 1538 //} 1555 // var doc = new CKEDITOR.dom.document( document ); 1539 1556 1557 // doc.getById( '_EnlargeP' ).setHtml( 'this <i>is some </i>sample text' ); 1558 1559 // var range = new CKEDITOR.dom.range( doc ); 1560 // range.setStart( doc.getById( '_EnlargeP' ), 0 ); 1561 // range.setEnd( doc.getById( '_EnlargeP' ).getChild( 1 ), 0 ); 1562 1563 // range.enlarge( CKEDITOR.ENLARGE_ELEMENT ); 1564 //} 1565 1540 1566 //]]> 1541 1567 </script> 1542 1568 </head> 1543 1569 <body> 1544 1570 <div id="playground" style="visibility:hidden"><h1 id="_H1">FCKW3CRange Test</h1><p id="_Para">This is <b id="_B">some</b> text.</p><p>Another paragraph.</p></div> -
_source/core/config.js
1 /*1 /* 2 2 * CKEditor - The text editor for Internet - http://ckeditor.com 3 3 * Copyright (C) 2003-2008 Frederico Caldeira Knabben 4 4 * … … 161 161 * @example 162 162 * config.plugins = 'elementspath,toolbar,wysiwygarea'; 163 163 */ 164 plugins : 'basicstyles,button,dialog,elementspath,horizontalrule,htmldataprocessor,keystrokes,removeformat,smiley,link,sourcearea,tab,toolbar,wysiwygarea,forms,image,find,table,specialchar,flash,print,pagebreak, newpage',164 plugins : 'basicstyles,button,dialog,elementspath,horizontalrule,htmldataprocessor,keystrokes,removeformat,smiley,link,sourcearea,tab,toolbar,wysiwygarea,forms,image,find,table,specialchar,flash,print,pagebreak,undoredo,newpage', 165 165 166 166 /** 167 167 * The theme to be used to build the UI. … … 350 350 descriptions : [ ':)', ':(', ';)', ':D', ':/', ':P', 351 351 '', '', '', '', '', '', 352 352 '', ';(', '', '', '', '', 353 ':kiss', '' ,],353 ':kiss', '' ], 354 354 355 355 //TODO: update path 356 356 path : CKEDITOR.basePath + '_source/plugins/smiley/images/',