Skip to content

Commit

Permalink
Docs reformatted: config.js, ckeditor.js, ckeditor_base.js, bootstrap…
Browse files Browse the repository at this point in the history
….js, commanddefinition.js, command.js.
  • Loading branch information
Reinmar committed Aug 20, 2012
1 parent 75ef60e commit 9cbe464
Show file tree
Hide file tree
Showing 9 changed files with 389 additions and 439 deletions.
19 changes: 10 additions & 9 deletions ckeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ else {
/**
* The skin to load for all created instances, it may be the name of the skin
* folder inside the editor installation path, or the name and the path separated
* by a comma.<br>
* <br>
* <strong>Note:</strong> This is a global configuration that applies to all instances.
* @name CKEDITOR.skinName
* @type String
* @example
* CKEDITOR.skinName = 'kama';
* @example
* CKEDITOR.skinName = 'myskin,/customstuff/myskin/';
* by a comma.
*
* **Note:** This is a global configuration that applies to all instances.
*
* CKEDITOR.skinName = 'kama';
*
* CKEDITOR.skinName = 'myskin,/customstuff/myskin/';
*
* @cfg {String} [skinName='kama']
* @member CKEDITOR
*/
CKEDITOR.skinName = 'kama';
2 changes: 1 addition & 1 deletion core/_bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
if ( CKEDITOR.env.hc )
CKEDITOR.env.cssClass += ' cke_hc';

/* Initially hide UI spaces when relevant skins are loading, later restored by skin css. */
// Initially hide UI spaces when relevant skins are loading, later restored by skin css.
CKEDITOR.document.appendStyleText( '.cke{visibility:hidden;}' );

// Mark the editor as fully loaded.
Expand Down
106 changes: 57 additions & 49 deletions core/ckeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,36 @@
* definition.
*/

/** @class CKEDITOR */

// 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"
*
* alert( CKEDITOR.instances.editor1.name ); // 'editor1'
*
* @property {Object}
*/
CKEDITOR.instances = {};

/**
* The document of the window holding the CKEDITOR object.
* @type {CKEDITOR.dom.document}
* @example
* alert( <b>CKEDITOR.document</b>.getBody().getName() ); // "body"
*
* alert( CKEDITOR.document.getBody().getName() ); // 'body'
*
* @property {CKEDITOR.dom.document}
*/
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;
Expand All @@ -57,9 +61,10 @@ CKEDITOR.add = function( editor ) {

/**
* 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}.
* is available for internal use only. External code must use {@link CKEDITOR.editor#destroy}.
*
* @private
* @param {CKEDITOR.editor} editor The editor instance to be removed.
* @example
*/
CKEDITOR.remove = function( editor ) {
delete CKEDITOR.instances[ editor.name ];
Expand All @@ -75,7 +80,7 @@ CKEDITOR.remove = function( editor ) {
*
* @param {String} name The name which identify one UI template.
* @param {String} source The source string for constructing this template.
* @return {CKEDITOR.template} The created template instance.
* @returns {CKEDITOR.template} The created template instance.
*/
CKEDITOR.addTemplate = function( name, source ) {
var tpl = tpls[ name ];
Expand All @@ -91,6 +96,7 @@ CKEDITOR.remove = function( editor ) {

/**
* Retrieve a defined template created with {@link CKEDITOR.addTemplate}.
*
* @param {String} name The template name.
*/
CKEDITOR.getTemplate = function( name ) {
Expand All @@ -105,32 +111,32 @@ CKEDITOR.remove = function( editor ) {
* Append a trunk of css to be appended to the editor document.
* This method is mostly used by plugins to add custom styles to the editor
* document. For basic contents styling the contents.css file should be
* used instead.<br><br>
* <strong>Note:</strong> This function should be called before the
* creation of editor instances.
* used instead.
*
* **Note:** This function should be called before the creation of editor instances.
*
* // Add styles for all headings inside of editable contents.
* CKEDITOR.addCss( '.cke_editable h1,.cke_editable h2,.cke_editable h3 { border-bottom: 1px dotted red }' );
*
* @param {String} css The style rules to be appended.
* @see CKEDITOR.config.contentsCss
* @param css {String} The style rules to be appended.
* @example
* // Add styles for all headings inside of editable contents.
* CKEDITOR.addCss( '.cke_editable h1,.cke_editable h2,.cke_editable h3 { border-bottom: 1px dotted red }' );
*/
CKEDITOR.addCss = function( css ) {
styles.push( css );
};

/**
* Returns a string will all CSS rules passes to the {@link CKEDITOR.addCss} method.
* @return {String} A string containing CSS rules.
* Returns a string will all CSS rules passes to the {@link CKEDITOR#addCss} method.
*
* @returns {String} A string containing CSS rules.
*/
CKEDITOR.getCss = function() {
return styles.join( '\n' );
};
})();

/**
* Perform global clean up to free as much memory as possible
* when there are no instances left
*/
// 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' );
Expand All @@ -142,55 +148,57 @@ CKEDITOR.loader.load( '_bootstrap' ); // %REMOVE_LINE%
// Tri-state constants.
/**
* Used to indicate the ON or ACTIVE state.
* @constant
* @example
*
* @readonly
* @property {Number} [=1]
*/
CKEDITOR.TRISTATE_ON = 1;

/**
* Used to indicate the OFF or NON ACTIVE state.
* @constant
* @example
*
* @readonly
* @property {Number} [=2]
*/
CKEDITOR.TRISTATE_OFF = 2;

/**
* Used to indicate DISABLED state.
* @constant
* @example
*
* @readonly
* @property {Number} [=0]
*/
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.' );
* }
*
* function showCurrentEditorName() {
* if ( CKEDITOR.currentInstance )
* alert( CKEDITOR.currentInstance.name );
* else
* alert( 'Please focus an editor first.' );
* }
*
* @property {CKEDITOR.editor} currentInstance
* @see CKEDITOR#event-currentInstance
*/

/**
* 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;
* });
*
* var editor; // Variable to hold a reference to the current editor.
* CKEDITOR.on( 'currentInstance', function() {
* editor = CKEDITOR.currentInstance;
* } );
*
* @event currentInstance
*/

/**
* Fired when the last instance has been destroyed. This event is used to perform
* global memory clean up.
* @name CKEDITOR#reset
* @event
*
* @event reset
*/
7 changes: 5 additions & 2 deletions core/ckeditor_base.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,17 @@ if ( !window.CKEDITOR ) {
/**
* A 3-digit random integer, valid for the entire life of the CKEDITOR object.
*
* alert( CKEDITOR.rnd ); // e.g. '319'
* alert( CKEDITOR.rnd ); // e.g. 319
*
* @property {Number}
*/
rnd: Math.floor( Math.random() * ( 999 /*Max*/ - 100 /*Min*/ + 1 ) ) + 100 /*Min*/,

/**
* 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
*/
_: {
Expand Down Expand Up @@ -105,7 +108,7 @@ if ( !window.CKEDITOR ) {
* global variable named ```CKEDITOR_BASEPATH```. This global variable
* must be set **before** the editor script loading.
*
* alert( CKEDITOR.basePath ); // "http://www.example.com/ckeditor/" (e.g.)
* alert( CKEDITOR.basePath ); // 'http://www.example.com/ckeditor/' (e.g.)
*
* @property {String}
*/
Expand Down
23 changes: 13 additions & 10 deletions core/ckeditor_basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ if ( CKEDITOR.status == 'unloaded' ) {

/**
* 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
* 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>;
*
* // Check if the full core code has been loaded and load it.
* if ( CKEDITOR.loadFullCore )
* CKEDITOR.loadFullCore();
*
* @member CKEDITOR
*/
CKEDITOR.loadFullCore = function() {
// If the basic code is not ready, just mark it to be loaded.
Expand All @@ -47,11 +49,12 @@ if ( CKEDITOR.status == 'unloaded' ) {
* 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;
*
* // Loads the full source after five seconds.
* CKEDITOR.loadFullCoreTimeout = 5;
*
* @property
* @member CKEDITOR
*/
CKEDITOR.loadFullCoreTimeout = 0;

Expand Down
Loading

0 comments on commit 9cbe464

Please sign in to comment.