ButtonLinkTargetEdit Class
The ButtonLinkTargetEdit class provides functionality for changing the target of a link in the document.
Index
Methods
Properties
Methods
_getAllowedTargetsList
()
Object
protected
Creates the dropdown list of allowed link targets.
Returns:
The allowed targets dropdown.
_getAllowedTargetsListItems
()
Array
protected
Creates the allowed link target items.
Returns:
The allowed target items.
_getFocusAction
-
event
Returns the action, if any, that a keyboard event in the current focus manager state should produce.
Parameters:
-
event
ObjectThe Keyboard event.
Returns:
An action object with type and direction properties.
_getFocusDismissAction
-
event
-
focusMoveDirection
Returns the dismiss action, if any, the focus manager should execute to yield the focus. This will happen in any of these scenarios if a dismiss callback has been specified:
- A dismiss key has been pressed
- In a non-circular focus manager, when:
- The active descendant is the first one and a prev key has been pressed.
- The active descendant is the last one and a next key has been pressed.
Parameters:
-
event
ObjectThe Keyboard event.
-
focusMoveDirection
NumberThe focus movement direction (if any).
Returns:
A dismiss action with dismiss and direction properties.
_getFocusMoveDirection
-
event
Returns the direction, if any, in which the focus should be moved. In presence of the shift key modifier, the direction of the movement is inverted.
Parameters:
-
event
ObjectThe Keyboard event.
Returns:
The computed direction of the expected focus movement.
_isValidKey
-
keyCode
-
keys
Indicates if a given keyCode is valid for the given set of keys.
Parameters:
-
keyCode
NumberAn event keyCode.
-
keys
Array | NumberA key set. Can be a number an array of numbers representing the allowed keyCodes.
Returns:
A boolean value indicating if the key is valid.
_moveFocus
-
direction
Moves the focus among descendants in the especified direction.
Parameters:
-
direction
NumberThe direction (1 or -1) of the focus movement among descendants.
_refresh
()
protected
Refreshes the descendants list by executing the CSS selector again and resets the descendants tabIndex.
componentDidMount
()
Lifecycle. Invoked once, only on the client, immediately after the initial rendering occurs.
componentDidUpdate
()
Lifecycle. Invoked immediately after the component's updates are flushed to the DOM. Refreshes the descendants list.
focus
()
Focuses the current active descendant.
Several Widgets can be nested in a component hierarchy by attaching this focus method to the widget DOM node, transferring the DOM focus control to the inner FocusManager.
getDefaultProps
()
Lifecycle. Returns the default values of the properties used in the widget.
handleKey
-
event
Handles the key events on a DOM node to execute the appropriate navigation when needed.
Parameters:
-
event
ObjectThe Keyboard event that was detected on the widget DOM node.
moveFocus
-
direction
Moves the focus among descendants in the especified direction.
Parameters:
-
direction
NumberThe direction (1 or -1) of the focus movement among descendants.
render
()
Object
Lifecycle. Renders the UI of the button.
Returns:
The content which should be rendered.
shouldComponentUpdate
()
Boolean
Lifecycle. Invoked before rendering when new props or state are being received. This method is not called for the initial render or when forceUpdate is used.
Returns:
Returns false when the transition to the new props and state will not require a component update.
Properties
allowedTargets
Array
List of the allowed items for the target attribute. Every allowed target is an object
with a label
attribute that will be shown in the dropdown and a value
attribute
that will get set as the link target attribute.
circular
Boolean
Indicates if focus should be set to the first/last descendant when the limits are reached.
descendants
String
String representing the CSS selector used to define the elements that should be handled.
editor
Object
The editor instance where the component is being used.
key
String
static
The name which will be used as an alias of the button in the configuration.
Default: linkTargetEdit
keys
Object
Object representing the keys used to navigate between descendants. The format for the prop is:
{dismiss: value, dismissNext: value, dismissPrev: value, next: value, prev: value}
where
value can be both a number or an array of numbers with the allowed keyCodes.
onDismiss
Function
Callback method to be invoked when the focus manager is to be dismissed. This happens in the following scenarios if a dismiss callback has been specified:
- A dismiss key has been pressed
- In a non-circular focus manager, when:
- The active descendant is the first one and a prev key has been pressed.
- The active descendant is the last one and a next key has been pressed.
selectedTarget
String
Label of the current target value.