# AlertNode
Class Inherits TextNode
## About
`AlertNode` displays emphasized rich-text content using an informational, success, warning, or danger presentation. Its insertion toolbar menu chooses the alert type before adding the node, and the hover insertion chooser inserts an Info alert.
HTML export uses alert-specific classes while retaining user styling and background-image state on the exported element. Markdown export uses GitHub alert syntax: `[!NOTE]` for Info, `[!TIP]` for Success, `[!WARNING]` for Warning, and `[!CAUTION]` for Danger.
Alerts import from `aside` elements. Blockquotes import as alerts only when `QuoteNode` is not registered or the blockquote has an `alert` class.
## Enumerations
| Name | Value | Description |
| --- | :---: | --- |
| Types | Info <br > Success <br > Warning <br > Danger | (None) |
## Methods
| Name | Parameters | Return Type | Description |
| --- | :---: | :---: | --- |
| ActionItem | index As Integer | ToolbarItem | Returns the contextual toolbar item at the specified index. |
| Constructor | value As String <br> type As Types | (None) | Creates a new alert node instance initialized from the supplied values. |
| Duplicate | (None) | Node | Returns an independent copy of this node and its configurable state. |
| EditableContentPadding | (None) | Double | Returns the space between the node's edges and its text, in points. |
| EditingRestoreState | state As Variant | (None) | Restores a previously captured editing state. |
| EditingState | (None) | Variant | Returns a snapshot that can restore the current editing state. |
| ExportStyles | stylesheet As GraffitiProEditor.Stylesheet | (None) | Adds the stylesheet rules this node type's HTML output uses. |
| FromHTML | element As GraffitiProEditor.HTMLSupport.HTMLElement | Boolean | Imports supported content and formatting from an HTML element and returns whether it succeeded. |
| HTMLTags | (None) | String | Returns the HTML tag names supported by this node type. |
| InspectorSections | (None) | InspectorSection | Returns the user-editable alert properties exposed by the inspector. |
| LastActionIndex | (None) | Integer | Returns the last zero-based action index supplied by this node, or -1 when there are no actions. |
| LocalizeToolbarItem | strings As GraffitiProEditor.Editor | (None) | Sets this node type's toolbar item text from the supplied editor's localization properties. The editor calls it when the type is registered, when the editor opens, and when a locale pack is applied to the editor. A custom node type can override it to localize its own toolbar item. |
| PerformAction | index As Integer <br> selectedItem As DesktopMenuItem | (None) | Handles the contextual toolbar action at the specified index. |
| PerformToolbarAction | editor As Editor <br> selectedItem As DesktopMenuItem | (None) | Handles activation of this node type's main-toolbar item. |
| Render | g As Graphics <br> bounds As Rect <br> selected As Boolean | (None) | Draws the node within the supplied document bounds. |
| ToHTML | (None) | String | Returns an HTML representation of this content. |
| ToMarkdown | (None) | String | Returns a Markdown representation of this content. |
| TypeName | (None) | String | Returns the display name for this node type. |
## Properties
| Name | Type | Default Value | Description |
| --- | :---: | :---: | --- |
| Type | Types | (None) | Gets or sets this alert node's configured type. |
## Notes
Alert presentation is persisted with the node's editable content.
Each type takes its color from the editor's theme: `ColorInformation`, `ColorSuccess`, `ColorWarning`, or `ColorDanger`. The alert draws a pale tint of that color behind the text and the full color on the bar at its left edge. An alert that is not in an editor uses the theme's default colors.
### JSON Values
The alert type is stored in `content.alertType` as an integer: `0` Info, `1` Success, `2` Warning, and `3` Danger. The remaining rich-text state uses the `TextNode` and `TextSnapshot` JSON formats.
## Examples
Register an alert prototype before inserting or importing alerts.
### Warning Alert
```xojo
Editor.AddNode(New GraffitiProEditor.AlertNode("Review these settings before continuing.", GraffitiProEditor.AlertNode.Types.Warning))
```