Legacy
RichTextEditorLegacy
Bit.BlazorUI.Legacy
RichTextEditor is a WYSIWYG text editor, utilizing the famous Quill.js library.
Notes
To use this component, you need to install the Bit.BlazorUI.Legacy nuget package, as described in the Legacy components section of the Getting started page.
Usage
Every example is live. Open its code to see exactly what produced the component running underneath.
Basic
Placeholder
Readonly
Reversed
FullToolbar
Style & Class
Get APIs
result:
Set APIs
Templates
this is bold
this is italic
this is italic & bold
Custom fonts
this is a sample of adding custom fonts to the BitRichTextEditorLegacy!
Quill custom modules
Using Quill custom modules are as easy as providing a new configuration that provides the name, config, and script src of the module.
The following sample shows how to use the "imageResize" custom module
(https://github.com/bitignite/quill-image-resize-module).
API
Every parameter, public member, sub-class and enum this component exposes.
BitRichTextEditorLegacy parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| Classes | BitRichTextEditorLegacyClassStyles? | null | Custom CSS classes for different parts of the rich text editor. |
| EditorTemplate | RenderFragment? | null | Custom template for the editor content. |
| FullToolbar | bool | false | Renders the full toolbar with all of the available features. |
| Modules | IEnumerable<BitRichTextEditorLegacyModule>? | null | Custom Quill modules to be registered at first render (<see href="https://quilljs.com/docs/guides/building-a-custom-module"/>). |
| OnEditorReady | EventCallback<string> | Callback for when the editor instance is created and ready to use. | |
| OnQuillReady | EventCallback | Callback for when the Quill scripts is loaded and the Quill api is ready to use. It allows for custom actions to be performed at that moment. | |
| OnQuillModulesReady | EventCallback | Callback for when the scripts of the provided Quill Modules are loaded and their api are ready to use. | |
| Placeholder | string? | null | The placeholder value of the editor. |
| ReadOnly | bool | false | Makes the editor readonly. |
| Reversed | bool | false | Reverses the location of the Toolbar and the Editor. |
| Styles | BitRichTextEditorLegacyClassStyles? | null | Custom CSS styles for different parts of the rich text editor. |
| Theme | BitRichTextEditorLegacyTheme? | null | The theme of the editor. |
| ToolbarTemplate | RenderFragment? | null | Custom template for the toolbar content. |
BitRichTextEditorLegacy public members
| Name | Type | Default value | Description |
|---|---|---|---|
| GetText | Func<ValueTask<string>> | Gets the current text content of the editor. | |
| GetHtml | Func<ValueTask<string>> | Gets the current html content of the editor. | |
| GetContent | Func<ValueTask<string>> | Gets the current content of the editor in JSON format. | |
| SetText | Action<ValueTask<string?>> | Sets the current text content of the editor. | |
| SetHtml | Action<ValueTask<string?>> | Sets the current html content of the editor. | |
| SetContent | Action<ValueTask<string?>> | Sets the current content of the editor in JSON format. |
BitComponentBase parameters
| Name | Type | Default value | Description |
|---|---|---|---|
| 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. |
| 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. |
| Id | string? | null | Gets or sets the unique identifier for the component's root element. |
| IsEnabled | bool | true | Gets or sets a value indicating whether the component is enabled and can respond to user interaction. |
| 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. |
BitComponentBase public members
| Name | Type | Default value | Description |
|---|---|---|---|
| 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. |
BitRichTextEditorLegacyClassStyles properties
| Name | Type | Default value | Description |
|---|---|---|---|
| Root | string? | null | Custom CSS classes/styles for the root of the BitRichTextEditorLegacy. |
| Toolbar | string? | null | Custom CSS classes/styles for the toolbar of the BitRichTextEditorLegacy. |
| Editor | string? | null | Custom CSS classes/styles for the editor container of the BitRichTextEditorLegacy. |
BitRichTextEditorLegacyModule properties
Represents a Quill custom module specifications.
| Name | Type | Default value | Description |
|---|---|---|---|
| Name | string | The name of the Quill custom module. | |
| Src | string | The script src of the Quill custom module to load at firt render. | |
| Config | object | The configuration object that applies the settings of the Quill custom module. |
BitRichTextEditorLegacyTheme enum
| Name | Value | Description |
|---|---|---|
| Snow | 0 | |
| Bubble | 1 |
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. |
Feedback
Found a mistake, a gap, or something that could be clearer? Every page and every component is one click from its source.