Skip to content

Commit

Permalink
added some missing doc block comments and bumped version
Browse files Browse the repository at this point in the history
  • Loading branch information
erinnmclaughlin committed Sep 9, 2024
1 parent 263d128 commit d9f7956
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions src/Tizzani.MudBlazor.HtmlEditor/MudHtmlEditor.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,66 @@ public sealed partial class MudHtmlEditor : IAsyncDisposable
[Parameter]
public RenderFragment? ChildContent { get; set; }

/// <summary>
/// Whether or not to ourline the editor. Default value is <see langword="true" />.
/// </summary>
[Parameter]
public bool Outlined { get; set; } = true;

/// <summary>
/// The placeholder text to display when the editor has not content.
/// </summary>
[Parameter]
public string Placeholder { get; set; } = "Tell your story...";

/// <summary>
/// The HTML markup from the editor.
/// </summary>
[Parameter]
public string Html { get; set; } = "";

/// <summary>
/// Raised when the <see cref="Html"/> property changes.
/// </summary>
[Parameter]
public EventCallback<string> HtmlChanged { get; set; }

/// <summary>
/// The plain-text content from the editor.
/// </summary>
[Parameter]
public string Text { get; set; } = "";

/// <summary>
/// Raised when the <see cref="Text"/> property changes.
/// </summary>
[Parameter]
public EventCallback<string> TextChanged { get; set; }

/// <summary>
/// Whether or not the user can resize the editor. Default value is <see langword="true" />.
/// </summary>
[Parameter]
public bool Resizable { get; set; } = true;

/// <summary>
/// Captures html attributes and applies them to the editor.
/// </summary>
[Parameter(CaptureUnmatchedValues = true)]
public IDictionary<string, object?>? UserAttributes { get; set; }


/// <summary>
/// Clears the content of the editor.
/// </summary>
public async Task Reset()
{
await SetHtml(string.Empty);
}

/// <summary>
/// Sets the HTML content of the editor to the specified <paramref name="html"/>.
/// </summary>
public async Task SetHtml(string html)
{
if (_quill is not null)
Expand All @@ -54,17 +85,25 @@ public async Task SetHtml(string html)
HandleTextContentChanged(await GetText());
}

/// <summary>
/// Gets the current HTML content of the editor.
/// </summary>
public async Task<string> GetHtml()
{
if (_quill is not null)
return await _quill.InvokeAsync<string>("getHtml");

return "";
}

/// <summary>
/// Gets the current plain-text content of the editor.
/// </summary>
public async Task<string> GetText()
{
if (_quill is not null)
return await _quill.InvokeAsync<string>("getText");

return "";
}

Expand All @@ -83,6 +122,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
}
}


[JSInvokable]
public async void HandleHtmlContentChanged(string html)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<RepositoryUrl>https://github.com/erinnmclaughlin/MudBlazor.HtmlEditor</RepositoryUrl>
<PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Version>2.1.0</Version>
<Version>2.2.0</Version>
<Description>A customizable HTML editor component for MudBlazor, powered by QuillJS.</Description>
<Copyright>2024 Erin McLaughlin</Copyright>
<PackageProjectUrl>https://github.com/erinnmclaughlin/MudBlazor.HtmlEditor</PackageProjectUrl>
Expand Down

0 comments on commit d9f7956

Please sign in to comment.