JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
58fccf49ed74d72f76d5cece63c042b443bcb54f
[ckeditor.git] / _source / core / commanddefinition.js
1 /*\r
2 Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.\r
3 For licensing, see LICENSE.html or http://ckeditor.com/license\r
4 */\r
5 \r
6 /**\r
7  * @fileOverview Defines the "virtual" {@link CKEDITOR.commandDefinition} class,\r
8  *              which contains the defintion of a command. This file is for\r
9  *              documentation purposes only.\r
10  */\r
11 \r
12 /**\r
13  * (Virtual Class) Do not call this constructor. This class is not really part\r
14  *              of the API. It just illustrates the features of command objects to be\r
15  *              passed to the {@link CKEDITOR.editor.prototype.addCommand} function.\r
16  * @name CKEDITOR.commandDefinition\r
17  * @constructor\r
18  * @example\r
19  */\r
20 \r
21  /**\r
22  * Executes the command.\r
23  * @name CKEDITOR.commandDefinition.prototype.exec\r
24  * @function\r
25  * @param {CKEDITOR.editor} editor The editor within which run the command.\r
26  * @param {Object} [data] Additional data to be used to execute the command.\r
27  * @returns {Boolean} Whether the command has been successfully executed.\r
28  *              Defaults to "true", if nothing is returned.\r
29  * @example\r
30  * editorInstance.addCommand( 'sample',\r
31  * {\r
32  *     exec : function( editor )\r
33  *     {\r
34  *         alert( 'Executing a command for the editor name "' + editor.name + '"!' );\r
35  *     }\r
36  * });\r
37  */\r
38 \r
39 /**\r
40  * Whether the command need to be hooked into the redo/undo system.\r
41  * @name  CKEDITOR.commandDefinition.canUndo\r
42  * @type {Boolean} If not defined or 'true' both hook into undo system, set it\r
43  *              to 'false' explicitly  keep it out.\r
44  * @field\r
45  * @example\r
46  * editorInstance.addCommand( 'alertName',\r
47  * {\r
48  *     exec : function( editor )\r
49  *     {\r
50  *         alert( editor.name );\r
51  *     },\r
52  *     canUndo : false    // No support for undo/redo\r
53  * });\r
54  */\r
55 \r
56 /**\r
57  * Whether the command is asynchronous, which means the 'afterCommandExec' event\r
58  * will be fired by the command itself manually, and the 'exec' function return value\r
59  * of this command is not to be returned.\r
60  * @name  CKEDITOR.commandDefinition.async\r
61  * @type {Boolean} If defined as 'true', the command is asynchronous.\r
62  * @example\r
63  * editorInstance.addCommand( 'alertName',\r
64  * {\r
65  *     exec : function( editor )\r
66  *     {\r
67  *         // Asynchronous operation below.\r
68  *         CKEDITOR.ajax.loadXml( 'data.xml' );\r
69  *     },\r
70  *     async : true    // The command need some time to complete after exec function returns.\r
71  * });\r
72  */\r
73 \r
74 /**\r
75  * Whether the command should give focus to the editor before execution.\r
76  * @name  CKEDITOR.commandDefinition.editorFocus\r
77  * @type {Boolean}\r
78  * @example\r
79  * editorInstance.addCommand( 'maximize',\r
80  * {\r
81  *     exec : function( editor )\r
82  *     {\r
83  *     },\r
84  *     editorFocus : false    // The command doesn't require focusing the editing document.\r
85  * });\r
86  */\r