Ticket #2864: 2864.patch
File 2864.patch, 11.7 KB (added by , 15 years ago) |
---|
-
_source/plugins/selection/plugin.js
110 110 }); 111 111 } 112 112 }); 113 })();114 113 115 /**116 * Gets the current selection from the editing area when in WYSIWYG mode.117 * @returns {CKEDITOR.dom.selection} A selection object or null if not on118 * WYSIWYG mode or no selection is available.119 * @example120 * var selection = CKEDITOR.instances.editor1.<b>getSelection()</b>;121 * alert( selection.getType() );122 */123 CKEDITOR.editor.prototype.getSelection = function()124 {125 var retval = this.document ? this.document.getSelection() : null;114 /** 115 * Gets the current selection from the editing area when in WYSIWYG mode. 116 * @returns {CKEDITOR.dom.selection} A selection object or null if not on 117 * WYSIWYG mode or no selection is available. 118 * @example 119 * var selection = CKEDITOR.instances.editor1.<b>getSelection()</b>; 120 * alert( selection.getType() ); 121 */ 122 CKEDITOR.editor.prototype.getSelection = function() 123 { 124 var retval = this.document ? this.document.getSelection() : null; 126 125 126 /** 127 * IE BUG: The selection's document may be a different document than the 128 * editor document. Return null if that's the case. 129 */ 130 if ( retval && CKEDITOR.env.ie ) 131 { 132 var range = retval.getNative().createRange(); 133 if ( !range ) 134 return null; 135 else if ( range.item ) 136 return range.item(0).ownerDocument == this.document.$ ? retval : null; 137 else 138 return range.parentElement().ownerDocument == this.document.$ ? retval : null; 139 } 140 141 retval.on( 'selectionSet', checkSelectionChangeTimeout, this ); 142 return retval; 143 }; 144 127 145 /** 128 * IE BUG: The selection's document may be a different document than the 129 * editor document. Return null if that's the case. 146 * Gets the current selection from the document. 147 * @returns {CKEDITOR.dom.selection} A selection object. 148 * @example 149 * var selection = CKEDITOR.instances.editor1.document.<b>getSelection()</b>; 150 * alert( selection.getType() ); 130 151 */ 131 if ( retval && CKEDITOR.env.ie)152 CKEDITOR.dom.document.prototype.getSelection = function() 132 153 { 133 var range = retval.getNative().createRange(); 134 if ( !range ) 135 return null; 136 else if ( range.item ) 137 return range.item(0).ownerDocument == this.document.$ ? retval : null; 138 else 139 return range.parentElement().ownerDocument == this.document.$ ? retval : null; 140 } 141 return retval; 142 }; 154 return new CKEDITOR.dom.selection( this ); 155 }; 143 156 144 /** 145 * Gets the current selection from the document. 146 * @returns {CKEDITOR.dom.selection} A selection object. 147 * @example 148 * var selection = CKEDITOR.instances.editor1.document.<b>getSelection()</b>; 149 * alert( selection.getType() ); 150 */ 151 CKEDITOR.dom.document.prototype.getSelection = function() 152 { 153 return new CKEDITOR.dom.selection( this ); 154 }; 157 /** 158 * No selection. 159 * @constant 160 * @example 161 * if ( editor.getSelection().getType() == CKEDITOR.SELECTION_NONE ) 162 * alert( 'Nothing is selected' ); 163 */ 164 CKEDITOR.SELECTION_NONE = 1; 155 165 156 /**157 * Noselection.158 * @constant159 * @example160 * if ( editor.getSelection().getType() == CKEDITOR.SELECTION_NONE)161 * alert( 'Nothingis selected' );162 */163 CKEDITOR.SELECTION_NONE = 1;166 /** 167 * Text or collapsed selection. 168 * @constant 169 * @example 170 * if ( editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT ) 171 * alert( 'Text is selected' ); 172 */ 173 CKEDITOR.SELECTION_TEXT = 2; 164 174 165 /**166 * Text or collapsedselection.167 * @constant168 * @example169 * if ( editor.getSelection().getType() == CKEDITOR.SELECTION_TEXT )170 * alert( 'Text is selected' );171 */172 CKEDITOR.SELECTION_TEXT = 2;175 /** 176 * Element selection. 177 * @constant 178 * @example 179 * if ( editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT ) 180 * alert( 'An element is selected' ); 181 */ 182 CKEDITOR.SELECTION_ELEMENT = 3; 173 183 174 /** 175 * Element selection. 176 * @constant 177 * @example 178 * if ( editor.getSelection().getType() == CKEDITOR.SELECTION_ELEMENT ) 179 * alert( 'An element is selected' ); 180 */ 181 CKEDITOR.SELECTION_ELEMENT = 3; 184 /** 185 * Manipulates the selection in a DOM document. 186 * @constructor 187 * @example 188 */ 189 CKEDITOR.dom.selection = function( document ) 190 { 191 this.document = document; 192 this._ = 193 { 194 cache : {} 195 }; 182 196 183 /** 184 * Manipulates the selection in a DOM document. 185 * @constructor 186 * @example 187 */ 188 CKEDITOR.dom.selection = function( document ) 189 { 190 this.document = document; 191 this._ = 192 { 193 cache : {} 197 CKEDITOR.event.implementOn( this ); 194 198 }; 195 };196 199 197 (function()198 {199 200 var styleObjectElements = { img:1,hr:1,li:1,table:1,tr:1,td:1,embed:1,object:1,ol:1,ul:1 }; 200 201 201 202 CKEDITOR.dom.selection.prototype = … … 578 579 } 579 580 580 581 range.select(); 582 this.fire( 'selectionSet' ); 581 583 } 582 584 : 583 585 function( element ) … … 590 592 var sel = this.getNative(); 591 593 sel.removeAllRanges(); 592 594 sel.addRange( range ); 595 this.fire( 'selectionSet' ); 593 596 }, 594 597 595 598 selectRanges : … … 600 603 // select the first one. 601 604 if ( ranges[ 0 ] ) 602 605 ranges[ 0 ].select(); 606 this.fire( 'selectionSet' ); 603 607 } 604 608 : 605 609 function( ranges ) … … 617 621 // Select the range. 618 622 sel.addRange( nativeRange ); 619 623 } 624 this.fire( 'selectionSet' ); 620 625 }, 621 626 622 627 createBookmarks : function() -
_source/plugins/toolbar/plugin.js
209 209 'Source', '-', 210 210 'NewPage', '-', 211 211 'Bold', 'Italic', 'Underline', 'Strike', '-', 212 'NumberedList', 'BulletedList', '-', 212 213 'Subscript', 'Superscript', '-', 213 214 'SelectAll', 'RemoveFormat', '-', 214 215 'Smiley', 'HorizontalRule', 'SpecialChar', 'PageBreak' -
_source/skins/default/toolbar.css
305 305 { 306 306 background-position: 0 -880px; 307 307 } 308 309 .cke_skin_default a.cke_button_numberedlist .cke_icon 310 { 311 background-position: 0 -400px; 312 } 313 314 .cke_skin_default a.cke_button_bulletedlist .cke_icon 315 { 316 background-position: 0 -416px; 317 } -
_source/core/config.js
146 146 * @example 147 147 * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea'; 148 148 */ 149 plugins : 'basicstyles,button,elementspath,horizontalrule,htmldataprocessor,keystrokes,newpage,pagebreak,removeformat,smiley, sourcearea,specialchar,tab,toolbar,wysiwygarea',149 plugins : 'basicstyles,button,elementspath,horizontalrule,htmldataprocessor,keystrokes,newpage,pagebreak,removeformat,smiley,list,sourcearea,specialchar,tab,toolbar,wysiwygarea', 150 150 151 151 /** 152 152 * The theme to be used to build the UI. -
_source/core/dom/node.js
305 305 return parents; 306 306 }, 307 307 308 getCommonAncestor : function( node ) 309 { 310 if ( node.equals( this ) ) 311 return this; 312 313 if ( node.contains && node.contains( this ) ) 314 return node; 315 316 var start = this.contains ? this : this.getParent(); 317 318 do 319 { 320 if ( start.contains( end ) ) 321 return start; 322 } 323 while ( ( start = start.getParent() ) ); 324 325 return null; 326 }, 327 308 328 getPosition : function( otherNode ) 309 329 { 310 330 var $ = this.$; -
_source/core/dom/domobject.js
165 165 var expandoNumber = this.$._cke_expando, 166 166 dataSlot = expandoNumber && customData[ expandoNumber ]; 167 167 168 return ( dataSlot && dataSlot[ key ] ) || null; 168 if ( dataSlot && dataSlot[ key ] !== undefined ) 169 return dataSlot[ key ]; 170 return null; 169 171 }; 170 172 173 domObjectProto.removeCustomData = function( key ) 174 { 175 var expandoNumber = this.$._cke_expando, 176 dataSlot = expandoNumber && customData[ expandoNumber ], 177 retval = dataSlot[ key ]; 178 179 delete dataSlot[ key ]; 180 return retval || null; 181 }; 182 171 183 // Implement CKEDITOR.event. 172 184 CKEDITOR.event.implementOn( domObjectProto ); 173 185 -
_source/core/dom/element.js
73 73 return temp.getFirst().remove(); 74 74 }; 75 75 76 CKEDITOR.dom.element.setMarker = function( database, element, name, value ) 77 { 78 var id = element.getCustomData( 'list_marker_id' ) || 79 ( element.setCustomData( 'list_marker_id', CKEDITOR.tools.getNextNumber() ).getCustomData( 'list_marker_id' ) ), 80 markerNames = element.getCustomData( 'list_marker_names' ) || 81 ( element.setCustomData( 'list_marker_names', {} ).getCustomData( 'list_marker_names' ) ); 82 database[id] = element; 83 markerNames[name] = 1; 84 85 return element.setCustomData( name, value ); 86 }; 87 88 CKEDITOR.dom.element.clearAllMarkers = function( database ) 89 { 90 for ( var i in database ) 91 CKEDITOR.dom.element.clearMarkers( database, database[i], true ); 92 }; 93 94 CKEDITOR.dom.element.clearMarkers = function( database, element, removeFromDatabase ) 95 { 96 var names = element.getCustomData( 'list_marker_names' ), 97 id = element.getCustomData( 'list_marker_id' ); 98 for ( var i in names ) 99 element.removeCustomData( names[i] ); 100 element.removeCustomData( 'list_marker_names' ); 101 if ( removeFromDatabase ) 102 { 103 element.removeCustomData( 'list_marker_id' ); 104 delete database[id]; 105 } 106 }; 107 76 108 CKEDITOR.tools.extend( CKEDITOR.dom.element.prototype, 77 109 /** @lends CKEDITOR.dom.element.prototype */ 78 110 { -
_source/core/dom/documentFragment.js
26 26 targetElement.$.appendChild( this.$ ); 27 27 }, 28 28 29 moveChildren : elementPrototype.moveChildren, 30 29 31 insertAfterNode : function( node ) 30 32 { 31 33 var $ = this.$; … … 39 41 } 40 42 else 41 43 $parent.insertBefore( $, $node.nextSibling ); 42 } 44 }, 45 46 replace : function( nodeToReplace ) 47 { 48 this.insertAfterNode( nodeToReplace ); 49 nodeToReplace.remove(); 50 }, 51 52 trim : elementPrototype.trim, 53 ltrim : elementPrototype.ltrim, 54 rtrim : elementPrototype.rtrim, 55 getFirst : elementPrototype.getFirst, 56 getLast : elementPrototype.getLast, 57 getDocument : elementPrototype.getDocument, 58 getChildCount : elementPrototype.getChildCount, 59 getChild : elementPrototype.getChild, 60 contains : elementPrototype.contains 43 61 }; 44 62 })(); -
_source/core/tools.js
310 310 return i; 311 311 } 312 312 return -1; 313 }, 314 315 bind : function( func, obj ) 316 { 317 return function() { return func.apply( obj, arguments ); }; 313 318 } 314 319 }; 315 320