Class: ToolbarAction

Granite.author.ui. ToolbarAction

Represents an action on Granite.author.Editables executed through the Granite.author.ui.Toolbar.


new ToolbarAction(config)

Parameters:
Name Type Description
config Object

The configuration object

Properties
Name Type Argument Description
execute function

The actual action to perform

name string

The name identifier of the action

condition function <optional>

The condition function that tells if the action could be performed

text string <optional>

The displayed text to represent the action

icon string <optional>

The displayed icon (css class, see Coral icons) to represent the action

order string <optional>

The order of the action. Valid values are "first", "last", "before NAME", "after NAME"

render function <optional>

The custom render function which receives the rendered node before it is attached to the toolbar

shortcut string <optional>

The keyboard shortcut that triggers the action when an editable has focus

isNonMulti boolean <optional>

Indicates if the action could be executed on multiple editables

Source:
ui/ui.ToolbarAction.js

Extends

Members


icon :string

The displayed icon (css class, see Coral icons) to represent the action

Type:
  • string
Source:
ui/ui.ToolbarAction.js

isNonMulti :boolean

Indicates if the action could be executed on multiple editables

Type:
  • boolean
Source:
ui/ui.ToolbarAction.js

name :string

The name identifier of the action

Type:
  • string
Source:
ui/ui.ToolbarAction.js

order :number

The order of the action. Valid values are "first", "last", "before NAME", "after NAME".
Note: System actions as EDIT, INSERT etc. are supposed to be added to SYSTEM_ACTIONS_ORDER.

Type:
  • number
Source:
ui/ui.ToolbarAction.js

shortcut :string

The keyboard shortcut that triggers the action when an editable has focus

Type:
  • string
Source:
ui/ui.ToolbarAction.js

text :string

The displayed text to represent the action

Type:
  • string
Source:
ui/ui.ToolbarAction.js

Methods


<private> _postExecute()

After the action has been executed, the registered function that correspond to the given data type is called.
Implementations of the _postExecute is expected to be pseudo private and only used internally by the EditableAction.
The request content path and raw data returned by the server are added as the trailing parameters of the _postExecute function

Inherited From:
Source:
ui/ui.EditableAction.js
Returns:
Type
function

<abstract> condition(editable [, extraParams])

The condition function that tells if the action could be performed.

Parameters:
Name Type Argument Description
editable Granite.author.Editable

The editable on which the action will be performed

extraParams Object <optional>

Optional parameters needed for the operation

Inherited From:
Source:
ui/ui.EditableAction.js
Returns:

Returns true if the action could be performed on the passed editable

Type
boolean

<abstract> execute(editable [, extraParams])

The actual action to perform.

Parameters:
Name Type Argument Description
editable Granite.author.Editable

The editable on which the action will be performed

extraParams Object <optional>

Optional parameters needed for the operation

Inherited From:
Source:
ui/ui.EditableAction.js
Returns:
  • Returns a deferred object that is either resolved or rejected depending on the success of the operation
Type
$.Promise

render(dom)

The custom render function which receives the rendered node before it is attached to the toolbar

Parameters:
Name Type Description
dom jQuery

The rendered button to add to the toolbar

Source:
ui/ui.ToolbarAction.js
Returns:

Returns the button element to be added to the toolbar

Type
jQuery