CKEditor 4 Documentation

CKEDITOR.plugins.indent.genericDefinition

Hierarchy

CKEDITOR.commandDefinition
CKEDITOR.plugins.indent.genericDefinition

Files

A base class for a generic command definition, responsible mainly for creating Increase Indent and Decrease Indent toolbar buttons as well as for refreshing UI states.

Commands of this class do not perform any indentation by themselves. They delegate this job to content-specific indentation commands (i.e. indentlist).

Parameters

  • editor : CKEDITOR.editor

    The editor instance this command will be applied to.

  • name : String

    The name of the command.

  • isIndent : Boolean (optional)

    Defines the command as indenting or outdenting.

Defined By

Properties

Whether the command is asynchronous, which means that the CKEDITOR.editor.afterCommandExec event will be fired by the...

Whether the command is asynchronous, which means that the CKEDITOR.editor.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 exec function.

    editorInstance.addCommand( 'loadoptions', {
        exec: function( editor ) {
            var cmd = this;
            // Asynchronous operation below.
            CKEDITOR.ajax.loadXml( 'data.xml', function() {
                editor.fire( 'afterCommandExec', {
                name: 'loadoptions',
                command: cmd
                } );
            } );
        },
        async: true // The command needs some time to complete after the exec function returns.
    } );

Defaults to: false

Whether the command needs to be hooked into the redo/undo system. ...

Whether the command needs to be hooked into the redo/undo system.

editorInstance.addCommand( 'alertName', {
    exec: function( editor ) {
        alert( editor.name );
    },
    canUndo: false // No support for undo/redo.
} );

Defaults to: true

Sets the element name used to reflect the command state on selection changes. ...

Sets the element name used to reflect the command state on selection changes. If the selection is in a place where the element is not allowed, the command will be disabled. Setting this property overrides contextSensitive to true.

Defaults to: true

Indicates that this command is sensitive to the selection context. ...

Indicates that this command is sensitive to the selection context. If true, the CKEDITOR.command.refresh method will be called for this command on selection changes, with a single parameter representing the current elements path.

Defaults to: true

Whether the command should give focus to the editor before execution. ...

Whether the command should give focus to the editor before execution.

editorInstance.addCommand( 'maximize', {
        exec: function( editor ) {
        // ...
    },
    editorFocus: false // The command does not require focusing the editing document.
} );

See also CKEDITOR.command.editorFocus.

Defaults to: true

A property that should be set when a command has no keystroke assigned by CKEDITOR.editor.setKeystroke, but the keyst...

A property that should be set when a command has no keystroke assigned by CKEDITOR.editor.setKeystroke, but the keystroke is still supported. For example: cut, copy and paste commands are handled that way. This property is used when displaying keystroke information in tooltips and context menus. It is used by CKEDITOR.editor.getCommandKeystroke.

Available since: 4.6.0

CKEDITOR.plugins.indent.genericDefinition
view source
: Booleanreadonly
Determines whether the command belongs to the indentation family. ...

Determines whether the command belongs to the indentation family. Otherwise it is assumed to be an outdenting command.

Defaults to: false

The editor modes within which the command can be executed. ...

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 } // The command is available in wysiwyg mode only.
} );

See also CKEDITOR.command.modes.

Defaults to: { wysiwyg:1 }

Whether the command should be enabled in the read-only mode. ...

Whether the command should be enabled in the read-only mode.

Defaults to: false

Available since: 4.0

Whether the command state should be set to CKEDITOR.TRISTATE_DISABLED on startup. ...

Whether the command state should be set to CKEDITOR.TRISTATE_DISABLED on startup.

editorInstance.addCommand( 'unlink', {
    exec: function( editor ) {
        // ...
    },
    startDisabled: true // The command is unavailable until the selection is inside a link.
} );

Defaults to: false

Defined By

Methods

( editor, [data] ) : Boolean
The function to be fired when the commend is executed. ...

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

  • editor : CKEDITOR.editor

    The editor within which to run the command.

  • data : Object (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.

Defined by the command definition, a function to determine the command state. ...

Defined by the command definition, a function to determine the command state. It will be invoked when the editor has its states or selection changed.

Note: The function provided must be calling CKEDITOR.command.setState in all circumstances if it is intended to update the command state.

Parameters