Show: Inherited Protected Private Deprecated

# ButtonEmbedEdit Class

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

The ButtonEmbedEdit class provides functionality for creating and editing an embed link in a document. Provides UI for creating and editing an embed link.

## Index

### Methods

- _clearLink
- _embedLink
- _focusLinkInput
- _handleKeyDown
- _handleLinkHrefChange
- _isValidState
- _removeEmbed
- componentDidMount
- componentWillReceiveProps
- getInitialState
- render

### Properties

- editor
- key static

## Methods

### `_clearLink`

() protected

Defined in `src/ui/react/src/components/buttons/button-embed-edit.jsx:124`

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.

### `_embedLink`

() protected

Defined in `src/ui/react/src/components/buttons/button-embed-edit.jsx:138`

Triggers the embedUrl command to transform the link into an embed media object

### `_focusLinkInput`

() protected

Defined in `src/ui/react/src/components/buttons/button-embed-edit.jsx:156`

Focuses the user cursor on the widget's input.

### `_handleKeyDown`

(

- `event`

)
protected

Defined in `src/ui/react/src/components/buttons/button-embed-edit.jsx:166`

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-embed-edit.jsx:193`

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

#### Parameters:

- `event` SyntheticEvent

  The change event.

### `_isValidState`

() Boolean protected

Defined in `src/ui/react/src/components/buttons/button-embed-edit.jsx:206`

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 that's different from the original one.

#### Returns:

Boolean:

True if the state is valid, false otherwise

### `_removeEmbed`

() protected

Defined in `src/ui/react/src/components/buttons/button-embed-edit.jsx:223`

Removes the embed in the editor element.

### `componentDidMount`

()

Defined in `src/ui/react/src/components/buttons/button-embed-edit.jsx:36`

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-embed-edit.jsx:56`

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

### `getInitialState`

()

Defined in `src/ui/react/src/components/buttons/button-embed-edit.jsx:66`

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-embed-edit.jsx:97`

Lifecycle. Renders the UI of the button.

#### Returns:

Object:

The content which should be rendered.

## Properties

### `editor`

Object

Defined in `src/ui/react/src/components/buttons/button-embed-edit.jsx:16`

The editor instance where the component is being used.

### `key`

String static

Defined in `src/ui/react/src/components/buttons/button-embed-edit.jsx:26`

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

Default: embedEdit