Class CKEDITOR.commandDefinition
Virtual class that illustrates the features of command objects to be
passed to the CKEDITOR.editor.prototype.addCommand function.
Defined in: core/commanddefinition.js.
Constructor Attributes | Constructor Name and Description |
---|---|
(Virtual Class) Do not call this constructor.
|
Field Attributes | Field Name and Description |
---|---|
Whether the command is asynchronous, which means that the
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 CKEDITOR.command#exec function.
|
|
Whether the command need to be hooked into the redo/undo system.
|
|
Whether the command should give focus to the editor before execution.
|
|
The editor modes within which the command can be executed.
|
|
Whether the command state should be set to CKEDITOR.TRISTATE_DISABLED on startup.
|
Method Attributes | Method Name and Description |
---|---|
exec(editor, data)
The function to be fired when the commend is executed.
|
Class Detail
CKEDITOR.commandDefinition()
Since:
3.0
(Virtual Class) Do not call this constructor. This class is not really part
of the API.
Field Detail
{Undefined}
async
Since:
3.0
Whether the command is asynchronous, which means that the
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 CKEDITOR.command#exec function.
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. });
- Default Value:
- false
{Undefined}
canUndo
Since:
3.0
Whether the command need to be hooked into the redo/undo system.
editorInstance.addCommand( 'alertName', { exec : function( editor ) { alert( editor.name ); }, canUndo : false // No support for undo/redo });
- Default Value:
- true
{Undefined}
editorFocus
Since:
3.0
Whether the command should give focus to the editor before execution.
editorInstance.addCommand( 'maximize', { exec : function( editor ) { // ... }, editorFocus : false // The command doesn't require focusing the editing document. });
- Default Value:
- true
{Object}
modes
Since:
3.0
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.
editorInstance.addCommand( 'link', { exec : function( editor ) { // ... }, modes : { wysiwyg : 1 } // Command is available in wysiwyg mode only. });
{Undefined}
startDisabled
Since:
3.0
Whether the command state should be set to CKEDITOR.TRISTATE_DISABLED on startup.
editorInstance.addCommand( 'unlink', { exec : function( editor ) { // ... }, startDisabled : true // Command is unavailable until selection is inside a link. });
- Default Value:
- false
Method Detail
{Boolean}
exec(editor, data)
Since:
3.0
The function to be fired when the commend is executed.
editorInstance.addCommand( 'sample', { exec : function( editor ) { alert( 'Executing a command for the editor name "' + editor.name + '"!' ); } });
- Parameters:
- {CKEDITOR.editor} editor
- The editor within which run the command.
- {Object} data Optional
- 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.