]>
git.immae.eu Git - perso/Immae/Projets/packagist/connexionswing-ckeditor-component.git/blob - sources/core/commanddefinition.js
2 * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
3 * For licensing, see LICENSE.md or http://ckeditor.com/license
7 * @fileOverview Defines the "virtual" {@link CKEDITOR.commandDefinition} class,
8 * which contains the defintion of a command. This file is for
9 * documentation purposes only.
13 * Virtual class that illustrates the features of command objects to be
14 * passed to the {@link CKEDITOR.editor#addCommand} function.
16 * @class CKEDITOR.commandDefinition
21 * The function to be fired when the commend is executed.
23 * editorInstance.addCommand( 'sample', {
24 * exec: function( editor ) {
25 * alert( 'Executing a command for the editor name "' + editor.name + '"!' );
30 * @param {CKEDITOR.editor} editor The editor within which run 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.
33 * Defaults to `true`, if nothing is returned.
37 * Whether the command need to be hooked into the redo/undo system.
39 * editorInstance.addCommand( 'alertName', {
40 * exec: function( editor ) {
41 * alert( editor.name );
43 * canUndo: false // No support for undo/redo.
46 * @property {Boolean} [canUndo=true]
50 * Whether the command is asynchronous, which means that the
51 * {@link CKEDITOR.editor#event-afterCommandExec} event will be fired by the
52 * command itself manually, and that the return value of this command is not to
53 * be returned by the {@link #exec} function.
55 * editorInstance.addCommand( 'loadOptions', {
56 * exec: function( editor ) {
57 * // Asynchronous operation below.
58 * CKEDITOR.ajax.loadXml( 'data.xml', function() {
59 * editor.fire( 'afterCommandExec' );
62 * async: true // The command need some time to complete after exec function returns.
65 * @property {Boolean} [async=false]
69 * Whether the command should give focus to the editor before execution.
71 * editorInstance.addCommand( 'maximize', {
72 * exec: function( editor ) {
75 * editorFocus: false // The command doesn't require focusing the editing document.
78 * See also {@link CKEDITOR.command#editorFocus}.
80 * @property {Boolean} [editorFocus=true]
85 * Whether the command state should be set to {@link CKEDITOR#TRISTATE_DISABLED} on startup.
87 * editorInstance.addCommand( 'unlink', {
88 * exec: function( editor ) {
91 * startDisabled: true // Command is unavailable until selection is inside a link.
94 * @property {Boolean} [startDisabled=false]
98 * Indicates that this command is sensible to the selection context.
99 * If `true`, the {@link CKEDITOR.command#method-refresh} method will be
100 * called for this command on selection changes, with a single parameter
101 * representing the current elements path.
103 * @property {Boolean} [contextSensitive=true]
107 * Defined by command definition a function to determinate the command state, it will be invoked
108 * when editor has it's `states` or `selection` changed.
110 * **Note:** The function provided must be calling {@link CKEDITOR.command#setState} in all circumstance,
111 * if it is intended to update the command state.
114 * @param {CKEDITOR.editor} editor
115 * @param {CKEDITOR.dom.elementPath} path
119 * Sets the element name used to reflect the command state on selection changes.
120 * If the selection is in a place where the element is not allowed, the command
122 * Setting this property overrides {@link #contextSensitive} to `true`.
124 * @property {Boolean} [context=true]
128 * The editor modes within which the command can be executed. The execution
129 * will have no action if the current mode is not listed in this property.
131 * editorInstance.addCommand( 'link', {
132 * exec: function( editor ) {
135 * modes: { wysiwyg:1 } // Command is available in wysiwyg mode only.
138 * See also {@link CKEDITOR.command#modes}.
140 * @property {Object} [modes={ wysiwyg:1 }]
144 * Whether the command should be enabled in the {@link CKEDITOR.editor#setReadOnly read-only mode}.
147 * @property {Boolean} [readOnly=false]