ToastUIEditor 1.0.0

dotnet add package ToastUIEditor --version 1.0.0
NuGet\Install-Package ToastUIEditor -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ToastUIEditor" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ToastUIEditor --version 1.0.0
#r "nuget: ToastUIEditor, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ToastUIEditor as a Cake Addin
#addin nuget:?package=ToastUIEditor&version=1.0.0

// Install ToastUIEditor as a Cake Tool
#tool nuget:?package=ToastUIEditor&version=1.0.0

ToastUI Editor Blazor

tui.editor.blazor is a Blazor component that provides a Markdown editor based on the tui.editor library.

Installation

Install the package using following command:

Install-Package ToastUIEditor

or

dotnet add package ToastUIEditor

or just use nuget package manager.

Usage

  1. Add the following import statement to your _Imports.razor file
@using ToastUI
  1. Use the Editor component in your Blazor page or component
<Editor @bind-Value="content" Options="@options" />
  • @bind-Value: Binds the editor's content to a string property in your Blazor component.
  • Options: Sets the configuration options for the editor. Refer to the EditorOptions class for available options.
  1. Use the Viewer component in your Blazor page or component
<Viewer Value="@content" />
  • Value: Sets the content to be displayed in the viewer. It will update automatically when content changes.
  1. Handle the available events by specifying event callbacks
<Editor @bind-Value="content"
        Load="HandleLoad"
        Change="HandleChange"
        CaretChange="HandleCaretChange"
        Focus="HandleFocus"
        Blur="HandleBlur"
        KeyDown="HandleKeyDown"
        KeyUp="HandleKeyUp"
        BeforePreviewRender="HandleBeforePreviewRender"
        BeforeConvertWYSIWYGToMarkdown="HandleBeforeConvertWYSIWYGToMarkdown" />

<Viewer Value="content"
        Load="HandleLoad"
        UpdatePreview="HandleUpdatePreview" />

These events are the same as the native public events, and the parameters are detailed in the code comments.

  1. Access the Editor or Viewer instance to invoke methods
<Editor @ref="editorRef" @bind-Value="markdown" Options="@options" />

<Viewer @ref="viewerRef" Value="markdown" />

<button @onclick="HandlePreview">Preview</button>

<Viewer @ref="viewerRef2"/>

@code {
    Editor editorRef = default!;
    Viewer viewerRef = default!;
    Viewer viewerRef2 = default!;
    string markdown = string.Empty;
    
    async Task HandlePreview()
    {
        var markdown = await editorRef.GetMarkdown();
        await viewerRef2.SetMarkdown(markdown);
    }
}

Most of all native methods have been implemented. Refer to the Editor class for available methods.

  1. Add custom language
  • Use Editor.SetLanguage static method to add custom language.
  • Use Editor.SetDefaultLanguage static method to set default language, it will be used when no language is set in EditorOptions.

Note: Please make sure Editor.SetLanguage and Editor.SetDefaultLanguage are called before Editor component is rendered.

  1. Widget rules

Due to BlazorServer mode not supporting JavaScript call .NET method synchronously, the widget rules only support in BlazorWebAssembly mode.

Implemented Features

  • Editor and Viewer basic usage
  • Editor and Viewer events
  • Language setting and custom language
  • Editor and Viewer instance methods
  • Toolbar with custom button
  • Add command and execute command
  • Add widget and set widget rules (only support in BlazorWebAssembly mode)
  • Link attributes
  • Custom markdown renderer
  • Custom HTML renderer
  • Custom HTML Sanitizer

License

This software is licensed under the MIT License

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 462 12/9/2023
0.1.2 292 7/10/2023
0.1.1 91 7/9/2023