The ButtonEmbedEdit class provides functionality for creating and editing an embed link in a document. Provides UI for creating and editing an embed link.
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.
Triggers the embedUrl command to transform the link into an embed media object
Focuses the user cursor on the widget's input.
Monitors key interaction inside the input element to respond to the keys:
- Enter: Creates/updates the link.
- Escape: Discards the changes.
The keyboard event.
Updates the component state when the link input changes on user interaction.
The change event.
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.
True if the state is valid, false otherwise
Removes the embed in the editor element.
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.
Lifecycle. Invoked when a component is receiving new props. This method is not called for the initial render.
Lifecycle. Invoked once before the component is mounted. The return value will be used as the initial value of this.state.
Lifecycle. Renders the UI of the button.
The content which should be rendered.
The editor instance where the component is being used.
The name which will be used as an alias of the button in the configuration.