Htmledit on input (#1070)

* adding a paramter for allow for no-tool HTMLEditors.

* Adding input event to the HTMLEditor
This commit is contained in:
Dave Bagler
2023-07-18 02:38:08 -04:00
committed by GitHub
parent f77ebe3af7
commit a2209e73fc
3 changed files with 21 additions and 2 deletions

View File

@@ -13,7 +13,7 @@
{
@ChildContent
}
else
else if (!NoTools)
{
<RadzenHtmlEditorUndo />
<RadzenHtmlEditorRedo />

View File

@@ -18,6 +18,12 @@ namespace Radzen.Blazor
/// </example>
public partial class RadzenHtmlEditor : FormComponent<string>
{
/// <summary>
/// Allows for no-tool HTML editors.
/// </summary>
[Parameter]
public bool NoTools { get; set; } = false;
/// <summary>
/// Gets or sets the mode of the editor.
/// </summary>
@@ -39,6 +45,13 @@ namespace Radzen.Blazor
[Parameter]
public IDictionary<string, string> UploadHeaders { get; set; }
/// <summary>
/// Gets or sets the input.
/// </summary>
/// <value>The input.</value>
[Parameter]
public EventCallback<string> Input { get; set; }
/// <summary>
/// A callback that will be invoked when the user pastes content in the editor. Commonly used to filter unwanted HTML.
/// </summary>
@@ -274,6 +287,7 @@ namespace Radzen.Blazor
public void OnChange(string html)
{
Html = html;
Input.InvokeAsync(html);
}
/// <summary>

View File

@@ -1,4 +1,4 @@
<RadzenHtmlEditor @bind-Value=@htmlValue style="height: 300px;" Change=@OnChange Paste=@OnPaste Execute=@OnExecute UploadUrl="upload/image" />
<RadzenHtmlEditor @bind-Value=@htmlValue style="height: 300px;" Input=@OnInput Change=@OnChange Paste=@OnPaste Execute=@OnExecute UploadUrl="upload/image" />
<EventConsole @ref=@console />
@@ -17,6 +17,11 @@
console.Log($"Change: {html}");
}
void OnInput(string html)
{
console.Log($"Input: {html}");
}
void OnExecute(HtmlEditorExecuteEventArgs args)
{
console.Log($"Execute: {args.CommandName}");