aboutsummaryrefslogtreecommitdiff
path: root/sources/core/commanddefinition.js
diff options
context:
space:
mode:
Diffstat (limited to 'sources/core/commanddefinition.js')
-rw-r--r--sources/core/commanddefinition.js44
1 files changed, 29 insertions, 15 deletions
diff --git a/sources/core/commanddefinition.js b/sources/core/commanddefinition.js
index 68b2253..10a040f 100644
--- a/sources/core/commanddefinition.js
+++ b/sources/core/commanddefinition.js
@@ -1,10 +1,10 @@
1/** 1/**
2 * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. 2 * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license 3 * For licensing, see LICENSE.md or http://ckeditor.com/license
4 */ 4 */
5 5
6/** 6/**
7 * @fileOverview Defines the "virtual" {@link CKEDITOR.commandDefinition} class, 7 * @fileOverview Defines the "virtual" {@link CKEDITOR.commandDefinition} class
8 * which contains the defintion of a command. This file is for 8 * which contains the defintion of a command. This file is for
9 * documentation purposes only. 9 * documentation purposes only.
10 */ 10 */
@@ -27,14 +27,14 @@
27 * } ); 27 * } );
28 * 28 *
29 * @method exec 29 * @method exec
30 * @param {CKEDITOR.editor} editor The editor within which run the command. 30 * @param {CKEDITOR.editor} editor The editor within which to run the command.
31 * @param {Object} [data] Additional data to be used to execute the command. 31 * @param {Object} [data] Additional data to be used to execute the command.
32 * @returns {Boolean} Whether the command has been successfully executed. 32 * @returns {Boolean} Whether the command has been successfully executed.
33 * Defaults to `true`, if nothing is returned. 33 * Defaults to `true` if nothing is returned.
34 */ 34 */
35 35
36/** 36/**
37 * Whether the command need to be hooked into the redo/undo system. 37 * Whether the command needs to be hooked into the redo/undo system.
38 * 38 *
39 * editorInstance.addCommand( 'alertName', { 39 * editorInstance.addCommand( 'alertName', {
40 * exec: function( editor ) { 40 * exec: function( editor ) {
@@ -52,14 +52,18 @@
52 * command itself manually, and that the return value of this command is not to 52 * command itself manually, and that the return value of this command is not to
53 * be returned by the {@link #exec} function. 53 * be returned by the {@link #exec} function.
54 * 54 *
55 * editorInstance.addCommand( 'loadOptions', { 55 * editorInstance.addCommand( 'loadoptions', {
56 * exec: function( editor ) { 56 * exec: function( editor ) {
57 * var cmd = this;
57 * // Asynchronous operation below. 58 * // Asynchronous operation below.
58 * CKEDITOR.ajax.loadXml( 'data.xml', function() { 59 * CKEDITOR.ajax.loadXml( 'data.xml', function() {
59 * editor.fire( 'afterCommandExec' ); 60 * editor.fire( 'afterCommandExec', {
61 * name: 'loadoptions',
62 * command: cmd
63 * } );
60 * } ); 64 * } );
61 * }, 65 * },
62 * async: true // The command need some time to complete after exec function returns. 66 * async: true // The command needs some time to complete after the exec function returns.
63 * } ); 67 * } );
64 * 68 *
65 * @property {Boolean} [async=false] 69 * @property {Boolean} [async=false]
@@ -72,7 +76,7 @@
72 * exec: function( editor ) { 76 * exec: function( editor ) {
73 * // ... 77 * // ...
74 * }, 78 * },
75 * editorFocus: false // The command doesn't require focusing the editing document. 79 * editorFocus: false // The command does not require focusing the editing document.
76 * } ); 80 * } );
77 * 81 *
78 * See also {@link CKEDITOR.command#editorFocus}. 82 * See also {@link CKEDITOR.command#editorFocus}.
@@ -88,14 +92,14 @@
88 * exec: function( editor ) { 92 * exec: function( editor ) {
89 * // ... 93 * // ...
90 * }, 94 * },
91 * startDisabled: true // Command is unavailable until selection is inside a link. 95 * startDisabled: true // The command is unavailable until the selection is inside a link.
92 * } ); 96 * } );
93 * 97 *
94 * @property {Boolean} [startDisabled=false] 98 * @property {Boolean} [startDisabled=false]
95 */ 99 */
96 100
97/** 101/**
98 * Indicates that this command is sensible to the selection context. 102 * Indicates that this command is sensitive to the selection context.
99 * If `true`, the {@link CKEDITOR.command#method-refresh} method will be 103 * If `true`, the {@link CKEDITOR.command#method-refresh} method will be
100 * called for this command on selection changes, with a single parameter 104 * called for this command on selection changes, with a single parameter
101 * representing the current elements path. 105 * representing the current elements path.
@@ -104,10 +108,10 @@
104 */ 108 */
105 109
106/** 110/**
107 * Defined by command definition a function to determinate the command state, it will be invoked 111 * Defined by the command definition, a function to determine the command state. It will be invoked
108 * when editor has it's `states` or `selection` changed. 112 * when the editor has its `states` or `selection` changed.
109 * 113 *
110 * **Note:** The function provided must be calling {@link CKEDITOR.command#setState} in all circumstance, 114 * **Note:** The function provided must be calling {@link CKEDITOR.command#setState} in all circumstances
111 * if it is intended to update the command state. 115 * if it is intended to update the command state.
112 * 116 *
113 * @method refresh 117 * @method refresh
@@ -132,7 +136,7 @@
132 * exec: function( editor ) { 136 * exec: function( editor ) {
133 * // ... 137 * // ...
134 * }, 138 * },
135 * modes: { wysiwyg:1 } // Command is available in wysiwyg mode only. 139 * modes: { wysiwyg:1 } // The command is available in wysiwyg mode only.
136 * } ); 140 * } );
137 * 141 *
138 * See also {@link CKEDITOR.command#modes}. 142 * See also {@link CKEDITOR.command#modes}.
@@ -146,3 +150,13 @@
146 * @since 4.0 150 * @since 4.0
147 * @property {Boolean} [readOnly=false] 151 * @property {Boolean} [readOnly=false]
148 */ 152 */
153
154/**
155 * A property that should be set when a command has no keystroke assigned by {@link CKEDITOR.editor#setKeystroke}, but
156 * the keystroke is still supported. For example: `cut`, `copy` and `paste` commands are handled that way.
157 * This property is used when displaying keystroke information in tooltips and context menus. It is used by
158 * {@link CKEDITOR.editor#getCommandKeystroke}.
159 *
160 * @since 4.6.0
161 * @property {Number} fakeKeystroke
162 */