# MarkdownEditorLegacy
## Description
BitMarkdownEditorLegacy is a simple markdown editor like the GitHub editor.
## Parameters
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| DefaultValue | `string?` | null | The default text value of the editor to use at initialization. |
| OnChange | `EventCallback<string?>` | | Callback for when the editor value changes. |
| Value | `string?` | null | The two-way bound text value of the editor. |
| AriaLabel | `string?` | null | Gets or sets the accessible label for the component, used by assistive technologies. |
| Class | `string?` | null | Gets or sets the CSS class name(s) to apply to the rendered element. |
| Dir | `BitDir?` | null | Gets or sets the text directionality for the component's content. |
| Disabled | `bool` | false | Gets or sets a value indicating whether the component is disabled and cannot respond to user interaction. |
| ForceAnimation | `bool` | false | Gets or sets a value indicating whether the component's animations play at their full duration even when reduced motion is requested. |
| HtmlAttributes | `Dictionary<string, object>` | new Dictionary<string, object>() | Captures additional HTML attributes to be applied to the rendered element, in addition to the component's parameters. An attribute written on the component wins over an entry of the same name. |
| Id | `string?` | null | Gets or sets the unique identifier for the component's root element. |
| Style | `string?` | null | Gets or sets the CSS style string to apply to the rendered element. |
| TabIndex | `string?` | null | Gets or sets the tab order index for the component when navigating with the keyboard. |
| Visibility | `BitVisibility` | BitVisibility.Visible | Gets or sets the visibility state (visible, hidden, or collapsed) of the component. |
## Public Members
| Name | Type | Default Value | Description |
| :--- | :--- | :------------ | :---------- |
| GetValue | `Func<ValueTask<string>>` | | Returns the current value of the editor. |
| Run | `Func<BitMarkdownEditorLegacyCommand, ValueTask>` | | Runs a specific command on the editor. |
| Add | `Func<string, BitMarkdownEditorLegacyContentType, ValueTask>` | | Adds a specific content to the editor. |
| UniqueId | `Guid` | Guid.NewGuid() | Gets the readonly unique identifier for the component's root element, assigned when the component instance is constructed. |
| RootElement | `ElementReference` | | Gets the reference to the root HTML element associated with this component. |
## Enums
### BitMarkdownEditorLegacyCommand Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Heading | 0 | Makes the current line a heading. |
| Bold | 1 | Makes the current selection text bold. |
| Italic | 2 | Makes the current selection text italic. |
| Link | 3 | Makes the current selection text a link. |
| Picture | 4 | Makes the current selection text an image. |
| Quote | 5 | Makes the current selection text a quote message. |
| Code | 6 | Makes the current selection text a code phrase. |
| CodeBlock | 7 | Makes the current selection text a code block. |
### BitMarkdownEditorLegacyContentType Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Inline | 0 | Inline content type. |
| Block | 1 | Block content type. |
| Wrap | 2 | Wrap content type. |
### BitVisibility Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Visible | 0 | The content of the component is visible. |
| Hidden | 1 | The content of the component is hidden, but the space it takes on the page remains (visibility:hidden). |
| Collapsed | 2 | The component is hidden (display:none). |
### BitDir Enum
| Name | Value | Description |
| :--- | :--- | :---------- |
| Ltr | 0 | Ltr (left to right) is to be used for languages that are written from the left to the right (like English). |
| Rtl | 1 | Rtl (right to left) is to be used for languages that are written from the right to the left (like Arabic). |
| Auto | 2 | Auto lets the user agent decide. It uses a basic algorithm as it parses the characters inside the element until it finds a character with a strong directionality, then applies that directionality to the whole element. |
## Examples
\n**Basic**:
```razor
```
\n**GetValue**:
```razor
=>
```
```csharp
private BitMarkdownEditorLegacy editorRef = default!;
private string? value;
private async Task GetValue()
{
value = await editorRef.GetValue();
}
```
\n**OnChange**:
```razor
```
```csharp
private string? onChangeValue;
```
\n**Binding**:
```razor
```
```csharp
private string? bindingValue;
```
\n**Undo/Redo**:
```razor
```
\n**Advanced**:
```razor
H
B
I
|
L
P
Q
|
C
CB
```
```csharp
private bool showPreview;
private string? advancedValue;
private BitMarkdownEditorLegacy advancedRef = default!;
```
@value
@onChangeValue