Commit 7a80df63 authored by Frank Bergmann's avatar Frank Bergmann

- OpenACS 5.9

parent 38d5de1f
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview API initialization code.
*/
(function()
{
// Disable HC detaction in WebKit. (#5429)
if ( CKEDITOR.env.webkit )
{
CKEDITOR.env.hc = false;
return;
}
// Check whether high contrast is active by creating a colored border.
var hcDetect = CKEDITOR.dom.element.createFromHtml(
'<div style="width:0px;height:0px;position:absolute;left:-10000px;' +
'border: 1px solid;border-color: red blue;"></div>', CKEDITOR.document );
hcDetect.appendTo( CKEDITOR.document.getHead() );
// Update CKEDITOR.env.
// Catch exception needed sometimes for FF. (#4230)
try
{
CKEDITOR.env.hc = hcDetect.getComputedStyle( 'border-top-color' ) == hcDetect.getComputedStyle( 'border-right-color' );
}
catch (e)
{
CKEDITOR.env.hc = false;
}
if ( CKEDITOR.env.hc )
CKEDITOR.env.cssClass += ' cke_hc';
hcDetect.remove();
})();
// Load core plugins.
CKEDITOR.plugins.load( CKEDITOR.config.corePlugins.split( ',' ), function()
{
CKEDITOR.status = 'loaded';
CKEDITOR.fire( 'loaded' );
// Process all instances created by the "basic" implementation.
var pending = CKEDITOR._.pending;
if ( pending )
{
delete CKEDITOR._.pending;
for ( var i = 0 ; i < pending.length ; i++ )
CKEDITOR.add( pending[ i ] );
}
});
// Needed for IE6 to not request image (HTTP 200 or 304) for every CSS background. (#6187)
if ( CKEDITOR.env.ie )
{
// Remove IE mouse flickering on IE6 because of background images.
try
{
document.execCommand( 'BackgroundImageCache', false, true );
}
catch (e)
{
// We have been reported about loading problems caused by the above
// line. For safety, let's just ignore errors.
}
}
/**
* Indicates that CKEditor is running on a High Contrast environment.
* @name CKEDITOR.env.hc
* @example
* if ( CKEDITOR.env.hc )
* alert( 'You're running on High Contrast mode. The editor interface will get adapted to provide you a better experience.' );
*/
/**
* Fired when a CKEDITOR core object is fully loaded and ready for interaction.
* @name CKEDITOR#loaded
* @event
*/
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Contains the third and last part of the {@link CKEDITOR} object
* definition.
*/
// Remove the CKEDITOR.loadFullCore reference defined on ckeditor_basic.
delete CKEDITOR.loadFullCore;
/**
* Holds references to all editor instances created. The name of the properties
* in this object correspond to instance names, and their values contains the
* {@link CKEDITOR.editor} object representing them.
* @type {Object}
* @example
* alert( <b>CKEDITOR.instances</b>.editor1.name ); // "editor1"
*/
CKEDITOR.instances = {};
/**
* The document of the window holding the CKEDITOR object.
* @type {CKEDITOR.dom.document}
* @example
* alert( <b>CKEDITOR.document</b>.getBody().getName() ); // "body"
*/
CKEDITOR.document = new CKEDITOR.dom.document( document );
/**
* Adds an editor instance to the global {@link CKEDITOR} object. This function
* is available for internal use mainly.
* @param {CKEDITOR.editor} editor The editor instance to be added.
* @example
*/
CKEDITOR.add = function( editor )
{
CKEDITOR.instances[ editor.name ] = editor;
editor.on( 'focus', function()
{
if ( CKEDITOR.currentInstance != editor )
{
CKEDITOR.currentInstance = editor;
CKEDITOR.fire( 'currentInstance' );
}
});
editor.on( 'blur', function()
{
if ( CKEDITOR.currentInstance == editor )
{
CKEDITOR.currentInstance = null;
CKEDITOR.fire( 'currentInstance' );
}
});
};
/**
* Removes an editor instance from the global {@link CKEDITOR} object. This function
* is available for internal use only. External code must use {@link CKEDITOR.editor.prototype.destroy}
* to avoid memory leaks.
* @param {CKEDITOR.editor} editor The editor instance to be removed.
* @example
*/
CKEDITOR.remove = function( editor )
{
delete CKEDITOR.instances[ editor.name ];
};
/**
* Perform global clean up to free as much memory as possible
* when there are no instances left
*/
CKEDITOR.on( 'instanceDestroyed', function ()
{
if ( CKEDITOR.tools.isEmpty( this.instances ) )
CKEDITOR.fire( 'reset' );
});
// Load the bootstrap script.
CKEDITOR.loader.load( 'core/_bootstrap' ); // @Packager.RemoveLine
// Tri-state constants.
/**
* Used to indicate the ON or ACTIVE state.
* @constant
* @example
*/
CKEDITOR.TRISTATE_ON = 1;
/**
* Used to indicate the OFF or NON ACTIVE state.
* @constant
* @example
*/
CKEDITOR.TRISTATE_OFF = 2;
/**
* Used to indicate DISABLED state.
* @constant
* @example
*/
CKEDITOR.TRISTATE_DISABLED = 0;
/**
* The editor which is currently active (have user focus).
* @name CKEDITOR.currentInstance
* @type CKEDITOR.editor
* @see CKEDITOR#currentInstance
* @example
* function showCurrentEditorName()
* {
* if ( CKEDITOR.currentInstance )
* alert( CKEDITOR.currentInstance.name );
* else
* alert( 'Please focus an editor first.' );
* }
*/
/**
* Fired when the CKEDITOR.currentInstance object reference changes. This may
* happen when setting the focus on different editor instances in the page.
* @name CKEDITOR#currentInstance
* @event
* var editor; // Variable to hold a reference to the current editor.
* CKEDITOR.on( 'currentInstance' , function( e )
* {
* editor = CKEDITOR.currentInstance;
* });
*/
/**
* Fired when the last instance has been destroyed. This event is used to perform
* global memory clean up.
* @name CKEDITOR#reset
* @event
*/
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Contains the first and essential part of the {@link CKEDITOR}
* object definition.
*/
// #### Compressed Code
// Must be updated on changes in the script as well as updated in the
// ckeditor_source.js and ckeditor_basic_source.js files.
// if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'',version:'3.6.2',rev:'7275',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f<e.length;f++){var g=e[f].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i);if(g){d=g[1];break;}}}if(d.indexOf(':/')==-1)if(d.indexOf('/')===0)d=location.href.match(/^.*?:\/\/[^\/]*/)[0]+d;else d=location.href.match(/^[^\?]*\/(?:)/)[0]+d;return d;})(),getUrl:function(d){if(d.indexOf(':/')==-1&&d.indexOf('/')!==0)d=this.basePath+d;if(this.timestamp&&d.charAt(d.length-1)!='/')d+=(d.indexOf('?')>=0?'&':'?')+('t=')+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();
// #### Raw code
// ATTENTION: read the above "Compressed Code" notes when changing this code.
/* @Packager.RemoveLine
// Avoid having the editor code initialized twice. (#7588)
// Use CKEDITOR.dom to check whether the full ckeditor.js code has been loaded
// or just ckeditor_basic.js.
// Remove these lines when compressing manually.
if ( window.CKEDITOR && window.CKEDITOR.dom )
return;
@Packager.RemoveLine */
if ( !window.CKEDITOR )
{
/**
* @name CKEDITOR
* @namespace This is the API entry point. The entire CKEditor code runs under this object.
* @example
*/
window.CKEDITOR = (function()
{
var CKEDITOR =
/** @lends CKEDITOR */
{
/**
* A constant string unique for each release of CKEditor. Its value
* is used, by default, to build the URL for all resources loaded
* by the editor code, guaranteeing clean cache results when
* upgrading.
* @type String
* @example
* alert( CKEDITOR.timestamp ); // e.g. '87dm'
*/
// The production implementation contains a fixed timestamp, unique
// for each release and generated by the releaser.
// (Base 36 value of each component of YYMMDDHH - 4 chars total - e.g. 87bm == 08071122)
timestamp : 'B8DJ5M3',
/**
* Contains the CKEditor version number.
* @type String
* @example
* alert( CKEDITOR.version ); // e.g. 'CKEditor 3.4.1'
*/
version : '3.6.2',
/**
* Contains the CKEditor revision number.
* The revision number is incremented automatically, following each
* modification to the CKEditor source code.
* @type String
* @example
* alert( CKEDITOR.revision ); // e.g. '3975'
*/
revision : '7275',
/**
* Private object used to hold core stuff. It should not be used outside of
* the API code as properties defined here may change at any time
* without notice.
* @private
*/
_ : {},
/**
* Indicates the API loading status. The following statuses are available:
* <ul>
* <li><b>unloaded</b>: the API is not yet loaded.</li>
* <li><b>basic_loaded</b>: the basic API features are available.</li>
* <li><b>basic_ready</b>: the basic API is ready to load the full core code.</li>
* <li><b>loading</b>: the full API is being loaded.</li>
* <li><b>loaded</b>: the API can be fully used.</li>
* </ul>
* @type String
* @example
* if ( <b>CKEDITOR.status</b> == 'loaded' )
* {
* // The API can now be fully used.
* }
*/
status : 'unloaded',
/**
* Contains the full URL for the CKEditor installation directory.
* It is possible to manually provide the base path by setting a
* global variable named CKEDITOR_BASEPATH. This global variable
* must be set <strong>before</strong> the editor script loading.
* @type String
* @example
* alert( <b>CKEDITOR.basePath</b> ); // "http://www.example.com/ckeditor/" (e.g.)
*/
basePath : (function()
{
// ATTENTION: fixes to this code must be ported to
// var basePath in "core/loader.js".
// Find out the editor directory path, based on its <script> tag.
var path = window.CKEDITOR_BASEPATH || '';
if ( !path )
{
var scripts = document.getElementsByTagName( 'script' );
for ( var i = 0 ; i < scripts.length ; i++ )
{
var match = scripts[i].src.match( /(^|.*[\\\/])ckeditor(?:_basic)?(?:_source)?.js(?:\?.*)?$/i );
if ( match )
{
path = match[1];
break;
}
}
}
// In IE (only) the script.src string is the raw value entered in the
// HTML source. Other browsers return the full resolved URL instead.
if ( path.indexOf(':/') == -1 )
{
// Absolute path.
if ( path.indexOf( '/' ) === 0 )
path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
// Relative path.
else
path = location.href.match( /^[^\?]*\/(?:)/ )[0] + path;
}
if ( !path )
throw 'The CKEditor installation path could not be automatically detected. Please set the global variable "CKEDITOR_BASEPATH" before creating editor instances.';
return path;
})(),
/**
* Gets the full URL for CKEditor resources. By default, URLs
* returned by this function contain a querystring parameter ("t")
* set to the {@link CKEDITOR.timestamp} value.<br />
* <br />
* It is possible to provide a custom implementation of this
* function by setting a global variable named CKEDITOR_GETURL.
* This global variable must be set <strong>before</strong> the editor script
* loading. If the custom implementation returns nothing (==null), the
* default implementation is used.
* @param {String} resource The resource whose full URL we want to get.
* It may be a full, absolute, or relative URL.
* @returns {String} The full URL.
* @example
* // e.g. http://www.example.com/ckeditor/skins/default/editor.css?t=87dm
* alert( CKEDITOR.getUrl( 'skins/default/editor.css' ) );
* @example
* // e.g. http://www.example.com/skins/default/editor.css?t=87dm
* alert( CKEDITOR.getUrl( '/skins/default/editor.css' ) );
* @example
* // e.g. http://www.somesite.com/skins/default/editor.css?t=87dm
* alert( CKEDITOR.getUrl( 'http://www.somesite.com/skins/default/editor.css' ) );
*/
getUrl : function( resource )
{
// If this is not a full or absolute path.
if ( resource.indexOf(':/') == -1 && resource.indexOf( '/' ) !== 0 )
resource = this.basePath + resource;
// Add the timestamp, except for directories.
if ( this.timestamp && resource.charAt( resource.length - 1 ) != '/' && !(/[&?]t=/).test( resource ) )
resource += ( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) + 't=' + this.timestamp;
return resource;
}
};
// Make it possible to override the getUrl function with a custom
// implementation pointing to a global named CKEDITOR_GETURL.
var newGetUrl = window.CKEDITOR_GETURL;
if ( newGetUrl )
{
var originalGetUrl = CKEDITOR.getUrl;
CKEDITOR.getUrl = function ( resource )
{
return newGetUrl.call( CKEDITOR, resource ) ||
originalGetUrl.call( CKEDITOR, resource );
};
}
return CKEDITOR;
})();
}
/**
* Function called upon loading a custom configuration file that can
* modify the editor instance configuration ({@link CKEDITOR.editor#config }).
* It is usually defined inside the custom configuration files that can
* include developer defined settings.
* @name CKEDITOR.editorConfig
* @function
* @param {CKEDITOR.config} config A configuration object containing the
* settings defined for a {@link CKEDITOR.editor} instance up to this
* function call. Note that not all settings may still be available. See
* <a href="http://docs.cksource.com/CKEditor_3.x/Developers_Guide/Setting_Configurations#Configuration_Loading_Order">Configuration Loading Order</a>
* for details.
* @example
* // This is supposed to be placed in the config.js file.
* CKEDITOR.editorConfig = function( config )
* {
* // Define changes to default configuration here. For example:
* config.language = 'fr';
* config.uiColor = '#AADC6E';
* };
*/
// PACKAGER_RENAME( CKEDITOR )
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Contains the second part of the {@link CKEDITOR} object
* definition, which defines the basic editor features to be available in
* the root ckeditor_basic.js file.
*/
if ( CKEDITOR.status == 'unloaded' )
{
(function()
{
CKEDITOR.event.implementOn( CKEDITOR );
/**
* Forces the full CKEditor core code, in the case only the basic code has been
* loaded (ckeditor_basic.js). This method self-destroys (becomes undefined) in
* the first call or as soon as the full code is available.
* @example
* // Check if the full core code has been loaded and load it.
* if ( CKEDITOR.loadFullCore )
* <b>CKEDITOR.loadFullCore()</b>;
*/
CKEDITOR.loadFullCore = function()
{
// If not the basic code is not ready it, just mark it to be loaded.
if ( CKEDITOR.status != 'basic_ready' )
{
CKEDITOR.loadFullCore._load = 1;
return;
}
// Destroy this function.
delete CKEDITOR.loadFullCore;
// Append the script to the head.
var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = CKEDITOR.basePath + 'ckeditor.js';
document.getElementsByTagName( 'head' )[0].appendChild( script );
};
/**
* The time to wait (in seconds) to load the full editor code after the
* page load, if the "ckeditor_basic" file is used. If set to zero, the
* editor is loaded on demand, as soon as an instance is created.
*
* This value must be set on the page before the page load completion.
* @type Number
* @default 0 (zero)
* @example
* // Loads the full source after five seconds.
* CKEDITOR.loadFullCoreTimeout = 5;
*/
CKEDITOR.loadFullCoreTimeout = 0;
/**
* The class name used to identify &lt;textarea&gt; elements to be replace
* by CKEditor instances.
* @type String
* @default 'ckeditor'
* @example
* <b>CKEDITOR.replaceClass</b> = 'rich_editor';
*/
CKEDITOR.replaceClass = 'ckeditor';
/**
* Enables the replacement of all textareas with class name matching
* {@link CKEDITOR.replaceClass}.
* @type Boolean
* @default true
* @example
* // Disable the auto-replace feature.
* <b>CKEDITOR.replaceByClassEnabled</b> = false;
*/
CKEDITOR.replaceByClassEnabled = 1;
var createInstance = function( elementOrIdOrName, config, creationFunction, data )
{
if ( CKEDITOR.env.isCompatible )
{
// Load the full core.
if ( CKEDITOR.loadFullCore )
CKEDITOR.loadFullCore();
var editor = creationFunction( elementOrIdOrName, config, data );
CKEDITOR.add( editor );
return editor;
}
return null;
};
/**
* Replaces a &lt;textarea&gt; or a DOM element (DIV) with a CKEditor
* instance. For textareas, the initial value in the editor will be the
* textarea value. For DOM elements, their innerHTML will be used
* instead. We recommend using TEXTAREA and DIV elements only.
* @param {Object|String} elementOrIdOrName The DOM element (textarea), its
* ID or name.
* @param {Object} [config] The specific configurations to apply to this
* editor instance. Configurations set here will override global CKEditor
* settings.
* @returns {CKEDITOR.editor} The editor instance created.
* @example
* &lt;textarea id="myfield" name="myfield"&gt;&lt:/textarea&gt;
* ...
* <b>CKEDITOR.replace( 'myfield' )</b>;
* @example
* var textarea = document.body.appendChild( document.createElement( 'textarea' ) );
* <b>CKEDITOR.replace( textarea )</b>;
*/
CKEDITOR.replace = function( elementOrIdOrName, config )
{
return createInstance( elementOrIdOrName, config, CKEDITOR.editor.replace );
};
/**
* Creates a new editor instance inside a specific DOM element.
* @param {Object|String} elementOrId The DOM element or its ID.
* @param {Object} [config] The specific configurations to apply to this
* editor instance. Configurations set here will override global CKEditor
* settings.
* @param {String} [data] Since 3.3. Initial value for the instance.
* @returns {CKEDITOR.editor} The editor instance created.
* @example
* &lt;div id="editorSpace"&gt;&lt:/div&gt;
* ...
* <b>CKEDITOR.appendTo( 'editorSpace' )</b>;
*/
CKEDITOR.appendTo = function( elementOrId, config, data )
{
return createInstance( elementOrId, config, CKEDITOR.editor.appendTo, data );
};
// Documented at ckeditor.js.
CKEDITOR.add = function( editor )
{
// For now, just put the editor in the pending list. It will be
// processed as soon as the full code gets loaded.
var pending = this._.pending || ( this._.pending = [] );
pending.push( editor );
};
/**
* Replace all &lt;textarea&gt; elements available in the document with
* editor instances.
* @example
* // Replace all &lt;textarea&gt; elements in the page.
* CKEDITOR.replaceAll();
* @example
* // Replace all &lt;textarea class="myClassName"&gt; elements in the page.
* CKEDITOR.replaceAll( 'myClassName' );
* @example
* // Selectively replace &lt;textarea&gt; elements, based on custom assertions.
* CKEDITOR.replaceAll( function( textarea, config )
* {
* // Custom code to evaluate the replace, returning false
* // if it must not be done.
* // It also passes the "config" parameter, so the
* // developer can customize the instance.
* } );
*/
CKEDITOR.replaceAll = function()
{
var textareas = document.getElementsByTagName( 'textarea' );
for ( var i = 0 ; i < textareas.length ; i++ )
{
var config = null,
textarea = textareas[i];
// The "name" and/or "id" attribute must exist.
if ( !textarea.name && !textarea.id )
continue;
if ( typeof arguments[0] == 'string' )
{
// The textarea class name could be passed as the function
// parameter.
var classRegex = new RegExp( '(?:^|\\s)' + arguments[0] + '(?:$|\\s)' );
if ( !classRegex.test( textarea.className ) )
continue;
}
else if ( typeof arguments[0] == 'function' )
{
// An assertion function could be passed as the function parameter.
// It must explicitly return "false" to ignore a specific <textarea>.
config = {};
if ( arguments[0]( textarea, config ) === false )
continue;
}
this.replace( textarea, config );
}
};
(function()
{
var onload = function()
{
var loadFullCore = CKEDITOR.loadFullCore,
loadFullCoreTimeout = CKEDITOR.loadFullCoreTimeout;
// Replace all textareas with the default class name.
if ( CKEDITOR.replaceByClassEnabled )
CKEDITOR.replaceAll( CKEDITOR.replaceClass );
CKEDITOR.status = 'basic_ready';
if ( loadFullCore && loadFullCore._load )
loadFullCore();
else if ( loadFullCoreTimeout )
{
setTimeout( function()
{
if ( CKEDITOR.loadFullCore )
CKEDITOR.loadFullCore();
}
, loadFullCoreTimeout * 1000 );
}
};
if ( window.addEventListener )
window.addEventListener( 'load', onload, false );
else if ( window.attachEvent )
window.attachEvent( 'onload', onload );
})();
CKEDITOR.status = 'basic_loaded';
})();
}
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* Creates a command class instance.
* @class Represents a command that can be executed on an editor instance.
* @param {CKEDITOR.editor} editor The editor instance this command will be
* related to.
* @param {CKEDITOR.commandDefinition} commandDefinition The command
* definition.
* @augments CKEDITOR.event
* @example
* var command = new CKEDITOR.command( editor,
* {
* exec : function( editor )
* {
* alert( editor.document.getBody().getHtml() );
* }
* });
*/
CKEDITOR.command = function( editor, commandDefinition )
{
/**
* Lists UI items that are associated to this command. This list can be
* used to interact with the UI on command execution (by the execution code
* itself, for example).
* @type Array
* @example
* alert( 'Number of UI items associated to this command: ' + command.<b>uiItems</b>.length );
*/
this.uiItems = [];
/**
* Executes the command.
* @param {Object} [data] Any data to pass to the command. Depends on the
* command implementation and requirements.
* @returns {Boolean} A boolean indicating that the command has been
* successfully executed.
* @example
* command.<b>exec()</b>; // The command gets executed.
*/
this.exec = function( data )
{
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
return false;
if ( this.editorFocus ) // Give editor focus if necessary (#4355).
editor.focus();
return ( commandDefinition.exec.call( this, editor, data ) !== false );
};
CKEDITOR.tools.extend( this, commandDefinition,
// Defaults
/** @lends CKEDITOR.command.prototype */
{
/**
* The editor modes within which the command can be executed. The
* execution will have no action if the current mode is not listed
* in this property.
* @type Object
* @default { wysiwyg : 1 }
* @see CKEDITOR.editor.prototype.mode
* @example
* // Enable the command in both WYSIWYG and Source modes.
* command.<b>modes</b> = { wysiwyg : 1, source : 1 };
* @example
* // Enable the command in Source mode only.
* command.<b>modes</b> = { source : 1 };
*/
modes : { wysiwyg : 1 },
/**
* Indicates that the editor will get the focus before executing
* the command.
* @type Boolean
* @default true
* @example
* // Do not force the editor to have focus when executing the command.
* command.<b>editorFocus</b> = false;
*/
editorFocus : 1,
/**
* Indicates the editor state. Possible values are:
* <ul>
* <li>{@link CKEDITOR.TRISTATE_DISABLED}: the command is
* disabled. It's execution will have no effect. Same as
* {@link disable}.</li>
* <li>{@link CKEDITOR.TRISTATE_ON}: the command is enabled
* and currently active in the editor (for context sensitive commands,
* for example).</li>
* <li>{@link CKEDITOR.TRISTATE_OFF}: the command is enabled
* and currently inactive in the editor (for context sensitive
* commands, for example).</li>
* </ul>
* Do not set this property directly, using the {@link #setState}
* method instead.
* @type Number
* @default {@link CKEDITOR.TRISTATE_OFF}
* @example
* if ( command.<b>state</b> == CKEDITOR.TRISTATE_DISABLED )
* alert( 'This command is disabled' );
*/
state : CKEDITOR.TRISTATE_OFF
});
// Call the CKEDITOR.event constructor to initialize this instance.
CKEDITOR.event.call( this );
};
CKEDITOR.command.prototype =
{
/**
* Enables the command for execution. The command state (see
* {@link CKEDITOR.command.prototype.state}) available before disabling it
* is restored.
* @example
* command.<b>enable()</b>;
* command.exec(); // Execute the command.
*/
enable : function()
{
if ( this.state == CKEDITOR.TRISTATE_DISABLED )
this.setState( ( !this.preserveState || ( typeof this.previousState == 'undefined' ) ) ? CKEDITOR.TRISTATE_OFF : this.previousState );
},
/**
* Disables the command for execution. The command state (see
* {@link CKEDITOR.command.prototype.state}) will be set to
* {@link CKEDITOR.TRISTATE_DISABLED}.
* @example
* command.<b>disable()</b>;
* command.exec(); // "false" - Nothing happens.
*/
disable : function()
{
this.setState( CKEDITOR.TRISTATE_DISABLED );
},
/**
* Sets the command state.
* @param {Number} newState The new state. See {@link #state}.
* @returns {Boolean} Returns "true" if the command state changed.
* @example
* command.<b>setState( CKEDITOR.TRISTATE_ON )</b>;
* command.exec(); // Execute the command.
* command.<b>setState( CKEDITOR.TRISTATE_DISABLED )</b>;
* command.exec(); // "false" - Nothing happens.
* command.<b>setState( CKEDITOR.TRISTATE_OFF )</b>;
* command.exec(); // Execute the command.
*/
setState : function( newState )
{
// Do nothing if there is no state change.
if ( this.state == newState )
return false;
this.previousState = this.state;
// Set the new state.
this.state = newState;
// Fire the "state" event, so other parts of the code can react to the
// change.
this.fire( 'state' );
return true;
},
/**
* Toggles the on/off (active/inactive) state of the command. This is
* mainly used internally by context sensitive commands.
* @example
* command.<b>toggleState()</b>;
*/
toggleState : function()
{
if ( this.state == CKEDITOR.TRISTATE_OFF )
this.setState( CKEDITOR.TRISTATE_ON );
else if ( this.state == CKEDITOR.TRISTATE_ON )
this.setState( CKEDITOR.TRISTATE_OFF );
}
};
CKEDITOR.event.implementOn( CKEDITOR.command.prototype, true );
/**
* Indicates the previous command state.
* @name CKEDITOR.command.prototype.previousState
* @type Number
* @see #state
* @example
* alert( command.<b>previousState</b> );
*/
/**
* Fired when the command state changes.
* @name CKEDITOR.command#state
* @event
* @example
* command.on( <b>'state'</b> , function( e )
* {
* // Alerts the new state.
* alert( this.state );
* });
*/
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the "virtual" {@link CKEDITOR.commandDefinition} class,
* which contains the defintion of a command. This file is for
* documentation purposes only.
*/
/**
* (Virtual Class) Do not call this constructor. This class is not really part
* of the API.
* @name CKEDITOR.commandDefinition
* @class Virtual class that illustrates the features of command objects to be
* passed to the {@link CKEDITOR.editor.prototype.addCommand} function.
* @example
*/
/**
* The function to be fired when the commend is executed.
* @name CKEDITOR.commandDefinition.prototype.exec
* @function
* @param {CKEDITOR.editor} editor The editor within which run the command.
* @param {Object} [data] Additional data to be used to execute the command.
* @returns {Boolean} Whether the command has been successfully executed.
* Defaults to "true", if nothing is returned.
* @example
* editorInstance.addCommand( 'sample',
* {
* exec : function( editor )
* {
* alert( 'Executing a command for the editor name "' + editor.name + '"!' );
* }
* });
*/
/**
* Whether the command need to be hooked into the redo/undo system.
* @name CKEDITOR.commandDefinition.prototype.canUndo
* @type {Boolean}
* @default true
* @field
* @example
* editorInstance.addCommand( 'alertName',
* {
* exec : function( editor )
* {
* alert( editor.name );
* },
* canUndo : false // No support for undo/redo
* });
*/
/**
* Whether the command is asynchronous, which means that the
* {@link CKEDITOR.editor#event:afterCommandExec} event will be fired by the
* command itself manually, and that the return value of this command is not to
* be returned by the {@link CKEDITOR.command#exec} function.
* @name CKEDITOR.commandDefinition.prototype.async
* @default false
* @type {Boolean}
* @example
* editorInstance.addCommand( 'loadOptions',
* {
* exec : function( editor )
* {
* // Asynchronous operation below.
* CKEDITOR.ajax.loadXml( 'data.xml', function()
* {
* editor.fire( 'afterCommandExec' );
* ));
* },
* async : true // The command need some time to complete after exec function returns.
* });
*/
/**
* Whether the command should give focus to the editor before execution.
* @name CKEDITOR.commandDefinition.prototype.editorFocus
* @type {Boolean}
* @default true
* @see CKEDITOR.command#editorFocus
* @example
* editorInstance.addCommand( 'maximize',
* {
* exec : function( editor )
* {
* // ...
* },
* editorFocus : false // The command doesn't require focusing the editing document.
* });
*/
/**
* Whether the command state should be set to {@link CKEDITOR.TRISTATE_DISABLED} on startup.
* @name CKEDITOR.commandDefinition.prototype.startDisabled
* @type {Boolean}
* @default false
* @example
* editorInstance.addCommand( 'unlink',
* {
* exec : function( editor )
* {
* // ...
* },
* startDisabled : true // Command is unavailable until selection is inside a link.
* });
*/
/**
* The editor modes within which the command can be executed. The execution
* will have no action if the current mode is not listed in this property.
* @name CKEDITOR.commandDefinition.prototype.modes
* @type Object
* @default { wysiwyg : 1 }
* @see CKEDITOR.command#modes
* @example
* editorInstance.addCommand( 'link',
* {
* exec : function( editor )
* {
* // ...
* },
* modes : { wysiwyg : 1 } // Command is available in wysiwyg mode only.
* });
*/
This diff is collapsed.
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the "virtual" {@link CKEDITOR.dataProcessor} class, which
* defines the basic structure of data processor objects to be
* set to {@link CKEDITOR.editor.dataProcessor}.
*/
/**
* If defined, points to the data processor which is responsible to translate
* and transform the editor data on input and output.
* Generaly it will point to an instance of {@link CKEDITOR.htmlDataProcessor},
* which handles HTML data. The editor may also handle other data formats by
* using different data processors provided by specific plugins.
* @name CKEDITOR.editor.prototype.dataProcessor
* @type CKEDITOR.dataProcessor
*/
/**
* This class is here for documentation purposes only and is not really part of
* the API. It serves as the base ("interface") for data processors
* implementation.
* @name CKEDITOR.dataProcessor
* @class Represents a data processor, which is responsible to translate and
* transform the editor data on input and output.
* @example
*/
/**
* Transforms input data into HTML to be loaded in the editor.
* While the editor is able to handle non HTML data (like BBCode), at runtime
* it can handle HTML data only. The role of the data processor is transforming
* the input data into HTML through this function.
* @name CKEDITOR.dataProcessor.prototype.toHtml
* @function
* @param {String} data The input data to be transformed.
* @param {String} [fixForBody] The tag name to be used if the data must be
* fixed because it is supposed to be loaded direcly into the &lt;body&gt;
* tag. This is generally not used by non-HTML data processors.
* @example
* // Tranforming BBCode data, having a custom BBCode data processor.
* var data = 'This is [b]an example[/b].';
* var html = editor.dataProcessor.toHtml( data ); // '&lt;p&gt;This is &lt;b&gt;an example&lt;/b&gt;.&lt;/p&gt;'
*/
/**
* Transforms HTML into data to be outputted by the editor, in the format
* expected by the data processor.
* While the editor is able to handle non HTML data (like BBCode), at runtime
* it can handle HTML data only. The role of the data processor is transforming
* the HTML data containined by the editor into a specific data format through
* this function.
* @name CKEDITOR.dataProcessor.prototype.toDataFormat
* @function
* @param {String} html The HTML to be transformed.
* @param {String} fixForBody The tag name to be used if the output data is
* coming from &lt;body&gt; and may be eventually fixed for it. This is
* generally not used by non-HTML data processors.
* // Tranforming into BBCode data, having a custom BBCode data processor.
* var html = '&lt;p&gt;This is &lt;b&gt;an example&lt;/b&gt;.&lt;/p&gt;';
* var data = editor.dataProcessor.toDataFormat( html ); // 'This is [b]an example[/b].'
*/
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.dom} object, which contains DOM
* manipulation objects and function.
*/
/**
* @namespace DOM manipulation objects, classes and functions.
* @see CKEDITOR.dom.element
* @see CKEDITOR.dom.node
* @example
*/
CKEDITOR.dom =
{};
// PACKAGER_RENAME( CKEDITOR.dom )
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.dtd} object, which holds the DTD
* mapping for XHTML 1.0 Transitional. This file was automatically
* generated from the file: xhtml1-transitional.dtd.
*/
/**
* @namespace Holds and object representation of the HTML DTD to be used by the
* editor in its internal operations.<br />
* <br />
* Each element in the DTD is represented by a property in this object. Each
* property contains the list of elements that can be contained by the element.
* Text is represented by the "#" property.<br />
* <br />
* Several special grouping properties are also available. Their names start
* with the "$" character.
* @example
* // Check if "div" can be contained in a "p" element.
* alert( !!CKEDITOR.dtd[ 'p' ][ 'div' ] ); "false"
* @example
* // Check if "p" can be contained in a "div" element.
* alert( !!CKEDITOR.dtd[ 'div' ][ 'p' ] ); "true"
* @example
* // Check if "p" is a block element.
* alert( !!CKEDITOR.dtd.$block[ 'p' ] ); "true"
*/
CKEDITOR.dtd = (function()
{
var X = CKEDITOR.tools.extend,
A = {isindex:1,fieldset:1},
B = {input:1,button:1,select:1,textarea:1,label:1},
C = X({a:1},B),
D = X({iframe:1},C),
E = {hr:1,ul:1,menu:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,mark:1,time:1,meter:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,blockquote:1,noscript:1,table:1,center:1,address:1,dir:1,pre:1,h5:1,dl:1,h4:1,noframes:1,h6:1,ol:1,h1:1,h3:1,h2:1},
F = {ins:1,del:1,script:1,style:1},
G = X({b:1,acronym:1,bdo:1,'var':1,'#':1,abbr:1,code:1,br:1,i:1,cite:1,kbd:1,u:1,strike:1,s:1,tt:1,strong:1,q:1,samp:1,em:1,dfn:1,span:1,wbr:1},F),
H = X({sub:1,img:1,object:1,sup:1,basefont:1,map:1,applet:1,font:1,big:1,small:1,mark:1},G),
I = X({p:1},H),
J = X({iframe:1},H,B),
K = {img:1,noscript:1,br:1,kbd:1,center:1,button:1,basefont:1,h5:1,h4:1,samp:1,h6:1,ol:1,h1:1,h3:1,h2:1,form:1,font:1,'#':1,select:1,menu:1,ins:1,abbr:1,label:1,code:1,table:1,script:1,cite:1,input:1,iframe:1,strong:1,textarea:1,noframes:1,big:1,small:1,span:1,hr:1,sub:1,bdo:1,'var':1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,mark:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,object:1,sup:1,strike:1,dir:1,map:1,dl:1,applet:1,del:1,isindex:1,fieldset:1,ul:1,b:1,acronym:1,a:1,blockquote:1,i:1,u:1,s:1,tt:1,address:1,q:1,pre:1,p:1,em:1,dfn:1},
L = X({a:1},J),
M = {tr:1},
N = {'#':1},
O = X({param:1},K),
P = X({form:1},A,D,E,I),
Q = {li:1},
R = {style:1,script:1},
S = {base:1,link:1,meta:1,title:1},
T = X(S,R),
U = {head:1,body:1},
V = {html:1};
var block = {address:1,blockquote:1,center:1,dir:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,dl:1,fieldset:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,hr:1,isindex:1,noframes:1,ol:1,p:1,pre:1,table:1,ul:1};
return /** @lends CKEDITOR.dtd */ {
// The "$" items have been added manually.
// List of elements living outside body.
$nonBodyContent: X(V,U,S),
/**
* List of block elements, like "p" or "div".
* @type Object
* @example
*/
$block : block,
/**
* List of block limit elements.
* @type Object
* @example
*/
$blockLimit : { body:1,div:1,section:1,header:1,footer:1,nav:1,article:1,aside:1,figure:1,dialog:1,hgroup:1,time:1,meter:1,menu:1,command:1,keygen:1,output:1,progress:1,audio:1,video:1,details:1,datagrid:1,datalist:1,td:1,th:1,caption:1,form:1 },
/**
* List of inline (&lt;span&gt; like) elements.
*/
$inline : L, // Just like span.
/**
* list of elements that can be children at &lt;body&gt;.
*/
$body : X({script:1,style:1}, block),
$cdata : {script:1,style:1},
/**
* List of empty (self-closing) elements, like "br" or "img".
* @type Object
* @example
*/
$empty : {area:1,base:1,br:1,col:1,hr:1,img:1,input:1,link:1,meta:1,param:1,wbr:1},
/**
* List of list item elements, like "li" or "dd".
* @type Object
* @example
*/
$listItem : {dd:1,dt:1,li:1},
/**
* List of list root elements.
* @type Object
* @example
*/
$list: {ul:1,ol:1,dl:1},
/**
* Elements that accept text nodes, but are not possible to edit into
* the browser.
* @type Object
* @example
*/
$nonEditable : {applet:1,button:1,embed:1,iframe:1,map:1,object:1,option:1,script:1,textarea:1,param:1,audio:1,video:1},
/**
* List of block tags with each one a singleton element lives in the corresponding structure for description.
*/
$captionBlock : { caption:1, legend:1 },
/**
* List of elements that can be ignored if empty, like "b" or "span".
* @type Object
* @example
*/
$removeEmpty : {abbr:1,acronym:1,address:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,s:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1,mark:1},
/**
* List of elements that have tabindex set to zero by default.
* @type Object
* @example
*/
$tabIndex : {a:1,area:1,button:1,input:1,object:1,select:1,textarea:1},
/**
* List of elements used inside the "table" element, like "tbody" or "td".
* @type Object
* @example
*/
$tableContent : {caption:1,col:1,colgroup:1,tbody:1,td:1,tfoot:1,th:1,thead:1,tr:1},
html: U,
head: T,
style: N,
script: N,
body: P,
base: {},
link: {},
meta: {},
title: N,
col : {},
tr : {td:1,th:1},
img : {},
colgroup : {col:1},
noscript : P,
td : P,
br : {},
wbr : {},
th : P,
center : P,
kbd : L,
button : X(I,E),
basefont : {},
h5 : L,
h4 : L,
samp : L,
h6 : L,
ol : Q,
h1 : L,
h3 : L,
option : N,
h2 : L,
form : X(A,D,E,I),
select : {optgroup:1,option:1},
font : L,
ins : L,
menu : Q,
abbr : L,
label : L,
table : {thead:1,col:1,tbody:1,tr:1,colgroup:1,caption:1,tfoot:1},
code : L,
tfoot : M,
cite : L,
li : P,
input : {},
iframe : P,
strong : L,
textarea : N,
noframes : P,
big : L,
small : L,
span : L,
hr : {},
dt : L,
sub : L,
optgroup : {option:1},
param : {},
bdo : L,
'var' : L,
div : P,
object : O,
sup : L,
dd : P,
strike : L,
area : {},
dir : Q,
map : X({area:1,form:1,p:1},A,F,E),
applet : O,
dl : {dt:1,dd:1},
del : L,
isindex : {},
fieldset : X({legend:1},K),
thead : M,
ul : Q,
acronym : L,
b : L,
a : J,
blockquote : P,
caption : L,
i : L,
u : L,
tbody : M,
s : L,
address : X(D,I),
tt : L,
legend : L,
q : L,
pre : X(G,C),
p : L,
em : L,
dfn : L,
//HTML5
section : P,
header : P,
footer : P,
nav : P,
article : P,
aside : P,
figure: P,
dialog : P,
hgroup : P,
mark : L,
time : L,
meter : L,
menu : L,
command : L,
keygen : L,
output : L,
progress : O,
audio : O,
video : O,
details : O,
datagrid : O,
datalist : O
};
})();
// PACKAGER_RENAME( CKEDITOR.dtd )
This diff is collapsed.
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
if ( !CKEDITOR.editor )
{
/**
* No element is linked to the editor instance.
* @constant
* @example
*/
CKEDITOR.ELEMENT_MODE_NONE = 0;
/**
* The element is to be replaced by the editor instance.
* @constant
* @example
*/
CKEDITOR.ELEMENT_MODE_REPLACE = 1;
/**
* The editor is to be created inside the element.
* @constant
* @example
*/
CKEDITOR.ELEMENT_MODE_APPENDTO = 2;
/**
* Creates an editor class instance. This constructor should be rarely
* used, in favor of the {@link CKEDITOR} editor creation functions.
* @ class Represents an editor instance.
* @param {Object} instanceConfig Configuration values for this specific
* instance.
* @param {CKEDITOR.dom.element} [element] The element linked to this
* instance.
* @param {Number} [mode] The mode in which the element is linked to this
* instance. See {@link #elementMode}.
* @param {String} [data] Since 3.3. Initial value for the instance.
* @augments CKEDITOR.event
* @example
*/
CKEDITOR.editor = function( instanceConfig, element, mode, data )
{
this._ =
{
// Save the config to be processed later by the full core code.
instanceConfig : instanceConfig,
element : element,
data : data
};
/**
* The mode in which the {@link #element} is linked to this editor
* instance. It can be any of the following values:
* <ul>
* <li>{@link CKEDITOR.ELEMENT_MODE_NONE}: No element is linked to the
* editor instance.</li>
* <li>{@link CKEDITOR.ELEMENT_MODE_REPLACE}: The element is to be
* replaced by the editor instance.</li>
* <li>{@link CKEDITOR.ELEMENT_MODE_APPENDTO}: The editor is to be
* created inside the element.</li>
* </ul>
* @name CKEDITOR.editor.prototype.elementMode
* @type Number
* @example
* var editor = CKEDITOR.replace( 'editor1' );
* alert( <b>editor.elementMode</b> ); "1"
*/
this.elementMode = mode || CKEDITOR.ELEMENT_MODE_NONE;
// Call the CKEDITOR.event constructor to initialize this instance.
CKEDITOR.event.call( this );
this._init();
};
/**
* Replaces a &lt;textarea&gt; or a DOM element (DIV) with a CKEditor
* instance. For textareas, the initial value in the editor will be the
* textarea value. For DOM elements, their innerHTML will be used
* instead. We recommend using TEXTAREA and DIV elements only. Do not use
* this function directly. Use {@link CKEDITOR.replace} instead.
* @param {Object|String} elementOrIdOrName The DOM element (textarea), its
* ID or name.
* @param {Object} [config] The specific configurations to apply to this
* editor instance. Configurations set here will override global CKEditor
* settings.
* @returns {CKEDITOR.editor} The editor instance created.
* @example
*/
CKEDITOR.editor.replace = function( elementOrIdOrName, config )
{
var element = elementOrIdOrName;
if ( typeof element != 'object' )
{
// Look for the element by id. We accept any kind of element here.
element = document.getElementById( elementOrIdOrName );
// Elements that should go into head are unacceptable (#6791).
if ( element && element.tagName.toLowerCase() in {style:1,script:1,base:1,link:1,meta:1,title:1} )
element = null;
// If not found, look for elements by name. In this case we accept only
// textareas.
if ( !element )
{
var i = 0,
textareasByName = document.getElementsByName( elementOrIdOrName );
while ( ( element = textareasByName[ i++ ] ) && element.tagName.toLowerCase() != 'textarea' )
{ /*jsl:pass*/ }
}
if ( !element )
throw '[CKEDITOR.editor.replace] The element with id or name "' + elementOrIdOrName + '" was not found.';
}
// Do not replace the textarea right now, just hide it. The effective
// replacement will be done by the _init function.
element.style.visibility = 'hidden';
// Create the editor instance.
return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_REPLACE );
};
/**
* Creates a new editor instance inside a specific DOM element. Do not use
* this function directly. Use {@link CKEDITOR.appendTo} instead.
* @param {Object|String} elementOrId The DOM element or its ID.
* @param {Object} [config] The specific configurations to apply to this
* editor instance. Configurations set here will override global CKEditor
* settings.
* @param {String} [data] Since 3.3. Initial value for the instance.
* @returns {CKEDITOR.editor} The editor instance created.
* @example
*/
CKEDITOR.editor.appendTo = function( elementOrId, config, data )
{
var element = elementOrId;
if ( typeof element != 'object' )
{
element = document.getElementById( elementOrId );
if ( !element )
throw '[CKEDITOR.editor.appendTo] The element with id "' + elementOrId + '" was not found.';
}
// Create the editor instance.
return new CKEDITOR.editor( config, element, CKEDITOR.ELEMENT_MODE_APPENDTO, data );
};
CKEDITOR.editor.prototype =
{
/**
* Initializes the editor instance. This function will be overriden by the
* full CKEDITOR.editor implementation (editor.js).
* @private
*/
_init : function()
{
var pending = CKEDITOR.editor._pending || ( CKEDITOR.editor._pending = [] );
pending.push( this );
},
// Both fire and fireOnce will always pass this editor instance as the
// "editor" param in CKEDITOR.event.fire. So, we override it to do that
// automaticaly.
/** @ignore */
fire : function( eventName, data )
{
return CKEDITOR.event.prototype.fire.call( this, eventName, data, this );
},
/** @ignore */
fireOnce : function( eventName, data )
{
return CKEDITOR.event.prototype.fireOnce.call( this, eventName, data, this );
}
};
// "Inherit" (copy actually) from CKEDITOR.event.
CKEDITOR.event.implementOn( CKEDITOR.editor.prototype, true );
}
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.env} object, which constains
* environment and browser information.
*/
if ( !CKEDITOR.env )
{
/**
* @namespace Environment and browser information.
*/
CKEDITOR.env = (function()
{
var agent = navigator.userAgent.toLowerCase();
var opera = window.opera;
var env =
/** @lends CKEDITOR.env */
{
/**
* Indicates that CKEditor is running on Internet Explorer.
* @type Boolean
* @example
* if ( CKEDITOR.env.ie )
* alert( "I'm on IE!" );
*/
ie : /*@cc_on!@*/false,
/**
* Indicates that CKEditor is running on Opera.
* @type Boolean
* @example
* if ( CKEDITOR.env.opera )
* alert( "I'm on Opera!" );
*/
opera : ( !!opera && opera.version ),
/**
* Indicates that CKEditor is running on a WebKit based browser, like
* Safari.
* @type Boolean
* @example
* if ( CKEDITOR.env.webkit )
* alert( "I'm on WebKit!" );
*/
webkit : ( agent.indexOf( ' applewebkit/' ) > -1 ),
/**
* Indicates that CKEditor is running on Adobe AIR.
* @type Boolean
* @example
* if ( CKEDITOR.env.air )
* alert( "I'm on AIR!" );
*/
air : ( agent.indexOf( ' adobeair/' ) > -1 ),
/**
* Indicates that CKEditor is running on Macintosh.
* @type Boolean
* @example
* if ( CKEDITOR.env.mac )
* alert( "I love apples!" );
*/
mac : ( agent.indexOf( 'macintosh' ) > -1 ),
/**
* Indicates that CKEditor is running on a quirks mode environemnt.
* @type Boolean
* @example
* if ( CKEDITOR.env.quirks )
* alert( "Nooooo!" );
*/
quirks : ( document.compatMode == 'BackCompat' ),
/**
* Indicates that CKEditor is running on a mobile like environemnt.
* @type Boolean
* @example
* if ( CKEDITOR.env.mobile )
* alert( "I'm running with CKEditor today!" );
*/
mobile : ( agent.indexOf( 'mobile' ) > -1 ),
/**
* Indicates that CKEditor is running on Apple iPhone/iPad/iPod devices.
* @type Boolean
* @example
* if ( CKEDITOR.env.iOS )
* alert( "I like little apples!" );
*/
iOS : /(ipad|iphone|ipod)/.test(agent),
/**
* Indicates that the browser has a custom domain enabled. This has
* been set with "document.domain".
* @returns {Boolean} "true" if a custom domain is enabled.
* @example
* if ( CKEDITOR.env.isCustomDomain() )
* alert( "I'm in a custom domain!" );
*/
isCustomDomain : function()
{
if ( !this.ie )
return false;
var domain = document.domain,
hostname = window.location.hostname;
return domain != hostname &&
domain != ( '[' + hostname + ']' ); // IPv6 IP support (#5434)
},
/**
* Indicates that page is running under an encrypted connection.
* @returns {Boolean} "true" if the page has an encrypted connection.
* @example
* if ( CKEDITOR.env.secure )
* alert( "I'm in SSL!" );
*/
secure : location.protocol == 'https:'
};
/**
* Indicates that CKEditor is running on a Gecko based browser, like
* Firefox.
* @name CKEDITOR.env.gecko
* @type Boolean
* @example
* if ( CKEDITOR.env.gecko )
* alert( "I'm riding a gecko!" );
*/
env.gecko = ( navigator.product == 'Gecko' && !env.webkit && !env.opera );
var version = 0;
// Internet Explorer 6.0+
if ( env.ie )
{
version = parseFloat( agent.match( /msie (\d+)/ )[1] );
/**
* Indicates that CKEditor is running on Internet Explorer 8.
* @name CKEDITOR.env.ie8
* @type Boolean
* @example
* if ( CKEDITOR.env.ie8 )
* alert( "I'm on IE8!" );
*/
env.ie8 = !!document.documentMode;
/**
* Indicates that CKEditor is running on Internet Explorer 8 on
* standards mode.
* @name CKEDITOR.env.ie8Compat
* @type Boolean
* @example
* if ( CKEDITOR.env.ie8Compat )
* alert( "Now I'm on IE8, for real!" );
*/
env.ie8Compat = document.documentMode == 8;
/**
* Indicates that CKEditor is running on Internet Explorer 9's standards mode.
* @name CKEDITOR.env.ie9Compat
* @type Boolean
* @example
* if ( CKEDITOR.env.ie9Compat )
* alert( "IE9, the beauty of the web!" );
*/
env.ie9Compat = document.documentMode == 9;
/**
* Indicates that CKEditor is running on an IE7-like environment, which
* includes IE7 itself and IE8's IE7 document mode.
* @name CKEDITOR.env.ie7Compat
* @type Boolean
* @example
* if ( CKEDITOR.env.ie8Compat )
* alert( "I'm on IE7 or on an IE7 like IE8!" );
*/
env.ie7Compat = ( ( version == 7 && !document.documentMode )
|| document.documentMode == 7 );
/**
* Indicates that CKEditor is running on an IE6-like environment, which
* includes IE6 itself and IE7 and IE8 quirks mode.
* @name CKEDITOR.env.ie6Compat
* @type Boolean
* @example
* if ( CKEDITOR.env.ie6Compat )
* alert( "I'm on IE6 or quirks mode!" );
*/
env.ie6Compat = ( version < 7 || env.quirks );
}
// Gecko.
if ( env.gecko )
{
var geckoRelease = agent.match( /rv:([\d\.]+)/ );
if ( geckoRelease )
{
geckoRelease = geckoRelease[1].split( '.' );
version = geckoRelease[0] * 10000 + ( geckoRelease[1] || 0 ) * 100 + ( geckoRelease[2] || 0 ) * 1;
}
}
// Opera 9.50+
if ( env.opera )
version = parseFloat( opera.version() );
// Adobe AIR 1.0+
// Checked before Safari because AIR have the WebKit rich text editor
// features from Safari 3.0.4, but the version reported is 420.
if ( env.air )
version = parseFloat( agent.match( / adobeair\/(\d+)/ )[1] );
// WebKit 522+ (Safari 3+)
if ( env.webkit )
version = parseFloat( agent.match( / applewebkit\/(\d+)/ )[1] );
/**
* Contains the browser version.<br />
* <br />
* For gecko based browsers (like Firefox) it contains the revision
* number with first three parts concatenated with a padding zero
* (e.g. for revision 1.9.0.2 we have 10900).<br />
* <br />
* For webkit based browser (like Safari and Chrome) it contains the
* WebKit build version (e.g. 522).
* @name CKEDITOR.env.version
* @type Boolean
* @example
* if ( CKEDITOR.env.ie && <b>CKEDITOR.env.version</b> <= 6 )
* alert( "Ouch!" );
*/
env.version = version;
/**
* Indicates that CKEditor is running on a compatible browser.
* @name CKEDITOR.env.isCompatible
* @type Boolean
* @example
* if ( CKEDITOR.env.isCompatible )
* alert( "Your browser is pretty cool!" );
*/
env.isCompatible =
// White list of mobile devices that supports.
env.iOS && version >= 534 ||
!env.mobile && (
( env.ie && version >= 6 ) ||
( env.gecko && version >= 10801 ) ||
( env.opera && version >= 9.5 ) ||
( env.air && version >= 1 ) ||
( env.webkit && version >= 522 ) ||
false );
/**
* The CSS class to be appended on the main UI containers, making it
* easy to apply browser specific styles to it.
* @name CKEDITOR.env.cssClass
* @type String
* @example
* myDiv.className = CKEDITOR.env.cssClass;
*/
env.cssClass =
'cke_browser_' + (
env.ie ? 'ie' :
env.gecko ? 'gecko' :
env.opera ? 'opera' :
env.webkit ? 'webkit' :
'unknown' );
if ( env.quirks )
env.cssClass += ' cke_browser_quirks';
if ( env.ie )
{
env.cssClass += ' cke_browser_ie' + (
env.version < 7 ? '6' :
env.version >= 8 ? document.documentMode:
'7' );
if ( env.quirks )
env.cssClass += ' cke_browser_iequirks';
}
if ( env.gecko && version < 10900 )
env.cssClass += ' cke_browser_gecko18';
if ( env.air )
env.cssClass += ' cke_browser_air';
return env;
})();
}
// PACKAGER_RENAME( CKEDITOR.env )
// PACKAGER_RENAME( CKEDITOR.env.ie )
This diff is collapsed.
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the "virtual" {@link CKEDITOR.eventInfo} class, which
* contains the defintions of the event object passed to event listeners.
* This file is for documentation purposes only.
*/
/**
* (Virtual Class) Do not call this constructor. This class is not really part
* of the API.
* @class Virtual class that illustrates the features of the event object to be
* passed to event listeners by a {@link CKEDITOR.event} based object.
* @name CKEDITOR.eventInfo
* @example
* // Do not do this.
* var myEvent = new CKEDITOR.eventInfo(); // Error: CKEDITOR.eventInfo is undefined
*/
/**
* The event name.
* @name CKEDITOR.eventInfo.prototype.name
* @field
* @type String
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( <b>event.name</b> ); // "someEvent"
* });
* someObject.fire( 'someEvent' );
*/
/**
* The object that publishes (sends) the event.
* @name CKEDITOR.eventInfo.prototype.sender
* @field
* @type Object
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( <b>event.sender</b> == someObject ); // "true"
* });
* someObject.fire( 'someEvent' );
*/
/**
* The editor instance that holds the sender. May be the same as sender. May be
* null if the sender is not part of an editor instance, like a component
* running in standalone mode.
* @name CKEDITOR.eventInfo.prototype.editor
* @field
* @type CKEDITOR.editor
* @example
* myButton.on( 'someEvent', function( event )
* {
* alert( <b>event.editor</b> == myEditor ); // "true"
* });
* myButton.fire( 'someEvent', null, <b>myEditor</b> );
*/
/**
* Any kind of additional data. Its format and usage is event dependent.
* @name CKEDITOR.eventInfo.prototype.data
* @field
* @type Object
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( <b>event.data</b> ); // "Example"
* });
* someObject.fire( 'someEvent', <b>'Example'</b> );
*/
/**
* Any extra data appended during the listener registration.
* @name CKEDITOR.eventInfo.prototype.listenerData
* @field
* @type Object
* @example
* someObject.on( 'someEvent', function( event )
* {
* alert( <b>event.listenerData</b> ); // "Example"
* }
* , null, <b>'Example'</b> );
*/
/**
* Indicates that no further listeners are to be called.
* @name CKEDITOR.eventInfo.prototype.stop
* @function
* @example
* someObject.on( 'someEvent', function( event )
* {
* <b>event.stop()</b>;
* });
* someObject.on( 'someEvent', function( event )
* {
* // This one will not be called.
* });
* alert( someObject.fire( 'someEvent' ) ); // "false"
*/
/**
* Indicates that the event is to be cancelled (if cancelable).
* @name CKEDITOR.eventInfo.prototype.cancel
* @function
* @example
* someObject.on( 'someEvent', function( event )
* {
* <b>event.cancel()</b>;
* });
* someObject.on( 'someEvent', function( event )
* {
* // This one will not be called.
* });
* alert( someObject.fire( 'someEvent' ) ); // "true"
*/
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.focusManager} class, which is used
* to handle the focus on editor instances..
*/
/**
* Creates a focusManager class instance.
* @class Manages the focus activity in an editor instance. This class is to be
* used mainly by UI elements coders when adding interface elements that need
* to set the focus state of the editor.
* @param {CKEDITOR.editor} editor The editor instance.
* @example
* var focusManager = <b>new CKEDITOR.focusManager( editor )</b>;
* focusManager.focus();
*/
CKEDITOR.focusManager = function( editor )
{
if ( editor.focusManager )
return editor.focusManager;
/**
* Indicates that the editor instance has focus.
* @type Boolean
* @example
* alert( CKEDITOR.instances.editor1.focusManager.hasFocus ); // e.g "true"
*/
this.hasFocus = false;
/**
* Object used to hold private stuff.
* @private
*/
this._ =
{
editor : editor
};
return this;
};
CKEDITOR.focusManager.prototype =
{
/**
* Used to indicate that the editor instance has the focus.<br />
* <br />
* Note that this function will not explicitelly set the focus in the
* editor (for example, making the caret blinking on it). Use
* {@link CKEDITOR.editor#focus} for it instead.
* @example
* var editor = CKEDITOR.instances.editor1;
* <b>editor.focusManager.focus()</b>;
*/
focus : function()
{
if ( this._.timer )
clearTimeout( this._.timer );
if ( !this.hasFocus )
{
// If another editor has the current focus, we first "blur" it. In
// this way the events happen in a more logical sequence, like:
// "focus 1" > "blur 1" > "focus 2"
// ... instead of:
// "focus 1" > "focus 2" > "blur 1"
if ( CKEDITOR.currentInstance )
CKEDITOR.currentInstance.focusManager.forceBlur();
var editor = this._.editor;
editor.container.getChild( 1 ).addClass( 'cke_focus' );
this.hasFocus = true;
editor.fire( 'focus' );
}
},
/**
* Used to indicate that the editor instance has lost the focus.<br />
* <br />
* Note that this functions acts asynchronously with a delay of 100ms to
* avoid subsequent blur/focus effects. If you want the "blur" to happen
* immediately, use the {@link #forceBlur} function instead.
* @example
* var editor = CKEDITOR.instances.editor1;
* <b>editor.focusManager.blur()</b>;
*/
blur : function()
{
var focusManager = this;
if ( focusManager._.timer )
clearTimeout( focusManager._.timer );
focusManager._.timer = setTimeout(
function()
{
delete focusManager._.timer;
focusManager.forceBlur();
}
, 100 );
},
/**
* Used to indicate that the editor instance has lost the focus. Unlike
* {@link #blur}, this function is synchronous, marking the instance as
* "blured" immediately.
* @example
* var editor = CKEDITOR.instances.editor1;
* <b>editor.focusManager.forceBlur()</b>;
*/
forceBlur : function()
{
if ( this.hasFocus )
{
var editor = this._.editor;
editor.container.getChild( 1 ).removeClass( 'cke_focus' );
this.hasFocus = false;
editor.fire( 'blur' );
}
}
};
/**
* Fired when the editor instance receives the input focus.
* @name CKEDITOR.editor#focus
* @event
* @param {CKEDITOR.editor} editor The editor instance.
* @example
* editor.on( 'focus', function( e )
* {
* alert( 'The editor named ' + e.editor.name + ' is now focused' );
* });
*/
/**
* Fired when the editor instance loses the input focus.
* @name CKEDITOR.editor#blur
* @event
* @param {CKEDITOR.editor} editor The editor instance.
* @example
* editor.on( 'blur', function( e )
* {
* alert( 'The editor named ' + e.editor.name + ' lost the focus' );
* });
*/
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* Creates a {@link CKEDITOR.htmlParser} class instance.
* @class Provides an "event like" system to parse strings of HTML data.
* @example
* var parser = new CKEDITOR.htmlParser();
* parser.onTagOpen = function( tagName, attributes, selfClosing )
* {
* alert( tagName );
* };
* parser.parse( '&lt;p&gt;Some &lt;b&gt;text&lt;/b&gt;.&lt;/p&gt;' );
*/
CKEDITOR.htmlParser = function()
{
this._ =
{
htmlPartsRegex : new RegExp( '<(?:(?:\\/([^>]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:"[^"]*")|(?:\'[^\']*\')|[^"\'>])*)\\/?>))', 'g' )
};
};
(function()
{
var attribsRegex = /([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,
emptyAttribs = {checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1};
CKEDITOR.htmlParser.prototype =
{
/**
* Function to be fired when a tag opener is found. This function
* should be overriden when using this class.
* @param {String} tagName The tag name. The name is guarantted to be
* lowercased.
* @param {Object} attributes An object containing all tag attributes. Each
* property in this object represent and attribute name and its
* value is the attribute value.
* @param {Boolean} selfClosing true if the tag closes itself, false if the
* tag doesn't.
* @example
* var parser = new CKEDITOR.htmlParser();
* parser.onTagOpen = function( tagName, attributes, selfClosing )
* {
* alert( tagName ); // e.g. "b"
* });
* parser.parse( "&lt;!-- Example --&gt;&lt;b&gt;Hello&lt;/b&gt;" );
*/
onTagOpen : function() {},
/**
* Function to be fired when a tag closer is found. This function
* should be overriden when using this class.
* @param {String} tagName The tag name. The name is guarantted to be
* lowercased.
* @example
* var parser = new CKEDITOR.htmlParser();
* parser.onTagClose = function( tagName )
* {
* alert( tagName ); // e.g. "b"
* });
* parser.parse( "&lt;!-- Example --&gt;&lt;b&gt;Hello&lt;/b&gt;" );
*/
onTagClose : function() {},
/**
* Function to be fired when text is found. This function
* should be overriden when using this class.
* @param {String} text The text found.
* @example
* var parser = new CKEDITOR.htmlParser();
* parser.onText = function( text )
* {
* alert( text ); // e.g. "Hello"
* });
* parser.parse( "&lt;!-- Example --&gt;&lt;b&gt;Hello&lt;/b&gt;" );
*/
onText : function() {},
/**
* Function to be fired when CDATA section is found. This function
* should be overriden when using this class.
* @param {String} cdata The CDATA been found.
* @example
* var parser = new CKEDITOR.htmlParser();
* parser.onCDATA = function( cdata )
* {
* alert( cdata ); // e.g. "var hello;"
* });
* parser.parse( "&lt;script&gt;var hello;&lt;/script&gt;" );
*/
onCDATA : function() {},
/**
* Function to be fired when a commend is found. This function
* should be overriden when using this class.
* @param {String} comment The comment text.
* @example
* var parser = new CKEDITOR.htmlParser();
* parser.onComment = function( comment )
* {
* alert( comment ); // e.g. " Example "
* });
* parser.parse( "&lt;!-- Example --&gt;&lt;b&gt;Hello&lt;/b&gt;" );
*/
onComment : function() {},
/**
* Parses text, looking for HTML tokens, like tag openers or closers,
* or comments. This function fires the onTagOpen, onTagClose, onText
* and onComment function during its execution.
* @param {String} html The HTML to be parsed.
* @example
* var parser = new CKEDITOR.htmlParser();
* // The onTagOpen, onTagClose, onText and onComment should be overriden
* // at this point.
* parser.parse( "&lt;!-- Example --&gt;&lt;b&gt;Hello&lt;/b&gt;" );
*/
parse : function( html )
{
var parts,
tagName,
nextIndex = 0,
cdata; // The collected data inside a CDATA section.
while ( ( parts = this._.htmlPartsRegex.exec( html ) ) )
{
var tagIndex = parts.index;
if ( tagIndex > nextIndex )
{
var text = html.substring( nextIndex, tagIndex );
if ( cdata )
cdata.push( text );
else
this.onText( text );
}
nextIndex = this._.htmlPartsRegex.lastIndex;
/*
"parts" is an array with the following items:
0 : The entire match for opening/closing tags and comments.
1 : Group filled with the tag name for closing tags.
2 : Group filled with the comment text.
3 : Group filled with the tag name for opening tags.
4 : Group filled with the attributes part of opening tags.
*/
// Closing tag
if ( ( tagName = parts[ 1 ] ) )
{
tagName = tagName.toLowerCase();
if ( cdata && CKEDITOR.dtd.$cdata[ tagName ] )
{
// Send the CDATA data.
this.onCDATA( cdata.join('') );
cdata = null;
}
if ( !cdata )
{
this.onTagClose( tagName );
continue;
}
}
// If CDATA is enabled, just save the raw match.
if ( cdata )
{
cdata.push( parts[ 0 ] );
continue;
}
// Opening tag
if ( ( tagName = parts[ 3 ] ) )
{
tagName = tagName.toLowerCase();
// There are some tag names that can break things, so let's
// simply ignore them when parsing. (#5224)
if ( /="/.test( tagName ) )
continue;
var attribs = {},
attribMatch,
attribsPart = parts[ 4 ],
selfClosing = !!( attribsPart && attribsPart.charAt( attribsPart.length - 1 ) == '/' );
if ( attribsPart )
{
while ( ( attribMatch = attribsRegex.exec( attribsPart ) ) )
{
var attName = attribMatch[1].toLowerCase(),
attValue = attribMatch[2] || attribMatch[3] || attribMatch[4] || '';
if ( !attValue && emptyAttribs[ attName ] )
attribs[ attName ] = attName;
else
attribs[ attName ] = attValue;
}
}
this.onTagOpen( tagName, attribs, selfClosing );
// Open CDATA mode when finding the appropriate tags.
if ( !cdata && CKEDITOR.dtd.$cdata[ tagName ] )
cdata = [];
continue;
}
// Comment
if ( ( tagName = parts[ 2 ] ) )
this.onComment( tagName );
}
if ( html.length > nextIndex )
this.onText( html.substring( nextIndex, html.length ) );
}
};
})();
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
(function()
{
var loadedLangs = {};
/**
* @namespace Holds language related functions.
*/
CKEDITOR.lang =
{
/**
* The list of languages available in the editor core.
* @type Object
* @example
* alert( CKEDITOR.lang.en ); // "true"
*/
languages :
{
'af' : 1,
'ar' : 1,
'bg' : 1,
'bn' : 1,
'bs' : 1,
'ca' : 1,
'cs' : 1,
'cy' : 1,
'da' : 1,
'de' : 1,
'el' : 1,
'en-au' : 1,
'en-ca' : 1,
'en-gb' : 1,
'en' : 1,
'eo' : 1,
'es' : 1,
'et' : 1,
'eu' : 1,
'fa' : 1,
'fi' : 1,
'fo' : 1,
'fr-ca' : 1,
'fr' : 1,
'gl' : 1,
'gu' : 1,
'he' : 1,
'hi' : 1,
'hr' : 1,
'hu' : 1,
'is' : 1,
'it' : 1,
'ja' : 1,
'ka' : 1,
'km' : 1,
'ko' : 1,
'lt' : 1,
'lv' : 1,
'mn' : 1,
'ms' : 1,
'nb' : 1,
'nl' : 1,
'no' : 1,
'pl' : 1,
'pt-br' : 1,
'pt' : 1,
'ro' : 1,
'ru' : 1,
'sk' : 1,
'sl' : 1,
'sr-latn' : 1,
'sr' : 1,
'sv' : 1,
'th' : 1,
'tr' : 1,
'uk' : 1,
'vi' : 1,
'zh-cn' : 1,
'zh' : 1
},
/**
* Loads a specific language file, or auto detect it. A callback is
* then called when the file gets loaded.
* @param {String} languageCode The code of the language file to be
* loaded. If null or empty, autodetection will be performed. The
* same happens if the language is not supported.
* @param {String} defaultLanguage The language to be used if
* languageCode is not supported or if the autodetection fails.
* @param {Function} callback A function to be called once the
* language file is loaded. Two parameters are passed to this
* function: the language code and the loaded language entries.
* @example
*/
load : function( languageCode, defaultLanguage, callback )
{
// If no languageCode - fallback to browser or default.
// If languageCode - fallback to no-localized version or default.
if ( !languageCode || !CKEDITOR.lang.languages[ languageCode ] )
languageCode = this.detect( defaultLanguage, languageCode );
if ( !this[ languageCode ] )
{
CKEDITOR.scriptLoader.load( CKEDITOR.getUrl(
'_source/' + // @Packager.RemoveLine
'lang/' + languageCode + '.js' ),
function()
{
callback( languageCode, this[ languageCode ] );
}
, this );
}
else
callback( languageCode, this[ languageCode ] );
},
/**
* Returns the language that best fit the user language. For example,
* suppose that the user language is "pt-br". If this language is
* supported by the editor, it is returned. Otherwise, if only "pt" is
* supported, it is returned instead. If none of the previous are
* supported, a default language is then returned.
* @param {String} defaultLanguage The default language to be returned
* if the user language is not supported.
* @param {String} [probeLanguage] A language code to try to use,
* instead of the browser based autodetection.
* @returns {String} The detected language code.
* @example
* alert( CKEDITOR.lang.detect( 'en' ) ); // e.g., in a German browser: "de"
*/
detect : function( defaultLanguage, probeLanguage )
{
var languages = this.languages;
probeLanguage = probeLanguage || navigator.userLanguage || navigator.language || defaultLanguage;
var parts = probeLanguage
.toLowerCase()
.match( /([a-z]+)(?:-([a-z]+))?/ ),
lang = parts[1],
locale = parts[2];
if ( languages[ lang + '-' + locale ] )
lang = lang + '-' + locale;
else if ( !languages[ lang ] )
lang = null;
CKEDITOR.lang.detect = lang ?
function() { return lang; } :
function( defaultLanguage ) { return defaultLanguage; };
return lang || defaultLanguage;
}
};
})();
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.loader} objects, which is used to
* load core scripts and their dependencies from _source.
*/
if ( typeof CKEDITOR == 'undefined' )
CKEDITOR = {};
if ( !CKEDITOR.loader )
{
/**
* Load core scripts and their dependencies from _source.
* @namespace
* @example
*/
CKEDITOR.loader = (function()
{
// Table of script names and their dependencies.
var scripts =
{
'core/_bootstrap' : [ 'core/config', 'core/ckeditor', 'core/plugins', 'core/scriptloader', 'core/tools', /* The following are entries that we want to force loading at the end to avoid dependence recursion */ 'core/dom/comment', 'core/dom/elementpath', 'core/dom/text', 'core/dom/rangelist' ],
'core/ckeditor' : [ 'core/ckeditor_basic', 'core/dom', 'core/dtd', 'core/dom/document', 'core/dom/element', 'core/editor', 'core/event', 'core/htmlparser', 'core/htmlparser/element', 'core/htmlparser/fragment', 'core/htmlparser/filter', 'core/htmlparser/basicwriter', 'core/tools' ],
'core/ckeditor_base' : [],
'core/ckeditor_basic' : [ 'core/editor_basic', 'core/env', 'core/event' ],
'core/command' : [],
'core/config' : [ 'core/ckeditor_base' ],
'core/dom' : [],
'core/dom/comment' : [ 'core/dom/node' ],
'core/dom/document' : [ 'core/dom', 'core/dom/domobject', 'core/dom/window' ],
'core/dom/documentfragment' : [ 'core/dom/element' ],
'core/dom/element' : [ 'core/dom', 'core/dom/document', 'core/dom/domobject', 'core/dom/node', 'core/dom/nodelist', 'core/tools' ],
'core/dom/elementpath' : [ 'core/dom/element' ],
'core/dom/event' : [],
'core/dom/node' : [ 'core/dom/domobject', 'core/tools' ],
'core/dom/nodelist' : [ 'core/dom/node' ],
'core/dom/domobject' : [ 'core/dom/event' ],
'core/dom/range' : [ 'core/dom/document', 'core/dom/documentfragment', 'core/dom/element', 'core/dom/walker' ],
'core/dom/rangelist' : [ 'core/dom/range' ],
'core/dom/text' : [ 'core/dom/node', 'core/dom/domobject' ],
'core/dom/walker' : [ 'core/dom/node' ],
'core/dom/window' : [ 'core/dom/domobject' ],
'core/dtd' : [ 'core/tools' ],
'core/editor' : [ 'core/command', 'core/config', 'core/editor_basic', 'core/focusmanager', 'core/lang', 'core/plugins', 'core/skins', 'core/themes', 'core/tools', 'core/ui' ],
'core/editor_basic' : [ 'core/event' ],
'core/env' : [],
'core/event' : [],
'core/focusmanager' : [],
'core/htmlparser' : [],
'core/htmlparser/comment' : [ 'core/htmlparser' ],
'core/htmlparser/element' : [ 'core/htmlparser', 'core/htmlparser/fragment' ],
'core/htmlparser/fragment' : [ 'core/htmlparser', 'core/htmlparser/comment', 'core/htmlparser/text', 'core/htmlparser/cdata' ],
'core/htmlparser/text' : [ 'core/htmlparser' ],
'core/htmlparser/cdata' : [ 'core/htmlparser' ],
'core/htmlparser/filter' : [ 'core/htmlparser' ],
'core/htmlparser/basicwriter': [ 'core/htmlparser' ],
'core/lang' : [],
'core/plugins' : [ 'core/resourcemanager' ],
'core/resourcemanager' : [ 'core/scriptloader', 'core/tools' ],
'core/scriptloader' : [ 'core/dom/element', 'core/env' ],
'core/skins' : [ 'core/scriptloader' ],
'core/themes' : [ 'core/resourcemanager' ],
'core/tools' : [ 'core/env' ],
'core/ui' : []
};
var basePath = (function()
{
// This is a copy of CKEDITOR.basePath, but requires the script having
// "_source/core/loader.js".
if ( CKEDITOR && CKEDITOR.basePath )
return CKEDITOR.basePath;
// Find out the editor directory path, based on its <script> tag.
var path = '';
var scripts = document.getElementsByTagName( 'script' );
for ( var i = 0 ; i < scripts.length ; i++ )
{
var match = scripts[i].src.match( /(^|.*?[\\\/])(?:_source\/)?core\/loader.js(?:\?.*)?$/i );
if ( match )
{
path = match[1];
break;
}
}
// In IE (only) the script.src string is the raw valued entered in the
// HTML. Other browsers return the full resolved URL instead.
if ( path.indexOf('://') == -1 )
{
// Absolute path.
if ( path.indexOf( '/' ) === 0 )
path = location.href.match( /^.*?:\/\/[^\/]*/ )[0] + path;
// Relative path.
else
path = location.href.match( /^[^\?]*\// )[0] + path;
}
return path;
})();
var timestamp = 'B8DJ5M3';
var getUrl = function( resource )
{
if ( CKEDITOR && CKEDITOR.getUrl )
return CKEDITOR.getUrl( resource );
return basePath + resource +
( resource.indexOf( '?' ) >= 0 ? '&' : '?' ) +
't=' + timestamp;
};
var pendingLoad = [];
/** @lends CKEDITOR.loader */
return {
/**
* The list of loaded scripts in their loading order.
* @type Array
* @example
* // Alert the loaded script names.
* alert( <b>CKEDITOR.loader.loadedScripts</b> );
*/
loadedScripts : [],
loadPending : function()
{
var scriptName = pendingLoad.shift();
if ( !scriptName )
return;
var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
var script = document.createElement( 'script' );
script.type = 'text/javascript';
script.src = scriptSrc;
function onScriptLoaded()
{
// Append this script to the list of loaded scripts.
CKEDITOR.loader.loadedScripts.push( scriptName );
// Load the next.
CKEDITOR.loader.loadPending();
}
// We must guarantee the execution order of the scripts, so we
// need to load them one by one. (#4145)
// The following if/else block has been taken from the scriptloader core code.
if ( typeof(script.onreadystatechange) !== "undefined" )
{
/** @ignore */
script.onreadystatechange = function()
{
if ( script.readyState == 'loaded' || script.readyState == 'complete' )
{
script.onreadystatechange = null;
onScriptLoaded();
}
};
}
else
{
/** @ignore */
script.onload = function()
{
// Some browsers, such as Safari, may call the onLoad function
// immediately. Which will break the loading sequence. (#3661)
setTimeout( function() { onScriptLoaded( scriptName ); }, 0 );
};
}
document.body.appendChild( script );
},
/**
* Loads a specific script, including its dependencies. This is not a
* synchronous loading, which means that the code to be loaded will
* not necessarily be available after this call.
* @example
* CKEDITOR.loader.load( 'core/dom/element' );
*/
load : function( scriptName, defer )
{
// Check if the script has already been loaded.
if ( scriptName in this.loadedScripts )
return;
// Get the script dependencies list.
var dependencies = scripts[ scriptName ];
if ( !dependencies )
throw 'The script name"' + scriptName + '" is not defined.';
// Mark the script as loaded, even before really loading it, to
// avoid cross references recursion.
this.loadedScripts[ scriptName ] = true;
// Load all dependencies first.
for ( var i = 0 ; i < dependencies.length ; i++ )
this.load( dependencies[ i ], true );
var scriptSrc = getUrl( '_source/' + scriptName + '.js' );
// Append the <script> element to the DOM.
// If the page is fully loaded, we can't use document.write
// but if the script is run while the body is loading then it's safe to use it
// Unfortunately, Firefox <3.6 doesn't support document.readyState, so it won't get this improvement
if ( document.body && (!document.readyState || document.readyState == 'complete') )
{
pendingLoad.push( scriptName );
if ( !defer )
this.loadPending();
}
else
{
// Append this script to the list of loaded scripts.
this.loadedScripts.push( scriptName );
document.write( '<script src="' + scriptSrc + '" type="text/javascript"><\/script>' );
}
}
};
})();
}
// Check if any script has been defined for autoload.
if ( CKEDITOR._autoLoad )
{
CKEDITOR.loader.load( CKEDITOR._autoLoad );
delete CKEDITOR._autoLoad;
}
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the "virtual" {@link CKEDITOR.pluginDefinition} class, which
* contains the defintion of a plugin. This file is for documentation
* purposes only.
*/
/**
* (Virtual Class) Do not call this constructor. This class is not really part
* of the API. It just illustrates the features of plugin objects to be
* passed to the {@link CKEDITOR.plugins.add} function.
* @name CKEDITOR.pluginDefinition
* @constructor
* @example
*/
/**
* A list of plugins that are required by this plugin. Note that this property
* doesn't guarantee the loading order of the plugins.
* @name CKEDITOR.pluginDefinition.prototype.requires
* @type Array
* @example
* CKEDITOR.plugins.add( 'sample',
* {
* requires : [ 'button', 'selection' ]
* });
*/
/**
* A list of language files available for this plugin. These files are stored inside
* the "lang" directory, which is inside the plugin directory, follow the name
* pattern of "langCode.js", and contain a language definition created with {@link CKEDITOR.pluginDefinition#setLang}.
* While the plugin is being loaded, the editor checks this list to see if
* a language file of the current editor language ({@link CKEDITOR.editor#langCode})
* is available, and if so, loads it. Otherwise, the file represented by the first list item
* in the list is loaded.
* @name CKEDITOR.pluginDefinition.prototype.lang
* @type Array
* @example
* CKEDITOR.plugins.add( 'sample',
* {
* lang : [ 'en', 'fr' ]
* });
*/
/**
* Function called on initialization of every editor instance created in the
* page before the init() call task. The beforeInit function will be called for
* all plugins, after that the init function is called for all of them. This
* feature makes it possible to initialize things that could be used in the
* init function of other plugins.
* @name CKEDITOR.pluginDefinition.prototype.beforeInit
* @function
* @param {CKEDITOR.editor} editor The editor instance being initialized.
* @example
* CKEDITOR.plugins.add( 'sample',
* {
* beforeInit : function( editor )
* {
* alert( 'Editor "' + editor.name + '" is to be initialized!' );
* }
* });
*/
/**
* Function called on initialization of every editor instance created in the
* page.
* @name CKEDITOR.pluginDefinition.prototype.init
* @function
* @param {CKEDITOR.editor} editor The editor instance being initialized.
* @example
* CKEDITOR.plugins.add( 'sample',
* {
* init : function( editor )
* {
* alert( 'Editor "' + editor.name + '" is being initialized!' );
* }
* });
*/
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.plugins} object, which is used to
* manage plugins registration and loading.
*/
/**
* Manages plugins registration and loading.
* @namespace
* @augments CKEDITOR.resourceManager
* @example
*/
CKEDITOR.plugins = new CKEDITOR.resourceManager(
'_source/' + // @Packager.RemoveLine
'plugins/', 'plugin' );
// PACKAGER_RENAME( CKEDITOR.plugins )
CKEDITOR.plugins.load = CKEDITOR.tools.override( CKEDITOR.plugins.load, function( originalLoad )
{
return function( name, callback, scope )
{
var allPlugins = {};
var loadPlugins = function( names )
{
originalLoad.call( this, names, function( plugins )
{
CKEDITOR.tools.extend( allPlugins, plugins );
var requiredPlugins = [];
for ( var pluginName in plugins )
{
var plugin = plugins[ pluginName ],
requires = plugin && plugin.requires;
if ( requires )
{
for ( var i = 0 ; i < requires.length ; i++ )
{
if ( !allPlugins[ requires[ i ] ] )
requiredPlugins.push( requires[ i ] );
}
}
}
if ( requiredPlugins.length )
loadPlugins.call( this, requiredPlugins );
else
{
// Call the "onLoad" function for all plugins.
for ( pluginName in allPlugins )
{
plugin = allPlugins[ pluginName ];
if ( plugin.onLoad && !plugin.onLoad._called )
{
plugin.onLoad();
plugin.onLoad._called = 1;
}
}
// Call the callback.
if ( callback )
callback.call( scope || window, allPlugins );
}
}
, this);
};
loadPlugins.call( this, name );
};
});
/**
* Loads a specific language file, or auto detect it. A callback is
* then called when the file gets loaded.
* @param {String} pluginName The name of the plugin to which the provided translation
* should be attached.
* @param {String} languageCode The code of the language translation provided.
* @param {Object} languageEntries An object that contains pairs of label and
* the respective translation.
* @example
* CKEDITOR.plugins.setLang( 'myPlugin', 'en', {
* title : 'My plugin',
* selectOption : 'Please select an option'
* } );
*/
CKEDITOR.plugins.setLang = function( pluginName, languageCode, languageEntries )
{
var plugin = this.get( pluginName ),
pluginLangEntries = plugin.langEntries || ( plugin.langEntries = {} ),
pluginLang = plugin.lang || ( plugin.lang = [] );
if ( CKEDITOR.tools.indexOf( pluginLang, languageCode ) == -1 )
pluginLang.push( languageCode );
pluginLangEntries[ languageCode ] = languageEntries;
};
This diff is collapsed.
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.scriptLoader} object, used to load scripts
* asynchronously.
*/
/**
* Load scripts asynchronously.
* @namespace
* @example
*/
CKEDITOR.scriptLoader = (function()
{
var uniqueScripts = {},
waitingList = {};
return /** @lends CKEDITOR.scriptLoader */ {
/**
* Loads one or more external script checking if not already loaded
* previously by this function.
* @param {String|Array} scriptUrl One or more URLs pointing to the
* scripts to be loaded.
* @param {Function} [callback] A function to be called when the script
* is loaded and executed. If a string is passed to "scriptUrl", a
* boolean parameter is passed to the callback, indicating the
* success of the load. If an array is passed instead, two array
* parameters are passed to the callback; the first contains the
* URLs that have been properly loaded, and the second the failed
* ones.
* @param {Object} [scope] The scope ("this" reference) to be used for
* the callback call. Default to {@link CKEDITOR}.
* @param {Boolean} [showBusy] Changes the cursor of the document while
+ * the script is loaded.
* @example
* CKEDITOR.scriptLoader.load( '/myscript.js' );
* @example
* CKEDITOR.scriptLoader.load( '/myscript.js', function( success )
* {
* // Alerts "true" if the script has been properly loaded.
* // HTTP error 404 should return "false".
* alert( success );
* });
* @example
* CKEDITOR.scriptLoader.load( [ '/myscript1.js', '/myscript2.js' ], function( completed, failed )
* {
* alert( 'Number of scripts loaded: ' + completed.length );
* alert( 'Number of failures: ' + failed.length );
* });
*/
load : function( scriptUrl, callback, scope, showBusy )
{
var isString = ( typeof scriptUrl == 'string' );
if ( isString )
scriptUrl = [ scriptUrl ];
if ( !scope )
scope = CKEDITOR;
var scriptCount = scriptUrl.length,
completed = [],
failed = [];
var doCallback = function( success )
{
if ( callback )
{
if ( isString )
callback.call( scope, success );
else
callback.call( scope, completed, failed );
}
};
if ( scriptCount === 0 )
{
doCallback( true );
return;
}
var checkLoaded = function( url, success )
{
( success ? completed : failed ).push( url );
if ( --scriptCount <= 0 )
{
showBusy && CKEDITOR.document.getDocumentElement().removeStyle( 'cursor' );
doCallback( success );
}
};
var onLoad = function( url, success )
{
// Mark this script as loaded.
uniqueScripts[ url ] = 1;
// Get the list of callback checks waiting for this file.
var waitingInfo = waitingList[ url ];
delete waitingList[ url ];
// Check all callbacks waiting for this file.
for ( var i = 0 ; i < waitingInfo.length ; i++ )
waitingInfo[ i ]( url, success );
};
var loadScript = function( url )
{
if ( uniqueScripts[ url ] )
{
checkLoaded( url, true );
return;
}
var waitingInfo = waitingList[ url ] || ( waitingList[ url ] = [] );
waitingInfo.push( checkLoaded );
// Load it only for the first request.
if ( waitingInfo.length > 1 )
return;
// Create the <script> element.
var script = new CKEDITOR.dom.element( 'script' );
script.setAttributes( {
type : 'text/javascript',
src : url } );
if ( callback )
{
if ( CKEDITOR.env.ie )
{
// FIXME: For IE, we are not able to return false on error (like 404).
/** @ignore */
script.$.onreadystatechange = function ()
{
if ( script.$.readyState == 'loaded' || script.$.readyState == 'complete' )
{
script.$.onreadystatechange = null;
onLoad( url, true );
}
};
}
else
{
/** @ignore */
script.$.onload = function()
{
// Some browsers, such as Safari, may call the onLoad function
// immediately. Which will break the loading sequence. (#3661)
setTimeout( function() { onLoad( url, true ); }, 0 );
};
// FIXME: Opera and Safari will not fire onerror.
/** @ignore */
script.$.onerror = function()
{
onLoad( url, false );
};
}
}
// Append it to <head>.
script.appendTo( CKEDITOR.document.getHead() );
CKEDITOR.fire( 'download', url ); // @Packager.RemoveLine
};
showBusy && CKEDITOR.document.getDocumentElement().setStyle( 'cursor', 'wait' );
for ( var i = 0 ; i < scriptCount ; i++ )
{
loadScript( scriptUrl[ i ] );
}
}
};
})();
This diff is collapsed.
/*
Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
/**
* @fileOverview Defines the {@link CKEDITOR.themes} object, which is used to
* manage themes registration and loading.
*/
/**
* Manages themes registration and loading.
* @namespace
* @augments CKEDITOR.resourceManager
* @example
*/
CKEDITOR.themes = new CKEDITOR.resourceManager(
'_source/'+ // @Packager.RemoveLine
'themes/', 'theme' );
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment