X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=_source%2Fcore%2Fcommanddefinition.js;h=e8a172daa9cf4706220d55992f4e053313c68c53;hp=c4512743c8b380cfa7f2f1aff3daef12a19095c4;hb=039a051ccf3901311661022a30afd60fc38130c9;hpb=c9fdde67e6384bd5a66adc2b3bba5c4ce9db56c7 diff --git a/_source/core/commanddefinition.js b/_source/core/commanddefinition.js index c451274..e8a172d 100644 --- a/_source/core/commanddefinition.js +++ b/_source/core/commanddefinition.js @@ -11,15 +11,15 @@ For licensing, see LICENSE.html or http://ckeditor.com/license /** * (Virtual Class) Do not call this constructor. This class is not really part - * of the API. It just illustrates the features of command objects to be - * passed to the {@link CKEDITOR.editor.prototype.addCommand} function. + * of the API. * @name CKEDITOR.commandDefinition - * @constructor + * @class Virtual class that illustrates the features of command objects to be + * passed to the {@link CKEDITOR.editor.prototype.addCommand} function. * @example */ /** - * Executes the command. + * 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. @@ -38,9 +38,9 @@ For licensing, see LICENSE.html or http://ckeditor.com/license /** * Whether the command need to be hooked into the redo/undo system. - * @name CKEDITOR.commandDefinition.canUndo - * @type {Boolean} If not defined or 'true' both hook into undo system, set it - * to 'false' explicitly keep it out. + * @name CKEDITOR.commandDefinition.prototype.canUndo + * @type {Boolean} + * @default true * @field * @example * editorInstance.addCommand( 'alertName', @@ -54,18 +54,23 @@ For licensing, see LICENSE.html or http://ckeditor.com/license */ /** - * Whether the command is asynchronous, which means the 'afterCommandExec' event - * will be fired by the command itself manually, and the 'exec' function return value - * of this command is not to be returned. - * @name CKEDITOR.commandDefinition.async - * @type {Boolean} If defined as 'true', the command is asynchronous. + * 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( 'alertName', + * editorInstance.addCommand( 'loadOptions', * { * exec : function( editor ) * { * // Asynchronous operation below. - * CKEDITOR.ajax.loadXml( 'data.xml' ); + * CKEDITOR.ajax.loadXml( 'data.xml', function() + * { + * editor.fire( 'afterCommandExec' ); + * )); * }, * async : true // The command need some time to complete after exec function returns. * }); @@ -73,13 +78,16 @@ For licensing, see LICENSE.html or http://ckeditor.com/license /** * Whether the command should give focus to the editor before execution. - * @name CKEDITOR.commandDefinition.editorFocus + * @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. * }); @@ -88,7 +96,7 @@ For licensing, see LICENSE.html or http://ckeditor.com/license /** * Whether the command state should be set to {@link CKEDITOR.TRISTATE_DISABLED} on startup. - * @name CKEDITOR.commandDefinition.startDisabled + * @name CKEDITOR.commandDefinition.prototype.startDisabled * @type {Boolean} * @default false * @example @@ -96,7 +104,26 @@ For licensing, see LICENSE.html or http://ckeditor.com/license * { * 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. + * }); + */