## NimbudocsEditor. Action

  Actions are automatically created from the action map.

### Properties

EVENT_INVOKEString constant

  ##### Type:

  - String
  See:
    - `NimbudocsEditor.Action#addEventListener`
    - `NimbudocsEditor.Action#removeEventListener`
    - `NimbudocsEditor.Action#addInvokeListener`
    - `NimbudocsEditor.Action#removeInvokeListener`
PROPERTY_ENABLED_STATEString constant

  ##### Type:

  - String
  See:
    - `NimbudocsEditor.Action#addEventListener`
    - `NimbudocsEditor.Action#removeEventListener`
PROPERTY_SELECTED_STATEString constant

  ##### Type:

  - String
  See:
    - `NimbudocsEditor.Action#addEventListener`
    - `NimbudocsEditor.Action#removeEventListener`
PROPERTY_STRING_STATEString constant

  ##### Type:

  - String
  See:
    - `NimbudocsEditor.Action#addEventListener`
    - `NimbudocsEditor.Action#removeEventListener`
enabledStateString
  The enabled state of an element. Is `true` if the action is enabled, `false` otherwise. Set to `true` to enable the action and to `false` to disable it.

  ##### Type:

  - String
iconTextString readonly
  The icon text.

  ##### Type:

  - String
iconUrlObject readonly
  The URLs to icons for different sizes.

  ##### Type:

  - Object

  ##### Properties:

  Name | Type | Description
  --- | --- | ---
  `default` | String | The default icon URL.
  `tiny` | String | The icon URL to the tiny icon.
  `small` | String | The icon URL to the small icon.
  `medium` | String | The icon URL to the medium icon.
  `large` | String | The icon URL to the large icon.

idString readonly
  The ID of the action.

  ##### Type:

  - String
isIgnoreReadonlyString readonly
  Is `true` if the action can be used in read only areas.

  ##### Type:

  - String
selectedStateString
  The selected state of an element. Is `true` if the action is selected, `false` otherwise. Set to `true` to select the action and to `false` to deselect it.

  ##### Type:

  - String
  See:
    - `NimbudocsEditor.Action#toggle`
shortcutString readonly
  The keyboard shortcut of the action.

  ##### Type:

  - String
stringStateString
  The current string state of the action. Set this to another string state to change the current one.

  ##### Type:

  - String
titleString readonly
  The title of the action.

  ##### Type:

  - String
typeString readonly
  The action type.

  ##### Type:

  - String

### Methods

addEventListener(type, handler)

  Adds a listener for one of the following events:

  - enabled-state: Fired when the enabled state changes. The state that indicates whether the action is currently enabled (Example: The "table-properties-dialog" action is enabled if the caret is placed inside a table).
  - selected-state: Fired when the selected state changes. The state that indicates whether the action is currently selected (Example: The "align-right" action is selected when the caret is inside text that is right aligned).
  - string-state: Fired when the string state changes. This state indicates the value of the action as a string (Example: The "font-size" action can have string states like "12pt", "36pt", etc.).
  - actioninvoke: Fired when the action is invoked.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | String | The event type.
  `handler` | Function | The handler to be called when the event is triggered.

  See:
    - `NimbudocsEditor.Action.PROPERTY_ENABLED_STATE`
    - `NimbudocsEditor.Action.PROPERTY_SELECTED_STATE`
    - `NimbudocsEditor.Action.PROPERTY_STRING_STATE`
    - `NimbudocsEditor.Action.EVENT_INVOKE`
    - `NimbudocsEditor.Action#removeEventListener`
addInvokeListener(handler)
  Adds a listener that is triggered when the action is invoked.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `handler` | Function | The handler to be called when the event is triggered.

  See:
    - `NimbudocsEditor.Action#removeInvokeListener`

  ##### Listens to Events:

  - NimbudocsEditor#event:actioninvoke
invoke(argument, event)async
  Invokes the action with an optional argument and trigger element.

  ##### Parameters:

  Name | Type | Argument | Description
  --- | --- | --- | ---
  `argument` | String | optional | The action argument.
  `event` | Event | optional | An optinal HTML DOM Event object.

  ##### Fires:

  - NimbudocsEditor#event:actioninvoke
removeEventListener(type)
  Removes all listeners of the specified type.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `type` | String | The event type.

  See:
    - `NimbudocsEditor.Action.PROPERTY_ENABLED_STATE`
    - `NimbudocsEditor.Action.PROPERTY_SELECTED_STATE`
    - `NimbudocsEditor.Action.PROPERTY_STRING_STATE`
    - `NimbudocsEditor.Action.EVENT_INVOKE`
    - `NimbudocsEditor.Action#addEventListener`
removeInvokeListener()
  Removes all actioninvoke listeners.
  See:
    - `NimbudocsEditor.Action#addInvokeListener`
toggle()
  Toggles the selected state of the action.
  See:
    - `NimbudocsEditor.Action#selectedState`