Ticket #2971: 2971_2.patch
File 2971_2.patch, 41.1 KB (added by , 15 years ago) |
---|
-
_source/core/config.js
147 147 * config.plugins = 'basicstyles,button,htmldataprocessor,toolbar,wysiwygarea'; 148 148 */ 149 149 150 plugins : 'basicstyles,blockquote,button,clipboard,elementspath,find, horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,smiley,sourcearea,table,specialchar,tab,templates,toolbar,undo,wysiwygarea',150 plugins : 'basicstyles,blockquote,button,clipboard,elementspath,find,format,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,newpage,pagebreak,pastefromword,pastetext,preview,print,removeformat,smiley,sourcearea,table,specialchar,tab,templates,toolbar,undo,wysiwygarea', 151 151 152 152 /** 153 153 * The theme to be used to build the UI. -
_source/core/dom/domobject.js
147 147 */ 148 148 domObjectProto.setCustomData = function( key, value ) 149 149 { 150 var expandoNumber = this. $._cke_expando || ( this.$._cke_expando = CKEDITOR.tools.getNextNumber()),150 var expandoNumber = this.getUniqueId(), 151 151 dataSlot = customData[ expandoNumber ] || ( customData[ expandoNumber ] = {} ); 152 152 153 153 dataSlot[ key ] = value; … … 186 186 return retval || null; 187 187 }; 188 188 189 domObjectProto.getUniqueId = function() 190 { 191 return this.$._cke_expando || ( this.$._cke_expando = CKEDITOR.tools.getNextNumber() ); 192 }; 193 189 194 // Implement CKEDITOR.event. 190 195 CKEDITOR.event.implementOn( domObjectProto ); 191 196 -
_source/core/dom/element.js
167 167 } 168 168 }, 169 169 170 hasClass : function( className ) 171 { 172 var regex = new RegExp( '(?:^|\\s+)' + className + '(?=\\s|$)', '' ); 173 return regex.test( this.$.className ); 174 }, 175 170 176 /** 171 177 * Append a node as a child of this element. 172 178 * @param {CKEDITOR.dom.node|String} node The node or element name to be … … 197 203 return node; 198 204 }, 199 205 206 appendHtml : function( html ) 207 { 208 var temp = new CKEDITOR.dom.element( 'div', this.getDocument() ); 209 temp.setHtml( html ); 210 temp.moveChildren( this ); 211 }, 212 200 213 /** 201 214 * Append text to this element. 202 215 * @param {String} text The text to be appended. -
_source/core/editor.js
78 78 if ( instanceConfig ) 79 79 CKEDITOR.tools.extend( editor.config, instanceConfig, true ); 80 80 81 // Fire the "configLoaded" event. 82 editor.fireOnce( 'configLoaded' ); 83 84 loadLang( editor ); 81 onConfigLoaded( editor ); 85 82 }); 86 83 87 84 // The instance config may override the customConfig setting to avoid … … 96 93 97 94 // ##### END: Config Privates 98 95 96 var onConfigLoaded = function( editor ) 97 { 98 // Set config related properties. 99 100 editor.skinPath = CKEDITOR.getUrl( 101 '_source/' + // %REMOVE_LINE% 102 'skins/' + editor.config.skin + '/' ); 103 104 // Fire the "configLoaded" event. 105 editor.fireOnce( 'configLoaded' ); 106 107 // Load language file. 108 loadLang( editor ); 109 }; 110 99 111 var loadLang = function( editor ) 100 112 { 101 113 CKEDITOR.lang.load( editor.config.defaultLanguage, editor.config.autoLanguage, function( languageCode, lang ) -
_source/core/plugins.js
48 48 49 49 if ( requiredPlugins.length ) 50 50 loadPlugins.call( this, requiredPlugins ); 51 else if ( callback ) 52 callback.call( scope || window, allPlugins ); 51 else 52 { 53 // Call the "onLoad" function for all plugins. 54 for ( pluginName in allPlugins ) 55 { 56 plugin = allPlugins[ pluginName ]; 57 if ( plugin.onLoad && !plugin.onLoad._called ) 58 { 59 plugin.onLoad(); 60 plugin.onLoad._called = 1; 61 } 62 } 63 64 // Call the callback. 65 if ( callback ) 66 callback.call( scope || window, allPlugins ); 67 } 53 68 } 54 69 , this); 55 70 -
_source/core/tools.js
8 8 * utility functions. 9 9 */ 10 10 11 /** 12 * Utility functions. 13 * @namespace 14 * @example 15 */ 16 CKEDITOR.tools = 11 (function() 17 12 { 18 arrayCompare : function( arrayA, arrayB ) 19 { 20 if ( !arrayA && !arrayB ) 21 return true; 13 var functions = []; 22 14 23 if ( !arrayA || !arrayB || arrayA.length != arrayB.length )24 return false;25 26 for ( var i = 0 ; i < arrayA.length ; i++ )27 {28 if ( arrayA[ i ] != arrayB[ i ] )29 return false;30 }31 32 return true;33 },34 35 15 /** 36 * Copy the properties from one object to another. By default, properties 37 * already present in the target object <strong>are not</strong> overwritten. 38 * @param {Object} target The object to be extended. 39 * @param {Object} source[,souce(n)] The objects from which copy 40 * properties. Any number of objects can be passed to this function. 41 * @param {Boolean} [overwrite] Indicates that properties already present 42 * in the target object must be overwritten. This must be the last 43 * parameter in the function call. 44 * @returns {Object} the extended object (target). 16 * Utility functions. 17 * @namespace 45 18 * @example 46 * // Create the sample object.47 * var myObject =48 * {49 * prop1 : true50 * };51 *52 * // Extend the above object with two properties.53 * CKEDITOR.tools.extend( myObject,54 * {55 * prop2 : true,56 * prop3 : true57 * } );58 *59 * // Alert "prop1", "prop2" and "prop3".60 * for ( var p in myObject )61 * alert( p );62 19 */ 63 extend : function( target )20 CKEDITOR.tools = 64 21 { 65 var argsLength = arguments.length, 66 overwrite = arguments[ argsLength - 1 ]; 22 arrayCompare : function( arrayA, arrayB ) 23 { 24 if ( !arrayA && !arrayB ) 25 return true; 67 26 68 if ( typeof overwrite == 'boolean' ) 69 argsLength--; 70 else 71 overwrite = false; 27 if ( !arrayA || !arrayB || arrayA.length != arrayB.length ) 28 return false; 72 29 73 for ( var i = 1 ; i < argsLength ; i++ ) 30 for ( var i = 0 ; i < arrayA.length ; i++ ) 31 { 32 if ( arrayA[ i ] != arrayB[ i ] ) 33 return false; 34 } 35 36 return true; 37 }, 38 39 /** 40 * Copy the properties from one object to another. By default, properties 41 * already present in the target object <strong>are not</strong> overwritten. 42 * @param {Object} target The object to be extended. 43 * @param {Object} source[,souce(n)] The objects from which copy 44 * properties. Any number of objects can be passed to this function. 45 * @param {Boolean} [overwrite] Indicates that properties already present 46 * in the target object must be overwritten. This must be the last 47 * parameter in the function call. 48 * @returns {Object} the extended object (target). 49 * @example 50 * // Create the sample object. 51 * var myObject = 52 * { 53 * prop1 : true 54 * }; 55 * 56 * // Extend the above object with two properties. 57 * CKEDITOR.tools.extend( myObject, 58 * { 59 * prop2 : true, 60 * prop3 : true 61 * } ); 62 * 63 * // Alert "prop1", "prop2" and "prop3". 64 * for ( var p in myObject ) 65 * alert( p ); 66 */ 67 extend : function( target ) 74 68 { 75 var source = arguments[ i ]; 69 var argsLength = arguments.length, 70 overwrite = arguments[ argsLength - 1 ]; 76 71 77 for ( var propertyName in source ) 72 if ( typeof overwrite == 'boolean' ) 73 argsLength--; 74 else 75 overwrite = false; 76 77 for ( var i = 1 ; i < argsLength ; i++ ) 78 78 { 79 if ( overwrite || target[ propertyName ] == undefined ) 80 target[ propertyName ] = source[ propertyName ]; 79 var source = arguments[ i ]; 80 81 for ( var propertyName in source ) 82 { 83 if ( overwrite || target[ propertyName ] == undefined ) 84 target[ propertyName ] = source[ propertyName ]; 85 } 81 86 } 82 }83 87 84 return target;85 },88 return target; 89 }, 86 90 87 /**88 * Creates an object which is an instance of a class which prototype is a89 * predefined object. All properties defined in the source object are90 * automatically inherited by the resulting object, including future91 * changes to it.92 * @param {Object} source The source object to be used as the prototype for93 * the final object.94 * @returns {Object} The resulting copy.95 */96 prototypedCopy : function( source )97 {98 var copy = function()99 {};100 copy.prototype = source;101 return new copy();102 },91 /** 92 * Creates an object which is an instance of a class which prototype is a 93 * predefined object. All properties defined in the source object are 94 * automatically inherited by the resulting object, including future 95 * changes to it. 96 * @param {Object} source The source object to be used as the prototype for 97 * the final object. 98 * @returns {Object} The resulting copy. 99 */ 100 prototypedCopy : function( source ) 101 { 102 var copy = function() 103 {}; 104 copy.prototype = source; 105 return new copy(); 106 }, 103 107 104 /**105 * Checks if an object is an Array.106 * @param {Object} object The object to be checked.107 * @type Boolean108 * @returns <i>true</i> if the object is an Array, otherwise <i>false</i>.109 * @example110 * alert( CKEDITOR.tools.isArray( [] ) ); // "true"111 * alert( CKEDITOR.tools.isArray( 'Test' ) ); // "false"112 */113 isArray : function( object )114 {115 return ( !!object && object instanceof Array );116 },108 /** 109 * Checks if an object is an Array. 110 * @param {Object} object The object to be checked. 111 * @type Boolean 112 * @returns <i>true</i> if the object is an Array, otherwise <i>false</i>. 113 * @example 114 * alert( CKEDITOR.tools.isArray( [] ) ); // "true" 115 * alert( CKEDITOR.tools.isArray( 'Test' ) ); // "false" 116 */ 117 isArray : function( object ) 118 { 119 return ( !!object && object instanceof Array ); 120 }, 117 121 118 /** 119 * Transforms a CSS property name to its relative DOM style name. 120 * @param {String} cssName The CSS property name. 121 * @returns {String} The transformed name. 122 * @example 123 * alert( CKEDITOR.tools.cssStyleToDomStyle( 'background-color' ) ); // "backgroundColor" 124 * alert( CKEDITOR.tools.cssStyleToDomStyle( 'float' ) ); // "cssFloat" 125 */ 126 cssStyleToDomStyle : function( cssName ) 127 { 128 if ( cssName == 'float' ) 129 return 'cssFloat'; 130 else 122 /** 123 * Transforms a CSS property name to its relative DOM style name. 124 * @param {String} cssName The CSS property name. 125 * @returns {String} The transformed name. 126 * @example 127 * alert( CKEDITOR.tools.cssStyleToDomStyle( 'background-color' ) ); // "backgroundColor" 128 * alert( CKEDITOR.tools.cssStyleToDomStyle( 'float' ) ); // "cssFloat" 129 */ 130 cssStyleToDomStyle : function( cssName ) 131 131 { 132 return cssName.replace( /-./g, function( match ) 132 if ( cssName == 'float' ) 133 return 'cssFloat'; 134 else 135 { 136 return cssName.replace( /-./g, function( match ) 137 { 138 return match.substr( 1 ).toUpperCase(); 139 }); 140 } 141 }, 142 143 /** 144 * Replace special HTML characters in a string with their relative HTML 145 * entity values. 146 * @param {String} text The string to be encoded. 147 * @returns {String} The encode string. 148 * @example 149 * alert( CKEDITOR.tools.htmlEncode( 'A > B & C < D' ) ); // "A &gt; B &amp; C &lt; D" 150 */ 151 htmlEncode : function( text ) 152 { 153 var standard = function( text ) 154 { 155 var span = new CKEDITOR.dom.element( 'span' ); 156 span.setText( text ); 157 return span.getHtml(); 158 }; 159 160 this.htmlEncode = ( standard( '>' ) == '>' ) ? 161 function( text ) 133 162 { 134 return match.substr( 1 ).toUpperCase(); 135 }); 136 } 137 }, 163 // WebKit does't encode the ">" character, which makes sense, but 164 // it's different than other browsers. 165 return standard( text ).replace( />/g, '>' ); 166 } : 167 standard; 138 168 139 /** 140 * Replace special HTML characters in a string with their relative HTML 141 * entity values. 142 * @param {String} text The string to be encoded. 143 * @returns {String} The encode string. 144 * @example 145 * alert( CKEDITOR.tools.htmlEncode( 'A > B & C < D' ) ); // "A &gt; B &amp; C &lt; D" 146 */ 147 htmlEncode : function( text ) 148 { 149 var standard = function( text ) 169 return this.htmlEncode( text ); 170 }, 171 172 /** 173 * Gets a unique number for this CKEDITOR execution session. It returns 174 * progressive numbers starting at 1. 175 * @function 176 * @returns {Number} A unique number. 177 * @example 178 * alert( CKEDITOR.tools.<b>getNextNumber()</b> ); // "1" (e.g.) 179 * alert( CKEDITOR.tools.<b>getNextNumber()</b> ); // "2" 180 */ 181 getNextNumber : (function() 150 182 { 151 var span = new CKEDITOR.dom.element( 'span' ); 152 span.setText( text ); 153 return span.getHtml(); 154 }; 155 156 this.htmlEncode = ( standard( '>' ) == '>' ) ? 157 function( text ) 183 var last = 0; 184 return function() 158 185 { 159 // WebKit does't encode the ">" character, which makes sense, but 160 // it's different than other browsers. 161 return standard( text ).replace( />/g, '>' ); 162 } : 163 standard; 186 return ++last; 187 }; 188 })(), 164 189 165 return this.htmlEncode( text ); 166 }, 190 /** 191 * Creates a function override. 192 * @param {Function} originalFunction The function to be overridden. 193 * @param {Function} functionBuilder A function that returns the new 194 * function. The original function reference will be passed to this 195 * function. 196 * @returns {Function} The new function. 197 * @example 198 * var example = 199 * { 200 * myFunction : function( name ) 201 * { 202 * alert( 'Name: ' + name ); 203 * } 204 * }; 205 * 206 * example.myFunction = CKEDITOR.tools.override( example.myFunction, function( myFunctionOriginal ) 207 * { 208 * return function( name ) 209 * { 210 * alert( 'Override Name: ' + name ); 211 * myFunctionOriginal.call( this, name ); 212 * }; 213 * }); 214 */ 215 override : function( originalFunction, functionBuilder ) 216 { 217 return functionBuilder( originalFunction ); 218 }, 167 219 168 /** 169 * Gets a unique number for this CKEDITOR execution session. It returns 170 * progressive numbers starting at 1. 171 * @function 172 * @returns {Number} A unique number. 173 * @example 174 * alert( CKEDITOR.tools.<b>getNextNumber()</b> ); // "1" (e.g.) 175 * alert( CKEDITOR.tools.<b>getNextNumber()</b> ); // "2" 176 */ 177 getNextNumber : (function() 178 { 179 var last = 0; 180 return function() 220 /** 221 * Executes a function after specified delay. 222 * @param {Function} func The function to be executed. 223 * @param {Number} [milliseconds] The amount of time (millisecods) to wait 224 * to fire the function execution. Defaults to zero. 225 * @param {Object} [scope] The object to hold the function execution scope 226 * (the "this" object). By default the "window" object. 227 * @param {Object|Array} [args] A single object, or an array of objects, to 228 * pass as arguments to the function. 229 * @param {Object} [ownerWindow] The window that will be used to set the 230 * timeout. By default the current "window". 231 * @returns {Object} A value that can be used to cancel the function execution. 232 * @example 233 * CKEDITOR.tools.<b>setTimeout( 234 * function() 235 * { 236 * alert( 'Executed after 2 seconds' ); 237 * }, 238 * 2000 )</b>; 239 */ 240 setTimeout : function( func, milliseconds, scope, args, ownerWindow ) 181 241 { 182 return ++last; 183 }; 184 })(), 242 if ( !ownerWindow ) 243 ownerWindow = window; 185 244 186 /** 187 * Creates a function override. 188 * @param {Function} originalFunction The function to be overridden. 189 * @param {Function} functionBuilder A function that returns the new 190 * function. The original function reference will be passed to this 191 * function. 192 * @returns {Function} The new function. 193 * @example 194 * var example = 195 * { 196 * myFunction : function( name ) 197 * { 198 * alert( 'Name: ' + name ); 199 * } 200 * }; 201 * 202 * example.myFunction = CKEDITOR.tools.override( example.myFunction, function( myFunctionOriginal ) 203 * { 204 * return function( name ) 205 * { 206 * alert( 'Override Name: ' + name ); 207 * myFunctionOriginal.call( this, name ); 208 * }; 209 * }); 210 */ 211 override : function( originalFunction, functionBuilder ) 212 { 213 return functionBuilder( originalFunction ); 214 }, 245 if ( !scope ) 246 scope = ownerWindow; 215 247 216 /** 217 * Executes a function after specified delay. 218 * @param {Function} func The function to be executed. 219 * @param {Number} [milliseconds] The amount of time (millisecods) to wait 220 * to fire the function execution. Defaults to zero. 221 * @param {Object} [scope] The object to hold the function execution scope 222 * (the "this" object). By default the "window" object. 223 * @param {Object|Array} [args] A single object, or an array of objects, to 224 * pass as arguments to the function. 225 * @param {Object} [ownerWindow] The window that will be used to set the 226 * timeout. By default the current "window". 227 * @returns {Object} A value that can be used to cancel the function execution. 228 * @example 229 * CKEDITOR.tools.<b>setTimeout( 230 * function() 231 * { 232 * alert( 'Executed after 2 seconds' ); 233 * }, 234 * 2000 )</b>; 235 */ 236 setTimeout : function( func, milliseconds, scope, args, ownerWindow ) 237 { 238 if ( !ownerWindow ) 239 ownerWindow = window; 248 return ownerWindow.setTimeout( 249 function() 250 { 251 if ( args ) 252 func.apply( scope, [].concat( args ) ) ; 253 else 254 func.apply( scope ) ; 255 }, 256 milliseconds || 0 ); 257 }, 240 258 241 if ( !scope ) 242 scope = ownerWindow; 259 /** 260 * Remove spaces from the start and the end of a string. The following 261 * characters are removed: space, tab, line break, line feed. 262 * @function 263 * @param {String} str The text from which remove the spaces. 264 * @returns {String} The modified string without the boundary spaces. 265 * @example 266 * alert( CKEDITOR.tools.trim( ' example ' ); // "example" 267 */ 268 trim : (function() 269 { 270 // We are not using \s because we don't want "non-breaking spaces" to be caught. 271 var trimRegex = /(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g; 272 return function( str ) 273 { 274 return str.replace( trimRegex, '' ) ; 275 }; 276 })(), 243 277 244 return ownerWindow.setTimeout( 245 function() 278 /** 279 * Remove spaces from the start (left) of a string. The following 280 * characters are removed: space, tab, line break, line feed. 281 * @function 282 * @param {String} str The text from which remove the spaces. 283 * @returns {String} The modified string excluding the removed spaces. 284 * @example 285 * alert( CKEDITOR.tools.ltrim( ' example ' ); // "example " 286 */ 287 ltrim : (function() 288 { 289 // We are not using \s because we don't want "non-breaking spaces" to be caught. 290 var trimRegex = /^[ \t\n\r]+/g; 291 return function( str ) 246 292 { 247 if ( args ) 248 func.apply( scope, [].concat( args ) ) ; 249 else 250 func.apply( scope ) ; 251 }, 252 milliseconds || 0 ); 253 }, 293 return str.replace( trimRegex, '' ) ; 294 }; 295 })(), 254 296 255 /** 256 * Remove spaces from the start and the end of a string. The following 257 * characters are removed: space, tab, line break, line feed. 258 * @function 259 * @param {String} str The text from which remove the spaces. 260 * @returns {String} The modified string without the boundary spaces. 261 * @example 262 * alert( CKEDITOR.tools.trim( ' example ' ); // "example" 263 */ 264 trim : (function() 265 { 266 // We are not using \s because we don't want "non-breaking spaces" to be caught. 267 var trimRegex = /(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g; 268 return function( str ) 297 /** 298 * Remove spaces from the end (right) of a string. The following 299 * characters are removed: space, tab, line break, line feed. 300 * @function 301 * @param {String} str The text from which remove the spaces. 302 * @returns {String} The modified string excluding the removed spaces. 303 * @example 304 * alert( CKEDITOR.tools.ltrim( ' example ' ); // " example" 305 */ 306 rtrim : (function() 269 307 { 270 return str.replace( trimRegex, '' ) ; 271 }; 272 })(), 308 // We are not using \s because we don't want "non-breaking spaces" to be caught. 309 var trimRegex = /[ \t\n\r]+$/g; 310 return function( str ) 311 { 312 return str.replace( trimRegex, '' ) ; 313 }; 314 })(), 273 315 274 /** 275 * Remove spaces from the start (left) of a string. The following 276 * characters are removed: space, tab, line break, line feed. 277 * @function 278 * @param {String} str The text from which remove the spaces. 279 * @returns {String} The modified string excluding the removed spaces. 280 * @example 281 * alert( CKEDITOR.tools.ltrim( ' example ' ); // "example " 282 */ 283 ltrim : (function() 284 { 285 // We are not using \s because we don't want "non-breaking spaces" to be caught. 286 var trimRegex = /^[ \t\n\r]+/g; 287 return function( str ) 316 /** 317 * Returns the index of an element in an array. 318 * @param {Array} array The array to be searched. 319 * @param {Object} entry The element to be found. 320 * @returns {Number} The (zero based) index of the first entry that matches 321 * the entry, or -1 if not found. 322 * @example 323 * var letters = [ 'a', 'b', 0, 'c', false ]; 324 * alert( CKEDITOR.tools.indexOf( letters, '0' ) ); "-1" because 0 !== '0' 325 * alert( CKEDITOR.tools.indexOf( letters, false ) ); "4" because 0 !== false 326 */ 327 indexOf : 328 // #2514: We should try to use Array.indexOf if it does exist. 329 ( Array.prototype.indexOf ) ? 330 function( array, entry ) 331 { 332 return array.indexOf( entry ); 333 } 334 : 335 function( array, entry ) 336 { 337 for ( var i = 0, len = array.length ; i < len ; i++ ) 338 { 339 if ( array[ i ] === entry ) 340 return i; 341 } 342 return -1; 343 }, 344 345 bind : function( func, obj ) 288 346 { 289 return str.replace( trimRegex, '' ) ; 290 }; 291 })(), 347 return function() { return func.apply( obj, arguments ); }; 348 }, 292 349 293 /** 294 * Remove spaces from the end (right) of a string. The following 295 * characters are removed: space, tab, line break, line feed. 296 * @function 297 * @param {String} str The text from which remove the spaces. 298 * @returns {String} The modified string excluding the removed spaces. 299 * @example 300 * alert( CKEDITOR.tools.ltrim( ' example ' ); // " example" 301 */ 302 rtrim : (function() 303 { 304 // We are not using \s because we don't want "non-breaking spaces" to be caught. 305 var trimRegex = /[ \t\n\r]+$/g; 306 return function( str ) 350 createClass : function( definition ) 307 351 { 308 return str.replace( trimRegex, '' ) ; 309 }; 310 })(), 352 var $ = definition.$, 353 baseClass = definition.base, 354 privates = definition.privates || definition._, 355 proto = definition.proto, 356 statics = definition.statics; 311 357 312 /** 313 * Returns the index of an element in an array. 314 * @param {Array} array The array to be searched. 315 * @param {Object} entry The element to be found. 316 * @returns {Number} The (zero based) index of the first entry that matches 317 * the entry, or -1 if not found. 318 * @example 319 * var letters = [ 'a', 'b', 0, 'c', false ]; 320 * alert( CKEDITOR.tools.indexOf( letters, '0' ) ); "-1" because 0 !== '0' 321 * alert( CKEDITOR.tools.indexOf( letters, false ) ); "4" because 0 !== false 322 */ 323 indexOf : 324 // #2514: We should try to use Array.indexOf if it does exist. 325 ( Array.prototype.indexOf ) ? 326 function( array, entry ) 358 if ( privates ) 359 { 360 var originalConstructor = $; 361 $ = function() 327 362 { 328 return array.indexOf( entry ); 329 } 330 : 331 function( array, entry ) 363 originalConstructor.apply( this, arguments ); 364 365 // Create (and get) the private namespace. 366 var _ = this._ || ( this._ = {} ); 367 368 // Make some magic so "this" will refer to the main 369 // instance when coding private functions. 370 for ( var privateName in privates ) 371 { 372 var priv = privates[ privateName ]; 373 374 _[ privateName ] = 375 ( typeof priv == 'function' ) ? CKEDITOR.tools.bind( priv, this ) : priv; 376 } 377 }; 378 } 379 380 if ( baseClass ) 332 381 { 333 for ( var i = 0, len = array.length ; i < len ; i++ ) 382 $.prototype = this.prototypedCopy( baseClass.prototype ); 383 384 $.prototype.base = function() 334 385 { 335 if ( array[ i ] === entry )336 return i;337 }338 return -1;339 } ,386 this.base = baseClass.prototype.base; 387 baseClass.apply( this, arguments ); 388 this.base = arguments.callee; 389 }; 390 } 340 391 341 bind : function( func, obj ) 342 { 343 return function() { return func.apply( obj, arguments ); }; 344 } 345 }; 392 if ( proto ) 393 this.extend( $.prototype, proto, true ); 346 394 395 if ( statics ) 396 this.extend( $, statics, true ); 397 398 return $; 399 }, 400 401 addFunction : function( fn, scope ) 402 { 403 return functions.push( function() 404 { 405 fn.apply( scope || this, arguments ); 406 }) - 1; 407 }, 408 409 callFunction : function( index ) 410 { 411 var fn = functions[ index ]; 412 return fn.apply( window, Array.prototype.slice.call( arguments, 1 ) ); 413 } 414 }; 415 })(); 416 347 417 // PACKAGER_RENAME( CKEDITOR.tools ) -
_source/core/ui.js
48 48 */ 49 49 add : function( name, type, definition ) 50 50 { 51 var item = this._.handlers[ type ].create( definition ); 52 item.name = name; 53 this._.items[ name ] = item; 51 this._.items[ name ] = 52 { 53 type : type, 54 args : Array.prototype.slice.call( arguments, 2 ) 55 }; 54 56 }, 55 57 56 58 /** … … 58 60 * @param {String} name The UI item hame. 59 61 * @example 60 62 */ 61 get: function( name )63 create : function( name ) 62 64 { 63 return this._.items[ name ] || null; 65 var item = this._.items[ name ], 66 handler = item && this._.handlers[ item.type ]; 67 68 return handler && handler.create.apply( this, item.args ); 64 69 }, 65 70 66 71 /** -
_source/lang/en.js
429 429 insertOption: 'Replace actual contents', 430 430 selectPromptMsg: 'Please select the template to open in the editor', 431 431 emptyListMsg : '(No templates defined)' 432 }, 433 434 format : 435 { 436 label : 'Format', 437 panelTitle : 'Paragraph Format', 438 439 tag_p : 'Normal', 440 tag_pre : 'Formatted', 441 tag_address : 'Address', 442 tag_h1 : 'Heading 1', 443 tag_h2 : 'Heading 2', 444 tag_h3 : 'Heading 3', 445 tag_h4 : 'Heading 4', 446 tag_h5 : 'Heading 5', 447 tag_h6 : 'Heading 6', 448 tag_div : 'Normal (DIV)' 432 449 } 433 450 }; -
_source/plugins/styles/plugin.js
177 177 checkElementRemovable : function( element, fullMatch ) 178 178 { 179 179 if ( !element || element.getName() != this.element ) 180 return false 180 return false; 181 181 182 182 var def = this._.definition; 183 183 var attribs = def.attributes; … … 185 185 186 186 // If no attributes are defined in the element. 187 187 if ( !fullMatch && !element.hasAttributes() ) 188 return true 188 return true; 189 189 190 190 for ( var attName in attribs ) 191 191 { … … 525 525 526 526 var applyBlockStyle = function( range ) 527 527 { 528 // Bookmark the range so we can re-select it after processing. 529 var bookmark = range.createBookmark(); 530 531 var iterator = range.createIterator(); 532 iterator.enforceRealBlocks = true; 533 534 var block; 535 var doc = range.document; 536 var previousPreBlock; 537 538 while( ( block = iterator.getNextParagraph() ) ) // Only one = 539 { 540 // Create the new node right before the current one. 541 var newBlock = getElement( this, doc ); 542 543 // Check if we are changing from/to <pre>. 544 // var newBlockIsPre = newBlock.nodeName.IEquals( 'pre' ); 545 // var blockIsPre = block.nodeName.IEquals( 'pre' ); 546 547 // var toPre = newBlockIsPre && !blockIsPre; 548 // var fromPre = !newBlockIsPre && blockIsPre; 549 550 // Move everything from the current node to the new one. 551 // if ( toPre ) 552 // newBlock = this._ToPre( doc, block, newBlock ); 553 // else if ( fromPre ) 554 // newBlock = this._FromPre( doc, block, newBlock ); 555 // else // Convering from a regular block to another regular block. 556 block.moveChildren( newBlock ); 557 558 // Replace the current block. 559 newBlock.insertBefore( block ); 560 block.remove(); 561 562 // Complete other tasks after inserting the node in the DOM. 563 // if ( newBlockIsPre ) 564 // { 565 // if ( previousPreBlock ) 566 // this._CheckAndMergePre( previousPreBlock, newBlock ) ; // Merge successive <pre> blocks. 567 // previousPreBlock = newBlock; 568 // } 569 // else if ( fromPre ) 570 // this._CheckAndSplitPre( newBlock ) ; // Split <br><br> in successive <pre>s. 571 } 572 573 range.moveToBookmark( bookmark ); 528 574 }; 529 575 530 576 // Removes a style from an element itself, don't care about its subtree. -
_source/plugins/toolbar/plugin.js
134 134 if ( itemName == '-' ) 135 135 item = CKEDITOR.ui.separator; 136 136 else 137 item = editor.ui. get( itemName );137 item = editor.ui.create( itemName ); 138 138 139 139 if ( item ) 140 140 { … … 219 219 'SelectAll', 'RemoveFormat', '-', 220 220 'Link', 'Unlink', 'Anchor', '-', 221 221 'Image', '-', 222 'Table', 'Smiley', 'HorizontalRule', 'SpecialChar', 'PageBreak' 222 'Table', 'Smiley', 'HorizontalRule', 'SpecialChar', 'PageBreak', '-', 223 'Format' 223 224 ] 224 225 ]; -
_source/skins/default/editor.css
6 6 @import url("reset.css"); 7 7 @import url("mainui.css"); 8 8 @import url("toolbar.css"); 9 @import url("panel.css"); 10 @import url("richcombo.css"); 9 11 @import url("elementspath.css"); 10 12 11 13 /* Restore the container visibility */ -
_source/skins/default/panel.css
1 /* 2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. 3 For licensing, see LICENSE.html or http://ckeditor.com/license 4 */ 5 6 .cke_skin_default.cke_panel 7 { 8 border: 1px solid #316ac5; 9 background-color: #fff; 10 11 width: 120px; 12 height: 100px; 13 14 overflow:hidden; 15 16 -moz-border-radius-bottomright: 3px; 17 -webkit-border-bottom-right-radius: 3px; 18 border-bottom-left-radius: 3px; 19 -moz-border-radius-bottomleft: 3px; 20 -webkit-border-bottom-left-radius: 3px; 21 border-bottom-left-radius: 3px; 22 -moz-border-radius-topright: 3px; 23 -webkit-border-top-right-radius: 3px; 24 border-top-right-radius: 3px; 25 } 26 27 .cke_skin_default.cke_panel.cke_format 28 { 29 width: 150px; 30 height: 170px; 31 } 32 33 /* Ideally we would use "inherit here"... but you know... IE :( */ 34 .cke_skin_default.cke_panel iframe 35 { 36 width: 100%; 37 height: 100%; 38 } 39 40 /* 41 * All the following styles are to be used inside the iframe that holds panel 42 * contents. We don't use the cke_skin_default there to avoid the reset to be 43 * active. 44 * This is not an issue as we'll never have two skins running inside the same 45 * panel iframe. 46 */ 47 48 body.cke_panel_frame 49 { 50 overflow: auto; 51 overflow-x: hidden; 52 } 53 54 ul.cke_panel_list 55 { 56 list-style-type: none; 57 margin: 3px; 58 padding: 0px; 59 white-space: nowrap; 60 } 61 62 li.cke_panel_listItem 63 { 64 margin: 0px; 65 } 66 67 .cke_panel_listItem a 68 { 69 padding: 2px; 70 display: block; 71 border: 1px solid #fff; 72 color: inherit; 73 text-decoration: none; 74 overflow: hidden; 75 text-overflow: ellipsis; 76 } 77 78 /* IE6 */ 79 * html .cke_panel_listItem a 80 { 81 width : 100%; 82 83 /* IE is not able to inherit the color, so we must force it to black */ 84 color: #000; 85 } 86 87 /* IE7 */ 88 *:first-child+html .cke_panel_listItem a 89 { 90 /* IE is not able to inherit the color, so we must force it to black */ 91 color: #000; 92 } 93 94 .cke_panel_listItem.cke_selected a 95 { 96 border: 1px solid #ccc; 97 background-color: #e9f5ff; 98 } 99 100 .cke_panel_listItem a:hover, 101 .cke_panel_listItem a:focus, 102 .cke_panel_listItem a:active 103 { 104 border-color: #316ac5; 105 background-color: #dff1ff; 106 } 107 108 .cke_panel_grouptitle 109 { 110 font-size: 11px; 111 font-family: 'Microsoft Sans Serif' , Tahoma, Arial, Verdana, Sans-Serif; 112 font-weight: bold; 113 white-space: nowrap; 114 background-color: #dcdcdc; 115 color: #000; 116 margin:0px; 117 padding:3px; 118 } 119 120 .cke_panel_listItem p, 121 .cke_panel_listItem h1, 122 .cke_panel_listItem h2, 123 .cke_panel_listItem h3, 124 .cke_panel_listItem h4, 125 .cke_panel_listItem h5, 126 .cke_panel_listItem h6, 127 .cke_panel_listItem pre 128 { 129 margin-top: 3px; 130 margin-bottom: 3px; 131 } -
_source/skins/default/richcombo.css
1 /* Special Combo */ 2 3 .cke_skin_default .cke_rcombo 4 { 5 padding-right: 4px; 6 float: left; 7 } 8 9 /* IE6 only */ 10 /*\*/ 11 * html .cke_skin_default .cke_rcombo 12 { 13 float: none; 14 } 15 /**/ 16 17 .cke_skin_default .cke_rcombo a 18 { 19 filter: alpha(opacity=70); /* IE */ 20 opacity: 0.70; /* Safari, Opera and Mozilla */ 21 } 22 23 .cke_skin_default .cke_rcombo .cke_label 24 { 25 padding-top: 6px; 26 padding-left: 4px; 27 padding-right: 5px; 28 float: left; 29 filter: alpha(opacity=70); /* IE */ 30 opacity: 0.70; /* Safari, Opera and Mozilla */ 31 background-color: #f1f1e3; /* Because of IE6+ClearType */ 32 } 33 34 .cke_skin_default .cke_rcombo .cke_text 35 { 36 border: 1px solid #8f8f73; 37 background-color: #fff; 38 float: left; 39 height: 14px; 40 width:60px; 41 padding-top: 4px; 42 padding-bottom: 4px; 43 padding-left: 5px; 44 padding-right: 5px; 45 text-overflow: ellipsis; 46 overflow: hidden; 47 -moz-border-radius-topleft: 3px; 48 -webkit-border-top-left-radius: 3px; 49 border-top-left-radius: 3px; 50 -moz-border-radius-bottomleft: 3px; 51 -webkit-border-bottom-left-radius: 3px; 52 border-bottom-left-radius: 3px; 53 } 54 55 .cke_skin_default .cke_rcombo .cke_openbutton 56 { 57 background-position: center center; 58 background-image: url(images/toolbar.buttonarrow.gif); 59 border-right: 1px solid #8f8f73; 60 border-top: 1px solid #8f8f73; 61 border-bottom: 1px solid #8f8f73; 62 display: block; 63 float: left; 64 width: 14px; 65 height: 22px; 66 background-repeat: no-repeat; 67 -moz-border-radius-topright: 3px; 68 -webkit-border-top-right-radius: 3px; 69 border-top-left-radius: 3px; 70 -moz-border-radius-bottomright: 3px; 71 -webkit-border-bottom-right-radius: 3px; 72 border-bottom-left-radius: 3px; 73 } 74 75 .cke_skin_default .cke_rcombo a:hover, 76 .cke_skin_default .cke_rcombo a:focus, 77 .cke_skin_default .cke_rcombo a:active, 78 .cke_skin_default .cke_rcombo.cke_on a 79 { 80 filter: alpha(opacity=100); /* IE */ 81 opacity: 1; /* Safari, Opera and Mozilla */ 82 } 83 84 .cke_skin_default .cke_rcombo a:hover .cke_text, 85 .cke_skin_default .cke_rcombo a:focus .cke_text, 86 .cke_skin_default .cke_rcombo a:active .cke_text, 87 .cke_skin_default .cke_rcombo.cke_on .cke_text 88 { 89 border-color: #316ac5; 90 } 91 92 .cke_skin_default .cke_rcombo a:hover .cke_openbutton, 93 .cke_skin_default .cke_rcombo a:focus .cke_openbutton, 94 .cke_skin_default .cke_rcombo a:active .cke_openbutton, 95 .cke_skin_default .cke_rcombo.cke_on .cke_openbutton 96 { 97 border-color: #316ac5; 98 background-color: #dff1ff; 99 } 100 101 .cke_skin_default .cke_rcombo.cke_on .cke_text 102 { 103 -moz-border-radius-bottomleft: 0px; 104 -webkit-border-bottom-left-radius: 0px; 105 border-bottom-left-radius: 0px; 106 } 107 108 .cke_skin_default .cke_rcombo.cke_on .cke_openbutton 109 { 110 -moz-border-radius-bottomright: 0px; 111 -webkit-border-bottom-right-radius: 0px; 112 border-bottom-right-radius: 0px; 113 } -
_source/tests/core/event.html
449 449 assert.areSame( false, isCanceledC, 'event C must not be canceled' ); 450 450 }, 451 451 452 test_event_removeListener : function() 453 { 454 // Create a testObject and implement CKEDITOR.event on it. 455 var testObject = {}; 456 CKEDITOR.event.implementOn( testObject ); 457 458 var counter = 0; 459 460 // Add two listeners for the same event "A". 461 462 testObject.on( 'A', function( ev ) 463 { 464 counter++; 465 ev.removeListener(); 466 }); 467 468 testObject.on( 'A', function( ev ) 469 { 470 counter++; 471 }); 472 473 // Fire the event twice. 474 testObject.fire( 'A' ); 475 testObject.fire( 'A' ); 476 477 assert.areSame( 3, counter ); 478 }, 479 452 480 name : document.title 453 481 }; 454 482 })() ); -
_source/themes/default/theme.js
57 57 // differently by the browsers ("semi-inline"). 58 58 var container = CKEDITOR.dom.element.createFromHtml( [ 59 59 '<span id="cke_', name, '" onmousedown="return false;" class="cke_container cke_skin_', editor.config.skin, ' ', browserCssClass, 60 ' cke_', editor.lang.dir, '" dir="', editor.lang.dir, '" >' +60 ' cke_', editor.lang.dir, '" dir="', editor.lang.dir, '" title="', ( CKEDITOR.env.gecko ? ' ' : '' ), '">' + 61 61 '<table class="cke_editor" border="0" cellspacing="0" cellpadding="0" style="width:', width, ';height:', height, '"><tbody>' + 62 62 '<tr', topHtml ? '' : ' style="display:none"', '><td id="cke_top_' , name, '" class="cke_top">' , topHtml , '</td></tr>' + 63 63 '<tr', contentsHtml ? '' : ' style="display:none"', '><td id="cke_contents_', name, '" class="cke_contents" style="height:100%">' , contentsHtml , '</td></tr>' + -
ckeditor.pack
46 46 'CKEDITOR.SELECTION_NONE' : 1, 47 47 'CKEDITOR.SELECTION_TEXT' : 2, 48 48 'CKEDITOR.SELECTION_ELEMENT' : 3, 49 'CKEDITOR.UI_RICHCOMBO' : 3, 49 50 'CKEDITOR.DIALOG_RESIZE_NONE' : 0, 50 51 'CKEDITOR.DIALOG_RESIZE_WIDTH' : 1, 51 52 'CKEDITOR.DIALOG_RESIZE_HEIGHT' : 2, 52 53 'CKEDITOR.DIALOG_RESIZE_BOTH' : 3, 53 54 'CKEDITOR.VALIDATE_OR' : 1, 54 'CKEDITOR.VALIDATE_AND' : 2 55 'CKEDITOR.VALIDATE_AND' : 2, 56 'CKEDITOR.UI_PANEL' : 2 55 57 }, 56 58 57 59 packages : … … 120 122 '_source/plugins/clipboard/plugin.js', 121 123 '_source/plugins/elementspath/plugin.js', 122 124 '_source/plugins/find/plugin.js', 125 '_source/plugins/format/plugin.js', 123 126 '_source/plugins/horizontalrule/plugin.js', 124 127 '_source/plugins/htmldataprocessor/plugin.js', 125 128 '_source/plugins/image/plugin.js', … … 147 150 '_source/plugins/styles/plugin.js', 148 151 '_source/plugins/domiterator/plugin.js', 149 152 '_source/plugins/selection/plugin.js', 153 '_source/plugins/richcombo/plugin.js', 150 154 '_source/plugins/htmlwriter/plugin.js', 151 155 '_source/plugins/fakeobjects/plugin.js', 152 156 '_source/plugins/dialog/plugin.js', 153 157 '_source/plugins/editingblock/plugin.js', 158 '_source/plugins/floatpanel/plugin.js', 159 '_source/plugins/listblock/plugin.js', 154 160 '_source/plugins/dialogui/plugin.js', 161 '_source/plugins/panel/plugin.js', 155 162 '_source/skins/default/skin.js', 156 163 '_source/themes/default/theme.js' 157 164 ] -
contents.css
9 9 font-family: Arial, Verdana, sans-serif; 10 10 font-size: 12px; 11 11 12 /* Text color */ 13 color: #222; 14 12 15 /* Remove the background color to make it transparent */ 13 16 background-color: #fff; 14 17 }