--- /dev/null
+/*\r
+Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.\r
+For licensing, see LICENSE.html or http://ckeditor.com/license\r
+*/\r
+\r
+/**\r
+ * @fileOverview Contains the second part of the {@link CKEDITOR} object\r
+ * definition, which defines the basic editor features to be available in\r
+ * the root ckeditor_basic.js file.\r
+ */\r
+\r
+if ( CKEDITOR.status == 'unloaded' )\r
+{\r
+ (function()\r
+ {\r
+ CKEDITOR.event.implementOn( CKEDITOR );\r
+\r
+ /**\r
+ * Forces the full CKEditor core code, in the case only the basic code has been\r
+ * loaded (ckeditor_basic.js). This method self-destroys (becomes undefined) in\r
+ * the first call or as soon as the full code is available.\r
+ * @example\r
+ * // Check if the full core code has been loaded and load it.\r
+ * if ( CKEDITOR.loadFullCore )\r
+ * <b>CKEDITOR.loadFullCore()</b>;\r
+ */\r
+ CKEDITOR.loadFullCore = function()\r
+ {\r
+ // If not the basic code is not ready it, just mark it to be loaded.\r
+ if ( CKEDITOR.status != 'basic_ready' )\r
+ {\r
+ CKEDITOR.loadFullCore._load = 1;\r
+ return;\r
+ }\r
+\r
+ // Destroy this function.\r
+ delete CKEDITOR.loadFullCore;\r
+\r
+ // Append the script to the head.\r
+ var script = document.createElement( 'script' );\r
+ script.type = 'text/javascript';\r
+ script.src = CKEDITOR.basePath + 'ckeditor.js';\r
+\r
+ document.getElementsByTagName( 'head' )[0].appendChild( script );\r
+ };\r
+\r
+ /**\r
+ * The time to wait (in seconds) to load the full editor code after the\r
+ * page load, if the "ckeditor_basic" file is used. If set to zero, the\r
+ * editor is loaded on demand, as soon as an instance is created.\r
+ *\r
+ * This value must be set on the page before the page load completion.\r
+ * @type Number\r
+ * @default 0 (zero)\r
+ * @example\r
+ * // Loads the full source after five seconds.\r
+ * CKEDITOR.loadFullCoreTimeout = 5;\r
+ */\r
+ CKEDITOR.loadFullCoreTimeout = 0;\r
+\r
+ /**\r
+ * The class name used to identify <textarea> elements to be replace\r
+ * by CKEditor instances.\r
+ * @type String\r
+ * @default 'ckeditor'\r
+ * @example\r
+ * <b>CKEDITOR.replaceClass</b> = 'rich_editor';\r
+ */\r
+ CKEDITOR.replaceClass = 'ckeditor';\r
+\r
+ /**\r
+ * Enables the replacement of all textareas with class name matching\r
+ * {@link CKEDITOR.replaceClass}.\r
+ * @type Boolean\r
+ * @default true\r
+ * @example\r
+ * // Disable the auto-replace feature.\r
+ * <b>CKEDITOR.replaceByClassEnabled</b> = false;\r
+ */\r
+ CKEDITOR.replaceByClassEnabled = 1;\r
+\r
+ var createInstance = function( elementOrIdOrName, config, creationFunction, data )\r
+ {\r
+ if ( CKEDITOR.env.isCompatible )\r
+ {\r
+ // Load the full core.\r
+ if ( CKEDITOR.loadFullCore )\r
+ CKEDITOR.loadFullCore();\r
+\r
+ var editor = creationFunction( elementOrIdOrName, config, data );\r
+ CKEDITOR.add( editor );\r
+ return editor;\r
+ }\r
+\r
+ return null;\r
+ };\r
+\r
+ /**\r
+ * Replaces a <textarea> or a DOM element (DIV) with a CKEditor\r
+ * instance. For textareas, the initial value in the editor will be the\r
+ * textarea value. For DOM elements, their innerHTML will be used\r
+ * instead. We recommend using TEXTAREA and DIV elements only.\r
+ * @param {Object|String} elementOrIdOrName The DOM element (textarea), its\r
+ * ID or name.\r
+ * @param {Object} [config] The specific configurations to apply to this\r
+ * editor instance. Configurations set here will override global CKEditor\r
+ * settings.\r
+ * @returns {CKEDITOR.editor} The editor instance created.\r
+ * @example\r
+ * <textarea id="myfield" name="myfield"><:/textarea>\r
+ * ...\r
+ * <b>CKEDITOR.replace( 'myfield' )</b>;\r
+ * @example\r
+ * var textarea = document.body.appendChild( document.createElement( 'textarea' ) );\r
+ * <b>CKEDITOR.replace( textarea )</b>;\r
+ */\r
+ CKEDITOR.replace = function( elementOrIdOrName, config )\r
+ {\r
+ return createInstance( elementOrIdOrName, config, CKEDITOR.editor.replace );\r
+ };\r
+\r
+ /**\r
+ * Creates a new editor instance inside a specific DOM element.\r
+ * @param {Object|String} elementOrId The DOM element or its ID.\r
+ * @param {Object} [config] The specific configurations to apply to this\r
+ * editor instance. Configurations set here will override global CKEditor\r
+ * settings.\r
+ * @param {String} [data] Since 3.3. Initial value for the instance.\r
+ * @returns {CKEDITOR.editor} The editor instance created.\r
+ * @example\r
+ * <div id="editorSpace"><:/div>\r
+ * ...\r
+ * <b>CKEDITOR.appendTo( 'editorSpace' )</b>;\r
+ */\r
+ CKEDITOR.appendTo = function( elementOrId, config, data )\r
+ {\r
+ return createInstance( elementOrId, config, CKEDITOR.editor.appendTo, data );\r
+ };\r
+\r
+ // Documented at ckeditor.js.\r
+ CKEDITOR.add = function( editor )\r
+ {\r
+ // For now, just put the editor in the pending list. It will be\r
+ // processed as soon as the full code gets loaded.\r
+ var pending = this._.pending || ( this._.pending = [] );\r
+ pending.push( editor );\r
+ };\r
+\r
+ /**\r
+ * Replace all <textarea> elements available in the document with\r
+ * editor instances.\r
+ * @example\r
+ * // Replace all <textarea> elements in the page.\r
+ * CKEDITOR.replaceAll();\r
+ * @example\r
+ * // Replace all <textarea class="myClassName"> elements in the page.\r
+ * CKEDITOR.replaceAll( 'myClassName' );\r
+ * @example\r
+ * // Selectively replace <textarea> elements, based on custom assertions.\r
+ * CKEDITOR.replaceAll( function( textarea, config )\r
+ * {\r
+ * // Custom code to evaluate the replace, returning false\r
+ * // if it must not be done.\r
+ * // It also passes the "config" parameter, so the\r
+ * // developer can customize the instance.\r
+ * } );\r
+ */\r
+ CKEDITOR.replaceAll = function()\r
+ {\r
+ var textareas = document.getElementsByTagName( 'textarea' );\r
+\r
+ for ( var i = 0 ; i < textareas.length ; i++ )\r
+ {\r
+ var config = null,\r
+ textarea = textareas[i];\r
+\r
+ // The "name" and/or "id" attribute must exist.\r
+ if ( !textarea.name && !textarea.id )\r
+ continue;\r
+\r
+ if ( typeof arguments[0] == 'string' )\r
+ {\r
+ // The textarea class name could be passed as the function\r
+ // parameter.\r
+\r
+ var classRegex = new RegExp( '(?:^|\\s)' + arguments[0] + '(?:$|\\s)' );\r
+\r
+ if ( !classRegex.test( textarea.className ) )\r
+ continue;\r
+ }\r
+ else if ( typeof arguments[0] == 'function' )\r
+ {\r
+ // An assertion function could be passed as the function parameter.\r
+ // It must explicitly return "false" to ignore a specific <textarea>.\r
+ config = {};\r
+ if ( arguments[0]( textarea, config ) === false )\r
+ continue;\r
+ }\r
+\r
+ this.replace( textarea, config );\r
+ }\r
+ };\r
+\r
+ (function()\r
+ {\r
+ var onload = function()\r
+ {\r
+ var loadFullCore = CKEDITOR.loadFullCore,\r
+ loadFullCoreTimeout = CKEDITOR.loadFullCoreTimeout;\r
+\r
+ // Replace all textareas with the default class name.\r
+ if ( CKEDITOR.replaceByClassEnabled )\r
+ CKEDITOR.replaceAll( CKEDITOR.replaceClass );\r
+\r
+ CKEDITOR.status = 'basic_ready';\r
+\r
+ if ( loadFullCore && loadFullCore._load )\r
+ loadFullCore();\r
+ else if ( loadFullCoreTimeout )\r
+ {\r
+ setTimeout( function()\r
+ {\r
+ if ( CKEDITOR.loadFullCore )\r
+ CKEDITOR.loadFullCore();\r
+ }\r
+ , loadFullCoreTimeout * 1000 );\r
+ }\r
+ };\r
+\r
+ if ( window.addEventListener )\r
+ window.addEventListener( 'load', onload, false );\r
+ else if ( window.attachEvent )\r
+ window.attachEvent( 'onload', onload );\r
+ })();\r
+\r
+ CKEDITOR.status = 'basic_loaded';\r
+ })();\r
+}\r