Show: Inherited Protected Private Deprecated

# ButtonLinkEdit Class

Defined in: `src/ui/react/src/components/buttons/button-link-edit.jsx:7`

The ButtonLinkEdit class provides functionality for creating and editing a link in a document. Provides UI for creating, editing and removing a link.

## Index

### Methods

- _clearLink
- _focusLinkInput
- _getALlowedTargetItems
- _handleKeyDown
- _handleLinkHrefChange
- _handleLinkTargetChange
- _isValidState
- _removeLink
- _updateLink
- componentDidMount
- componentWillReceiveProps
- getDefaultProps
- getInitialState
- render

### Properties

- allowedTargets
- appendProtocol
- defaultLinkTarget
- editor
- key static
- showTargetSelector

## Methods

### `_clearLink`

() protected

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:177`

Clears the link input. This only changes the component internal state, but does not affect the link element of the editor. Only the _removeLink and _updateLink methods are translated to the editor element.

### `_focusLinkInput`

() protected

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:191`

Focuses the user cursor on the widget's input.

### `_getALlowedTargetItems`

() Array
protected

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:201`

Returns an array of allowed target items. Each item consists of two properties:

- label - the label for the item, for example "_self (same tab)"
- value - the value that will be set for the link target attribute

#### Returns:

Array
:

An array of objects containing the allowed items.

### `_handleKeyDown`

(

- `event`

)
protected

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:226`

Monitors key interaction inside the input element to respond to the keys:

- Enter: Creates/updates the link.
- Escape: Discards the changes.

#### Parameters:

- `event` SyntheticEvent

  The keyboard event.

### `_handleLinkHrefChange`

(

- `event`

)
protected

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:251`

Updates the component state when the link input changes on user interaction.

#### Parameters:

- `event` SyntheticEvent

  The change event.

### `_handleLinkTargetChange`

(

- `event`

)
protected

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:264`

Updates the component state when the link target changes on user interaction.

#### Parameters:

- `event` SyntheticEvent

  The click event.

### `_isValidState`

() Boolean protected

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:333`

Verifies that the current link state is valid so the user can save the link. A valid state means that we have a non-empty href and that either that or the link target are different from the original link.

#### Returns:

Boolean:

[description]

### `_removeLink`

() protected

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:278`

Removes the link in the editor element.

### `_updateLink`

() protected

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:301`

Updates the link in the editor element. If the element didn't exist previously, it will create a new element with the href specified in the link input.

### `componentDidMount`

()

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:67`

Lifecycle. Invoked once, only on the client, immediately after the initial rendering occurs.

Focuses on the link input to immediately allow editing. This should only happen if the component is rendered in exclusive mode to prevent aggressive focus stealing.

### `componentWillReceiveProps`

()

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:87`

Lifecycle. Invoked when a component is receiving new props. This method is not called for the initial render.

### `getDefaultProps`

() Object

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:97`

Lifecycle. Returns the default values of the properties used in the widget.

#### Returns:

Object:

The default properties.

### `getInitialState`

()

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:111`

Lifecycle. Invoked once before the component is mounted. The return value will be used as the initial value of this.state.

### `render`

() Object

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:133`

Lifecycle. Renders the UI of the button.

#### Returns:

Object:

The content which should be rendered.

## Properties

### `allowedTargets`

Array

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:18`

List of the allowed values for the target attribute.

### `appendProtocol`

Boolean

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:25`

Indicate if we add http:// protocol to link or not

### `defaultLinkTarget`

String

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:39`

Default value of the link target attribute.

### `editor`

Object

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:32`

The editor instance where the component is being used.

### `key`

String static

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:57`

The name which will be used as an alias of the button in the configuration.

Default: linkEdit

### `showTargetSelector`

Boolean

Defined in `src/ui/react/src/components/buttons/button-link-edit.jsx:46`

Indicates whether the link target selector should appear.